Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[winusb_open] unsupported API call for 'open' #187

Closed
Massimiliano-solutiontech opened this issue Nov 19, 2023 · 1 comment
Closed

[winusb_open] unsupported API call for 'open' #187

Massimiliano-solutiontech opened this issue Nov 19, 2023 · 1 comment

Comments

@Massimiliano-solutiontech

I have problems with open_device_with_vid_pid on Windows. My goal is to write data using control transfer (the device is a CP2102N)

let handle = context
    .open_device_with_vid_pid(0x10c4, 0xea60)
    .expect("Failed to open device");

the program panics with this stack trace and debug log

[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------        
[ 0.003949] [00003798] libusb: debug [libusb_get_device_list]  
[ 0.004067] [00003120] libusb: debug [windows_iocp_thread] I/O completion thread started
[ 0.016626] [00003798] libusb: debug [winusb_get_device_list] allocating new device for session [4B]
[ 0.017371] [00003798] libusb: debug [get_api_type] driver(s): BTHUSB
[ 0.017505] [00003798] libusb: debug [get_api_type] lower filter driver(s): AppleBtBc
[ 0.017579] [00003798] libusb: debug [winusb_get_device_list] allocating new device for session [3]
[ 0.018131] [00003798] libusb: debug [get_api_type] driver(s): silabser
[ 0.018259] [00003798] libusb: debug [winusb_get_device_list] allocating new device for session [2E]
[ 0.018515] [00003798] libusb: debug [get_api_type] driver(s): USBSTOR
[ 0.018641] [00003798] libusb: debug [get_api_type] lower filter driver(s): AppleSDR
[ 0.018718] [00003798] libusb: debug [winusb_get_device_list] allocating new device for session [38]
[ 0.019074] [00003798] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.019768] [00003798] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.019848] [00003798] libusb: debug [winusb_get_device_list] allocating new device for session [39]
[ 0.020203] [00003798] libusb: debug [enumerate_hcd_root_hub] assigning HCD 'PCI\VEN_8086&DEV_8C31&SUBSYS_72708086&REV_05\3&11583659&0&A0' bus number 1[ 0.021856] [00003798] libusb: debug [init_root_hub] root hub 'USB\ROOT_HUB30\4&290D1841&0&0' reports 21 ports
[ 0.022411] [00003798] libusb: warning [init_root_hub] could not get node connection information (V2) for root hub 'USB\ROOT_HUB30\4&290D1841&0&0' port 15: [87] Parametro non corretto.
[ 0.022533] [00003798] libusb: debug [init_device] (bus: 1, addr: 0, depth: 0, port: 0): 'USB\ROOT_HUB30\4&290D1841&0&0'
[ 0.022918] [00003798] libusb: debug [winusb_get_device_list] found existing device for session [2E]
[ 0.023083] [00003798] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.023168] [00003798] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 32 bytes)
[ 0.023266] [00003798] libusb: debug [init_device] (bus: 1, addr: 20, depth: 1, port: 5): 'USB\VID_10C4&PID_EA60\78F58BC206A4EC119CBAE689A29C855C'     
[ 0.023607] [00003798] libusb: debug [winusb_get_device_list] found existing device for session [38]
[ 0.023774] [00003798] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.023858] [00003798] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 44 bytes)
[ 0.024820] [00003798] libusb: debug [init_device] (bus: 1, addr: 4, depth: 1, port: 19): 'USB\VID_05AC&PID_8406\000000000820'
[ 0.025748] [00003798] libusb: debug [winusb_get_device_list] found existing device for session [39]
[ 0.026053] [00003798] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.026250] [00003798] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 141 bytes)
[ 0.026745] [00003798] libusb: debug [init_device] (bus: 1, addr: 3, depth: 1, port: 12): 'USB\VID_05AC&PID_0274\D3H63776031GHMFAH5FF'
[ 0.027237] [00003798] libusb: debug [winusb_get_device_list] found existing device for session [3]
[ 0.027543] [00003798] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.027816] [00003798] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 276 bytes)
[ 0.028027] [00003798] libusb: debug [init_device] (bus: 1, addr: 2, depth: 1, port: 8): 'USB\VID_05AC&PID_8290\5&330350CB&0&8'
[ 0.029685] [00003798] libusb: debug [winusb_get_device_list] setting composite interface for [39]:
[ 0.029910] [00003798] libusb: debug [set_composite_interface] interface[2] = \\?\HID#VID_05AC&PID_0274&MI_02&COL01#7&4E2CE0B&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}
[ 0.030330] [00003798] libusb: debug [winusb_get_device_list] setting composite interface for [39]:
[ 0.030688] [00003798] libusb: debug [set_composite_interface] interface[1] = \\?\HID#VID_05AC&PID_0274&MI_01&COL02#7&28BA0BCD&0&0001#{4D1E55B2-F16F-11CF-88CB-001111000030}
[ 0.031247] [00003798] libusb: debug [winusb_get_device_list] setting composite interface for [39]:
[ 0.031569] [00003798] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_05AC&PID_0274&MI_01&COL03\7&28BA0BCD&0&0002
[ 0.032044] [00003798] libusb: debug [winusb_get_device_list] setting composite interface for [39]:
[ 0.032324] [00003798] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_05AC&PID_0274&MI_01&COL04\7&28BA0BCD&0&0003
[ 0.033048] [00003798] libusb: debug [winusb_get_device_list] setting composite interface for [39]:
[ 0.033336] [00003798] libusb: debug [set_composite_interface] interface[0] = \\?\HID#VID_05AC&PID_0274&MI_00#7&10F67F88&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}
[ 0.034130] [00003798] libusb: debug [winusb_get_device_list] setting composite interface for [39]:
[ 0.034678] [00003798] libusb: debug [set_composite_interface] interface[4] = \\?\HID#VID_05AC&PID_0274&MI_04#7&730E372&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}
[ 0.035346] [00003798] libusb: debug [winusb_get_device_list] setting composite interface for [39]:
[ 0.035643] [00003798] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_05AC&PID_0274&MI_01&COL01\7&28BA0BCD&0&0000
[ 0.037002] [00003798] libusb: debug [winusb_get_device_list] setting composite interface for [39]:
[ 0.037326] [00003798] libusb: debug [set_composite_interface] interface[2] already set - ignoring HID collection: HID\VID_05AC&PID_0274&MI_02&COL02\7&4E2CE0B&0&0001
[ 0.038436] [00003798] libusb: debug [libusb_get_device_descriptor]
[ 0.038740] [00003798] libusb: debug [libusb_get_device_descriptor]
[ 0.038938] [00003798] libusb: debug [libusb_open] open 1.20
[ 0.039115] [00003798] libusb: debug [winusb_open] unsupported API call for 'open' (unrecognized device driver)
[ 0.039384] [00003798] libusb: debug [libusb_open] open 1.20 returns -12
[ 0.039779] [00003798] libusb: debug [libusb_unref_device] destroy device 1.20
[ 0.039959] [00003798] libusb: debug [libusb_unref_device] destroy device 1.4
[ 0.040216] [00003798] libusb: debug [libusb_unref_device] destroy device 1.3
[ 0.040403] [00003798] libusb: debug [libusb_unref_device] destroy device 1.2
[ 0.040630] [00003798] libusb: debug [libusb_unref_device] destroy device 1.0
thread 'main' panicked at src\main.rs:34:10:
Failed to open device
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library\std\src\panicking.rs:597
   1: core::panicking::panic_fmt
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library\core\src\panicking.rs:72
   2: core::panicking::panic_display
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library\core\src\panicking.rs:168
   3: core::panicking::panic_str
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library\core\src\panicking.rs:152
   4: core::option::expect_failed
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library\core\src\option.rs:1988
   5: enum2$<core::option::Option<rusb::device_handle::DeviceHandle<rusb::context::Context> > >::expect<rusb::device_handle::DeviceHandle<rusb::context::Context> >
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962\library\core\src\option.rs:898
   6: cp210x_gpio::main
             at .\src\main.rs:32
   7: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962\library\core\src\ops\function.rs:250
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[ 0.168418] [00003798] libusb: debug [libusb_exit]
[ 0.169231] [00003120] libusb: debug [windows_iocp_thread] I/O completion thread exiting
[ 0.170734] [00003798] libusb: debug [usbi_remove_event_source] remove HANDLE 00000000000000A4
[ 0.171480] [00003798] libusb: debug [usbi_remove_event_source] remove HANDLE 0000000000000098
error: process didn't exit successfully: `target\debug\cp210x-gpio.exe` (exit code: 101)
@a1ien
Copy link
Owner

a1ien commented Nov 22, 2023

You are trying to open an HID device. Please read this https://github.com/libusb/libusb/wiki/Windows#how-to-use-libusb-on-windows

@a1ien a1ien closed this as completed Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants