From: Xiaofan C. <xia...@gm...> - 2010-04-20 23:54:11
|
On Tue, Apr 20, 2010 at 7:53 AM, Xiaofan Chen <xia...@gm...> wrote: > I made a mistake here. Yes it can do control transfer, but only for > the feature report. > > You can use feature report (Control-IN and Control-Out) for the system > keyboard/mouse. But for output report, that is problematic. For Input > report, you can use Raw Input. > > http://www.lvr.com/hidfaq.htm > 1) Why do I receive "Access denied" when attempting to access my HID? > > Windows 2000 and later have exclusive read/write access to HIDs > that are configured as a system keyboards or mice. An application > can obtain a handle to a system keyboard or mouse by not requesting > READ or WRITE access with CreateFile. Applications can then use > HidD_SetFeature and HidD_GetFeature (if the device supports > Feature reports). > Just to show this. Here is a log running xusb against a USB mouse. The log is quite clear. mcuee@AcerPC ~/mcu/libusb1win32/git/cygwin/libusb-pbatard/examples $ ./xusb.exe -i 046d:c054 libusb:debug [libusb_init] libusb:debug [init_polling] Will use CancelIoEx for I/O cancellation libusb:debug [windows_clock_gettime_threaded] hires timer available (Frequency: 25000000 Hz) libusb:debug [usbi_add_pollfd] add fd 3 events 1 libusb:debug [libusb_init] created default context Opening device... libusb:debug [libusb_get_device_list] libusb:debug [usb_enumerate_hub] busnum 0 devaddr 0 session_id 0 libusb:debug [usb_enumerate_hub] allocating new device for session 0 libusb:debug [initialize_device] active config: 1 libusb:debug [usb_enumerate_hub] 8 ports Hub: \\.\USB#ROOT_HUB20#4&7056C45&0#{F1 8A0E88-C30C-11D0-8815-00A0C906BED8} libusb:debug [usb_enumerate_hub] busnum 1 devaddr 0 session_id 256 libusb:debug [usb_enumerate_hub] allocating new device for session 256 libusb:debug [initialize_device] active config: 1 libusb:debug [usb_enumerate_hub] 8 ports Hub: \\.\USB#ROOT_HUB#4&278C294E&0#{F18 A0E88-C30C-11D0-8815-00A0C906BED8} libusb:debug [usb_enumerate_hub] busnum 1 devaddr 1 session_id 257 $ libusb:debug [initialize_device] active config: 1 libusb:debug [cache_config_descriptors] cached config descriptor #1 (32 bytes) libusb:debug [usb_enumerate_hub] busnum 1 devaddr 2 session_id 258 libusb:debug [usb_enumerate_hub] allocating new device for session 258 libusb:debug [initialize_device] active config: 1 libusb:debug [cache_config_descriptors] cached config descriptor #1 (41 bytes) libusb:debug [cache_config_descriptors] cached config descriptor #2 (32 bytes) libusb:debug [usb_enumerate_hub] busnum 1 devaddr 3 session_id 259 libusb:debug [usb_enumerate_hub] allocating new device for session 259 libusb:debug [initialize_device] active config: 1 libusb:debug [cache_config_descriptors] cached config descriptor #1 (34 bytes) libusb:debug [usb_enumerate_hub] busnum 1 devaddr 4 session_id 260 libusb:debug [usb_enumerate_hub] allocating new device for session 260 libusb:debug [initialize_device] active config: 1 libusb:debug [cache_config_descriptors] cached config descriptor #1 (46 bytes) libusb:debug [set_device_paths] path (1:3): \\.\USB#VID_046D&PID_C054#5&207B166D &0&3#{A5DCBF10-6530-11D2-901F-00C04FB951ED} libusb:debug [set_device_paths] driver: HidUsb libusb:debug [set_hid_device] interface_path[0]: \\.\HID#VID_046D&PID_C054#6&334 DE466&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030} libusb:debug [set_device_paths] path (1:2): \\.\USB#VID_04D8&PID_0033#PK2NEW#{A5 DCBF10-6530-11D2-901F-00C04FB951ED} libusb:debug [set_device_paths] driver: HidUsb libusb:debug [set_hid_device] interface_path[0]: \\.\HID#VID_04D8&PID_0033#6&BD5 B18B&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030} libusb:debug [set_device_paths] path (1:1): \\.\USB#VID_058F&PID_9360#2004888#{A 5DCBF10-6530-11D2-901F-00C04FB951ED} libusb:debug [set_device_paths] driver: USBSTOR libusb:debug [set_device_paths] path (1:4): \\.\USB#VID_0925&PID_1456#5&207B166D &0&5#{A5DCBF10-6530-11D2-901F-00C04FB951ED} libusb:debug [set_device_paths] driver: WinUSB libusb:debug [libusb_get_device_descriptor] libusb:debug [libusb_get_device_descriptor] libusb:debug [libusb_get_device_descriptor] libusb:debug [libusb_get_device_descriptor] libusb:debug [libusb_get_device_descriptor] libusb:debug [libusb_open] open 1.3 libusb:warning [hid_open] could not open HID device in R/W mode (keyboard or mou se?) - trying without libusb:debug [hid_open] set maximum input buffer size to 512 libusb:debug [hid_open] 4 HID input report value(s) found libusb:debug [hid_open] will use report ID 0x00 for interrupt transfers libusb:debug [hid_open] 0 HID output report value(s) found libusb:debug [libusb_unref_device] destroy device 0.0 libusb:debug [libusb_unref_device] destroy device 1.0 libusb:debug [libusb_unref_device] destroy device 1.1 libusb:debug [libusb_unref_device] destroy device 1.2 libusb:debug [libusb_unref_device] destroy device 1.4 Reading device descriptor: libusb:debug [libusb_get_device_descriptor] length: 18 device class: 0 S/N: 0 VID:PID: 046D:C054 bcdDevice: 5400 iMan:iProd:iSer: 1:2:0 nb confs: 1 Reading configuration descriptors: libusb:debug [libusb_get_config_descriptor] index 0 nb interfaces: 1 interface[0].altsetting[0]: num endpoints = 1 Class.SubClass.Protocol: 03.01.02 endpoint[0].address: 81 max packet size: 0006 polling interval: 0A Reading string descriptors: libusb:debug [libusb_claim_interface] interface 0 libusb:debug [hid_claim_interface] claimed interface 0 libusb:debug [libusb_get_config_descriptor] index 0 libusb:debug [windows_assign_endpoints] (re)assigned endpoint 81 to interface 0 libusb:warning [hid_submit_control_transfer] auto-claimed interface 0 for contro l request libusb:debug [hid_submit_control_transfer] will use interface 0 libusb:debug [_hid_get_descriptor] LIBUSB_DT_STRING libusb:debug [usbi_add_pollfd] add fd 5 events 1 libusb:debug [libusb_get_next_timeout] next timeout in 0.992920s libusb:debug [handle_events] poll() 2 fds with timeout in 993ms libusb:debug [handle_events] poll() returned 1 libusb:debug [windows_handle_events] checking fd 3 with revents = 0000 libusb:debug [windows_handle_events] checking fd 5 with revents = 0001 libusb:debug [usbi_remove_pollfd] remove fd 5 libusb:debug [windows_transfer_callback] handling I/O completion with errcode 0 libusb:debug [ctrl_transfer_cb] actual_length=4 libusb:debug [hid_submit_control_transfer] will use interface 0 libusb:debug [_hid_get_descriptor] LIBUSB_DT_STRING libusb:debug [usbi_add_pollfd] add fd 5 events 1 libusb:debug [libusb_get_next_timeout] next timeout in 0.997440s libusb:debug [handle_events] poll() 2 fds with timeout in 998ms libusb:debug [handle_events] poll() returned 1 libusb:debug [windows_handle_events] checking fd 3 with revents = 0000 libusb:debug [windows_handle_events] checking fd 5 with revents = 0001 libusb:debug [usbi_remove_pollfd] remove fd 5 libusb:debug [windows_transfer_callback] handling I/O completion with errcode 0 libusb:debug [ctrl_transfer_cb] actual_length=4 libusb:debug [hid_submit_control_transfer] will use interface 0 libusb:debug [_hid_get_descriptor] LIBUSB_DT_STRING libusb:debug [usbi_add_pollfd] add fd 5 events 1 libusb:debug [libusb_get_next_timeout] next timeout in 0.997280s libusb:debug [handle_events] poll() 2 fds with timeout in 998ms libusb:debug [handle_events] poll() returned 1 libusb:debug [windows_handle_events] checking fd 3 with revents = 0000 libusb:debug [windows_handle_events] checking fd 5 with revents = 0001 libusb:debug [usbi_remove_pollfd] remove fd 5 libusb:debug [windows_transfer_callback] handling I/O completion with errcode 0 libusb:debug [ctrl_transfer_cb] actual_length=18 String (1/3): "Logitech" libusb:debug [hid_submit_control_transfer] will use interface 0 libusb:debug [_hid_get_descriptor] LIBUSB_DT_STRING libusb:debug [usbi_add_pollfd] add fd 5 events 1 libusb:debug [libusb_get_next_timeout] next timeout in 0.997440s libusb:debug [handle_events] poll() 2 fds with timeout in 998ms libusb:debug [handle_events] poll() returned 1 libusb:debug [windows_handle_events] checking fd 3 with revents = 0000 libusb:debug [windows_handle_events] checking fd 5 with revents = 0001 libusb:debug [usbi_remove_pollfd] remove fd 5 libusb:debug [windows_transfer_callback] handling I/O completion with errcode 0 libusb:debug [ctrl_transfer_cb] actual_length=4 libusb:debug [hid_submit_control_transfer] will use interface 0 libusb:debug [_hid_get_descriptor] LIBUSB_DT_STRING libusb:debug [usbi_add_pollfd] add fd 5 events 1 libusb:debug [libusb_get_next_timeout] next timeout in 0.997400s libusb:debug [handle_events] poll() 2 fds with timeout in 998ms libusb:debug [handle_events] poll() returned 1 libusb:debug [windows_handle_events] checking fd 3 with revents = 0000 libusb:debug [windows_handle_events] checking fd 5 with revents = 0001 libusb:debug [usbi_remove_pollfd] remove fd 5 libusb:debug [windows_transfer_callback] handling I/O completion with errcode 0 libusb:debug [ctrl_transfer_cb] actual_length=36 String (2/3): "USB Optical Mouse" libusb:debug [hid_submit_control_transfer] will use interface 0 libusb:debug [_hid_get_descriptor] LIBUSB_DT_STRING libusb:debug [usbi_add_pollfd] add fd 5 events 1 libusb:debug [libusb_get_next_timeout] next timeout in 0.996800s libusb:debug [handle_events] poll() 2 fds with timeout in 997ms libusb:debug [handle_events] poll() returned 1 libusb:debug [windows_handle_events] checking fd 3 with revents = 0000 libusb:debug [windows_handle_events] checking fd 5 with revents = 0001 libusb:debug [usbi_remove_pollfd] remove fd 5 libusb:debug [windows_transfer_callback] handling I/O completion with errcode 0 libusb:debug [ctrl_transfer_cb] actual_length=4 libusb:debug [hid_submit_control_transfer] will use interface 0 libusb:debug [_hid_get_descriptor] LIBUSB_DT_STRING libusb:debug [usbi_add_pollfd] add fd 5 events 1 libusb:debug [libusb_get_next_timeout] next timeout in 0.997440s libusb:debug [handle_events] poll() 2 fds with timeout in 998ms libusb:debug [handle_events] poll() returned 1 libusb:debug [windows_handle_events] checking fd 3 with revents = 0000 libusb:debug [windows_handle_events] checking fd 5 with revents = 0001 libusb:debug [usbi_remove_pollfd] remove fd 5 libusb:debug [windows_transfer_callback] handling I/O completion with errcode 0 libusb:debug [ctrl_transfer_cb] actual_length=2 String (3/3): "" Reading HID Report Descriptors: libusb:debug [hid_submit_control_transfer] will use interface 0 libusb:debug [_hid_get_descriptor] LIBUSB_DT_REPORT libusb:debug [usbi_add_pollfd] add fd 5 events 1 libusb:debug [libusb_get_next_timeout] next timeout in 0.997440s libusb:debug [handle_events] poll() 2 fds with timeout in 998ms libusb:debug [handle_events] poll() returned 1 libusb:debug [windows_handle_events] checking fd 3 with revents = 0000 libusb:debug [windows_handle_events] checking fd 5 with revents = 0001 libusb:debug [usbi_remove_pollfd] remove fd 5 libusb:debug [windows_transfer_callback] handling I/O completion with errcode 0 libusb:debug [ctrl_transfer_cb] actual_length=20 06 A0 FF 09 01 A1 01 09 01 15 00 25 FF 75 08 95 06 81 00 C0 Skipping Feature Report readout (None detected) Reading Input Report (length 6)... libusb:debug [hid_submit_control_transfer] will use interface 0 libusb:debug [_hid_get_report] report ID: 0x00 libusb:debug [_hid_get_report] Failed to Read HID Input Report: [5] Access is de nied. Error: Input/output error Testing interrupt read using endpoint 81... libusb:debug [hid_submit_bulk_transfer] matched endpoint 81 with interface 0 libusb:debug [hid_submit_bulk_transfer] reading 7 bytes (report ID: 0x00) libusb:error [hid_submit_bulk_transfer] HID transfer failed: [5] Access is denie d. Input/output error Releasing interface 0... libusb:debug [libusb_release_interface] interface 0 libusb:debug [libusb_get_config_descriptor] index 0 libusb:debug [windows_assign_endpoints] (re)assigned endpoint 81 to interface 0 Closing device... libusb:debug [libusb_close] libusb:debug [libusb_unref_device] destroy device 1.3 libusb:debug [libusb_exit] libusb:debug [usbi_remove_pollfd] remove fd 3 libusb:debug [windows_clock_gettime_threaded] timer thread quitting libusb:debug [libusb_exit] freeing default context -- Xiaofan http://mcuee.blogspot.com |