Bob Tausworthe
2014-07-29 21:28:16 UTC
Sorry to trouble you but I've exhausted other options. We are developing a
composite HID/debug interace device and are using libusb 1.0 under 32 bit
Cygwin to access the debug interface portion. Everything is working fine on
Windows 7 and Linux but when we try to run the application on Windows 8, it
fails with the error :
libusb: debug [unsupported_open] unsupported API call for 'open'
(unrecognized device driver)
libusb: debug [libusb_open] open 2.16 returns -12
ERROR: Unable to open usb device
After reading some posts of people with similar issues, I tried all of the
drivers Zadig supports but didn't see any difference in behavior. I have
tried building under Win7 and Win8 but the results are the same. I am using
version 1.0.18 of libusb. The trace below was taken with the WinUSB driver
version 6.1.7600.16385.
Any help you can give me to point me in the right direction would be
welcome. Here is the code I'm using to open our device and the trace
listing.
Thanks
Bob Tausworthe
***@sentons.com
Sentons, inc.
int
InitUSB(void)
{
// Change these as needed to match idVendor and idProduct in your
device's device descriptor.
int device_ready = 0;
int result;
libusb_device **list;
libusb_device *found = NULL;
libusb_context *ctx = NULL;
int attached = 0;
result = libusb_init(&ctx);
if (result == 0) {
if (usb_trace_enabled)
libusb_set_debug(ctx,255); // LIBUSB_LOG_LEVEL_DEBUG,
LIBUSB_LOG_LEVEL_WARNING
ssize_t i = 0;
int err = 0;
ssize_t cnt = libusb_get_device_list(ctx, &list);
if (cnt < 0){
fprintf(stderr, "ERROR: no usb devices found\n" );
error();
}
// find our device. Note we are using the brute force method rather
// than open_device_with_vid_pid() because we need the device pointer
// to look at the config descriptor.
for(i = 0; i < cnt; i++){
libusb_device *device = list[i];
if( is_correctdev(device) ){
found = device;
break;
}
}
if(!found){
fprintf(stderr, "ERROR: could not find device\n");
error();
} else {
if (verbose_flag) printf( "found usb-dev!\n" );
}
struct libusb_config_descriptor *p_cfgd;
/** Set the interface based on config desc value */
/** Use interface 0 if we are HID only device */
/** Use interface 1 if we are combo HID/SonaCom */
result = libusb_get_active_config_descriptor(found, &p_cfgd);
if (result < 0) {
fprintf(stderr, "ERROR: could not get configuration descriptor: %d\n",
result);
error();
} else {
if (verbose_flag) printf("Attaching to interface %d...\n",
p_cfgd->bNumInterfaces-1);
}
INTERFACE_NUMBER = p_cfgd->bNumInterfaces-1;
libusb_free_config_descriptor(p_cfgd);
/** open device and get its handle */
err = libusb_open(found, &devh);
if (err){
fprintf(stderr, "ERROR: Unable to open usb device\n");
error();
}
/** Free Device List */
libusb_free_device_list(list, 1 /* unref devices */);
/** detach kernel: NEEDED??? */
if ( libusb_kernel_driver_active(devh,0) ){
libusb_detach_kernel_driver(devh,0);
attached = 1;
} else if (verbose_flag) printf("Device free from kernel\n");
if (devh != NULL) {
/** now attempt to attach to interface */
result = libusb_claim_interface(devh, INTERFACE_NUMBER);
if (result >= 0) {
device_ready = 1;
} else {
fprintf(stderr, "libusb_claim_interface error %d\n", result);
}
} else {
fprintf(stderr, "Unable to find the device.\n");
}
} else {
fprintf(stderr, "Unable to initialize libusb.\n");
return(1);
}
return 0;
}
libusb: debug [libusb_get_device_list]
libusb: debug [windows_get_device_list] allocating new device for session
[2A2]
libusb: debug [windows_get_device_list] allocating new device for session
[283]
libusb: warning [windows_get_device_list] could not retrieve port number
for device '\\.\ROOT#INTEL_UOIP_BUS_DRIVER#0000', skipping: [13] The data
is invalid.
libusb: debug [get_api_type] driver(s): usbhub
libusb: debug [get_api_type] matched driver name against HUB API API
libusb: debug [windows_get_device_list] allocating new device for session
[31]
libusb: debug [get_api_type] driver(s): usbhub
libusb: debug [get_api_type] matched driver name against HUB API API
libusb: debug [windows_get_device_list] allocating new device for session
[324]
libusb: debug [get_api_type] driver(s): USBHUB3
libusb: debug [get_api_type] matched driver name against HUB API API
libusb: debug [windows_get_device_list] allocating new device for session
[3F4]
libusb: debug [windows_get_device_list] allocating new device for session
[2B6]
libusb: debug [init_device] got bus number from ancestor #3
libusb: debug [init_device] found 1 configurations (active conf: 1)
libusb: debug [cache_config_descriptors] cached config descriptor 0
(bConfigurationValue=1, 71 bytes)
libusb: debug [init_device] (bus: 2, addr: 16, depth: 1, port: 2):
'\\.\USB#VID_2848&PID_8003&MI_00#6&19BCFBB8&0&0000'
libusb: debug [windows_get_device_list] extra GUID:
{856BB44E-43CD-4F1C-9500-346AF6F6CF2C}
libusb: debug [windows_get_device_list] allocating new device for session
[8C]
libusb: debug [init_device] found 1 configurations (active conf: 1)
libusb: debug [cache_config_descriptors] cached config descriptor 0
(bConfigurationValue=1, 34 bytes)
libusb: debug [init_device] (bus: 2, addr: 4, depth: 1, port: 3):
'\\.\USB#VID_2848&PID_8003&MI_01#6&19BCFBB8&0&0001'
libusb: debug [windows_get_device_list] allocating new device for session
[D3]
libusb: debug [init_device] found 1 configurations (active conf: 1)
libusb: debug [cache_config_descriptors] cached config descriptor 0
(bConfigurationValue=1, 71 bytes)
libusb: debug [init_device] (bus: 2, addr: 16, depth: 1, port: 2):
'\\.\USB#VID_2848&PID_8003#BETA'
libusb: debug [windows_get_device_list] found existing device for session
[31] (0.0)
libusb: debug [init_device] got bus number from ancestor #2
libusb: debug [init_device] found 1 configurations (active conf: 1)
libusb: debug [cache_config_descriptors] cached config descriptor 0
(bConfigurationValue=1, 25 bytes)
libusb: debug [init_device] (bus: 1, addr: 2, depth: 1, port: 1):
'\\.\USB#VID_8087&PID_8000#5&2864ADB3&1&1'
libusb: debug [windows_get_device_list] allocating new device for session
[1EB]
libusb: debug [init_device] found 1 configurations (active conf: 1)
libusb: debug [cache_config_descriptors] cached config descriptor 0
(bConfigurationValue=1, 796 bytes)
libusb: debug [init_device] (bus: 2, addr: 3, depth: 1, port: 5):
'\\.\USB#VID_04F2&PID_B3BE&MI_00#6&2D1249EA&0&0000'
libusb: debug [windows_get_device_list] allocating new device for session
[256]
libusb: debug [init_device] found 1 configurations (active conf: 1)
libusb: debug [cache_config_descriptors] cached config descriptor 0
(bConfigurationValue=1, 177 bytes)
libusb: debug [init_device] (bus: 2, addr: 2, depth: 1, port: 6):
'\\.\USB#VID_8087&PID_07DC#5&1B292275&0&6'
libusb: debug [windows_get_device_list] allocating new device for session
[2B0]
libusb: debug [init_device] found 1 configurations (active conf: 1)
libusb: debug [cache_config_descriptors] cached config descriptor 0
(bConfigurationValue=1, 34 bytes)
libusb: debug [init_device] (bus: 2, addr: 4, depth: 1, port: 3):
'\\.\USB#VID_0EEF&PID_A108#5&1B292275&0&3'
libusb: debug [windows_get_device_list] allocating new device for session
[231]
libusb: debug [init_device] found 1 configurations (active conf: 1)
libusb: debug [cache_config_descriptors] cached config descriptor 0
(bConfigurationValue=1, 796 bytes)
libusb: debug [init_device] (bus: 2, addr: 3, depth: 1, port: 5):
'\\.\USB#VID_04F2&PID_B3BE#0X0001'
libusb: debug [windows_get_device_list] found existing device for session
[324] (1.0)
libusb: debug [init_device] (bus: 1, addr: 1, depth: 0, port: 0):
'\\.\USB#ROOT_HUB20#4&36E14FC0&0'
libusb: debug [discovered_devs_append] need to increase capacity
libusb: debug [windows_get_device_list] allocating new device for session
[3CF]
libusb: debug [init_device] found 1 configurations (active conf: 1)
libusb: debug [cache_config_descriptors] cached config descriptor 0
(bConfigurationValue=1, 39 bytes)
libusb: debug [init_device] (bus: 2, addr: 7, depth: 1, port: 1):
'\\.\USB#VID_0B95&PID_7720#11309D'
libusb: debug [windows_get_device_list] found existing device for session
[3F4] (2.0)
libusb: debug [init_device] (bus: 2, addr: 1, depth: 0, port: 0):
'\\.\USB#ROOT_HUB30#4&1881582C&0&0'
libusb: debug [get_api_type] driver(s): HidUsb
libusb: debug [get_api_type] matched driver name against HID API API
libusb: debug [windows_get_device_list] found existing device for session
[2B0] (2.4)
libusb: debug [get_api_type] driver(s): AX88772
libusb: debug [windows_get_device_list] found existing device for session
[3CF] (2.7)
libusb: debug [get_api_type] driver(s): usbccgp
libusb: debug [get_api_type] matched driver name against Composite API API
libusb: debug [windows_get_device_list] found existing device for session
[D3] (2.16)
libusb: debug [get_api_type] driver(s): BTHUSB
libusb: debug [get_api_type] lower filter driver(s): ibtusb;btmhsf
libusb: debug [windows_get_device_list] found existing device for session
[256] (2.2)
libusb: debug [get_api_type] driver(s): usbccgp
libusb: debug [get_api_type] matched driver name against Composite API API
libusb: debug [windows_get_device_list] found existing device for session
[231] (2.3)
libusb: debug [windows_get_device_list] setting HID interface for [2B0]:
libusb: debug [set_hid_interface] interface[0] =
\\.\HID#VID_0EEF&PID_A108&COL02#6&2F153F61&0&0001#{4D1E55B2-F16F-11CF-88CB-001111000030}
libusb: debug [windows_get_device_list] setting HID interface for [2B0]:
libusb: debug [set_hid_interface] interface[1] =
\\.\HID#VID_0EEF&PID_A108&COL03#6&2F153F61&0&0002#{4D1E55B2-F16F-11CF-88CB-001111000030}
libusb: debug [get_api_type] driver(s): WinUSB
libusb: debug [get_api_type] matched driver name against WinUSB API
libusb: debug [windows_get_device_list] setting composite interface for
[D3]:
libusb: debug [set_composite_interface] interface[1] =
\\.\USB#VID_2848&PID_8003&MI_01#6&19BCFBB8&0&0001#{856BB44E-43CD-4F1C-9500-346AF6F6CF2C}
libusb: debug [libusb_get_device_descriptor]
found usb-dev!
Attaching to interface 1...
libusb: debug [libusb_open] open 2.16
libusb: debug [unsupported_open] unsupported API call for 'open'
(unrecognized device driver)
libusb: debug [libusb_open] open 2.16 returns -12
ERROR: Unable to open usb device
l
composite HID/debug interace device and are using libusb 1.0 under 32 bit
Cygwin to access the debug interface portion. Everything is working fine on
Windows 7 and Linux but when we try to run the application on Windows 8, it
fails with the error :
libusb: debug [unsupported_open] unsupported API call for 'open'
(unrecognized device driver)
libusb: debug [libusb_open] open 2.16 returns -12
ERROR: Unable to open usb device
After reading some posts of people with similar issues, I tried all of the
drivers Zadig supports but didn't see any difference in behavior. I have
tried building under Win7 and Win8 but the results are the same. I am using
version 1.0.18 of libusb. The trace below was taken with the WinUSB driver
version 6.1.7600.16385.
Any help you can give me to point me in the right direction would be
welcome. Here is the code I'm using to open our device and the trace
listing.
Thanks
Bob Tausworthe
***@sentons.com
Sentons, inc.
int
InitUSB(void)
{
// Change these as needed to match idVendor and idProduct in your
device's device descriptor.
int device_ready = 0;
int result;
libusb_device **list;
libusb_device *found = NULL;
libusb_context *ctx = NULL;
int attached = 0;
result = libusb_init(&ctx);
if (result == 0) {
if (usb_trace_enabled)
libusb_set_debug(ctx,255); // LIBUSB_LOG_LEVEL_DEBUG,
LIBUSB_LOG_LEVEL_WARNING
ssize_t i = 0;
int err = 0;
ssize_t cnt = libusb_get_device_list(ctx, &list);
if (cnt < 0){
fprintf(stderr, "ERROR: no usb devices found\n" );
error();
}
// find our device. Note we are using the brute force method rather
// than open_device_with_vid_pid() because we need the device pointer
// to look at the config descriptor.
for(i = 0; i < cnt; i++){
libusb_device *device = list[i];
if( is_correctdev(device) ){
found = device;
break;
}
}
if(!found){
fprintf(stderr, "ERROR: could not find device\n");
error();
} else {
if (verbose_flag) printf( "found usb-dev!\n" );
}
struct libusb_config_descriptor *p_cfgd;
/** Set the interface based on config desc value */
/** Use interface 0 if we are HID only device */
/** Use interface 1 if we are combo HID/SonaCom */
result = libusb_get_active_config_descriptor(found, &p_cfgd);
if (result < 0) {
fprintf(stderr, "ERROR: could not get configuration descriptor: %d\n",
result);
error();
} else {
if (verbose_flag) printf("Attaching to interface %d...\n",
p_cfgd->bNumInterfaces-1);
}
INTERFACE_NUMBER = p_cfgd->bNumInterfaces-1;
libusb_free_config_descriptor(p_cfgd);
/** open device and get its handle */
err = libusb_open(found, &devh);
if (err){
fprintf(stderr, "ERROR: Unable to open usb device\n");
error();
}
/** Free Device List */
libusb_free_device_list(list, 1 /* unref devices */);
/** detach kernel: NEEDED??? */
if ( libusb_kernel_driver_active(devh,0) ){
libusb_detach_kernel_driver(devh,0);
attached = 1;
} else if (verbose_flag) printf("Device free from kernel\n");
if (devh != NULL) {
/** now attempt to attach to interface */
result = libusb_claim_interface(devh, INTERFACE_NUMBER);
if (result >= 0) {
device_ready = 1;
} else {
fprintf(stderr, "libusb_claim_interface error %d\n", result);
}
} else {
fprintf(stderr, "Unable to find the device.\n");
}
} else {
fprintf(stderr, "Unable to initialize libusb.\n");
return(1);
}
return 0;
}
libusb: debug [libusb_get_device_list]
libusb: debug [windows_get_device_list] allocating new device for session
[2A2]
libusb: debug [windows_get_device_list] allocating new device for session
[283]
libusb: warning [windows_get_device_list] could not retrieve port number
for device '\\.\ROOT#INTEL_UOIP_BUS_DRIVER#0000', skipping: [13] The data
is invalid.
libusb: debug [get_api_type] driver(s): usbhub
libusb: debug [get_api_type] matched driver name against HUB API API
libusb: debug [windows_get_device_list] allocating new device for session
[31]
libusb: debug [get_api_type] driver(s): usbhub
libusb: debug [get_api_type] matched driver name against HUB API API
libusb: debug [windows_get_device_list] allocating new device for session
[324]
libusb: debug [get_api_type] driver(s): USBHUB3
libusb: debug [get_api_type] matched driver name against HUB API API
libusb: debug [windows_get_device_list] allocating new device for session
[3F4]
libusb: debug [windows_get_device_list] allocating new device for session
[2B6]
libusb: debug [init_device] got bus number from ancestor #3
libusb: debug [init_device] found 1 configurations (active conf: 1)
libusb: debug [cache_config_descriptors] cached config descriptor 0
(bConfigurationValue=1, 71 bytes)
libusb: debug [init_device] (bus: 2, addr: 16, depth: 1, port: 2):
'\\.\USB#VID_2848&PID_8003&MI_00#6&19BCFBB8&0&0000'
libusb: debug [windows_get_device_list] extra GUID:
{856BB44E-43CD-4F1C-9500-346AF6F6CF2C}
libusb: debug [windows_get_device_list] allocating new device for session
[8C]
libusb: debug [init_device] found 1 configurations (active conf: 1)
libusb: debug [cache_config_descriptors] cached config descriptor 0
(bConfigurationValue=1, 34 bytes)
libusb: debug [init_device] (bus: 2, addr: 4, depth: 1, port: 3):
'\\.\USB#VID_2848&PID_8003&MI_01#6&19BCFBB8&0&0001'
libusb: debug [windows_get_device_list] allocating new device for session
[D3]
libusb: debug [init_device] found 1 configurations (active conf: 1)
libusb: debug [cache_config_descriptors] cached config descriptor 0
(bConfigurationValue=1, 71 bytes)
libusb: debug [init_device] (bus: 2, addr: 16, depth: 1, port: 2):
'\\.\USB#VID_2848&PID_8003#BETA'
libusb: debug [windows_get_device_list] found existing device for session
[31] (0.0)
libusb: debug [init_device] got bus number from ancestor #2
libusb: debug [init_device] found 1 configurations (active conf: 1)
libusb: debug [cache_config_descriptors] cached config descriptor 0
(bConfigurationValue=1, 25 bytes)
libusb: debug [init_device] (bus: 1, addr: 2, depth: 1, port: 1):
'\\.\USB#VID_8087&PID_8000#5&2864ADB3&1&1'
libusb: debug [windows_get_device_list] allocating new device for session
[1EB]
libusb: debug [init_device] found 1 configurations (active conf: 1)
libusb: debug [cache_config_descriptors] cached config descriptor 0
(bConfigurationValue=1, 796 bytes)
libusb: debug [init_device] (bus: 2, addr: 3, depth: 1, port: 5):
'\\.\USB#VID_04F2&PID_B3BE&MI_00#6&2D1249EA&0&0000'
libusb: debug [windows_get_device_list] allocating new device for session
[256]
libusb: debug [init_device] found 1 configurations (active conf: 1)
libusb: debug [cache_config_descriptors] cached config descriptor 0
(bConfigurationValue=1, 177 bytes)
libusb: debug [init_device] (bus: 2, addr: 2, depth: 1, port: 6):
'\\.\USB#VID_8087&PID_07DC#5&1B292275&0&6'
libusb: debug [windows_get_device_list] allocating new device for session
[2B0]
libusb: debug [init_device] found 1 configurations (active conf: 1)
libusb: debug [cache_config_descriptors] cached config descriptor 0
(bConfigurationValue=1, 34 bytes)
libusb: debug [init_device] (bus: 2, addr: 4, depth: 1, port: 3):
'\\.\USB#VID_0EEF&PID_A108#5&1B292275&0&3'
libusb: debug [windows_get_device_list] allocating new device for session
[231]
libusb: debug [init_device] found 1 configurations (active conf: 1)
libusb: debug [cache_config_descriptors] cached config descriptor 0
(bConfigurationValue=1, 796 bytes)
libusb: debug [init_device] (bus: 2, addr: 3, depth: 1, port: 5):
'\\.\USB#VID_04F2&PID_B3BE#0X0001'
libusb: debug [windows_get_device_list] found existing device for session
[324] (1.0)
libusb: debug [init_device] (bus: 1, addr: 1, depth: 0, port: 0):
'\\.\USB#ROOT_HUB20#4&36E14FC0&0'
libusb: debug [discovered_devs_append] need to increase capacity
libusb: debug [windows_get_device_list] allocating new device for session
[3CF]
libusb: debug [init_device] found 1 configurations (active conf: 1)
libusb: debug [cache_config_descriptors] cached config descriptor 0
(bConfigurationValue=1, 39 bytes)
libusb: debug [init_device] (bus: 2, addr: 7, depth: 1, port: 1):
'\\.\USB#VID_0B95&PID_7720#11309D'
libusb: debug [windows_get_device_list] found existing device for session
[3F4] (2.0)
libusb: debug [init_device] (bus: 2, addr: 1, depth: 0, port: 0):
'\\.\USB#ROOT_HUB30#4&1881582C&0&0'
libusb: debug [get_api_type] driver(s): HidUsb
libusb: debug [get_api_type] matched driver name against HID API API
libusb: debug [windows_get_device_list] found existing device for session
[2B0] (2.4)
libusb: debug [get_api_type] driver(s): AX88772
libusb: debug [windows_get_device_list] found existing device for session
[3CF] (2.7)
libusb: debug [get_api_type] driver(s): usbccgp
libusb: debug [get_api_type] matched driver name against Composite API API
libusb: debug [windows_get_device_list] found existing device for session
[D3] (2.16)
libusb: debug [get_api_type] driver(s): BTHUSB
libusb: debug [get_api_type] lower filter driver(s): ibtusb;btmhsf
libusb: debug [windows_get_device_list] found existing device for session
[256] (2.2)
libusb: debug [get_api_type] driver(s): usbccgp
libusb: debug [get_api_type] matched driver name against Composite API API
libusb: debug [windows_get_device_list] found existing device for session
[231] (2.3)
libusb: debug [windows_get_device_list] setting HID interface for [2B0]:
libusb: debug [set_hid_interface] interface[0] =
\\.\HID#VID_0EEF&PID_A108&COL02#6&2F153F61&0&0001#{4D1E55B2-F16F-11CF-88CB-001111000030}
libusb: debug [windows_get_device_list] setting HID interface for [2B0]:
libusb: debug [set_hid_interface] interface[1] =
\\.\HID#VID_0EEF&PID_A108&COL03#6&2F153F61&0&0002#{4D1E55B2-F16F-11CF-88CB-001111000030}
libusb: debug [get_api_type] driver(s): WinUSB
libusb: debug [get_api_type] matched driver name against WinUSB API
libusb: debug [windows_get_device_list] setting composite interface for
[D3]:
libusb: debug [set_composite_interface] interface[1] =
\\.\USB#VID_2848&PID_8003&MI_01#6&19BCFBB8&0&0001#{856BB44E-43CD-4F1C-9500-346AF6F6CF2C}
libusb: debug [libusb_get_device_descriptor]
found usb-dev!
Attaching to interface 1...
libusb: debug [libusb_open] open 2.16
libusb: debug [unsupported_open] unsupported API call for 'open'
(unrecognized device driver)
libusb: debug [libusb_open] open 2.16 returns -12
ERROR: Unable to open usb device
l