Re: [Libusbx-devel] Getting unsupported API call for 'open' on Windows 8.1 libusb

2014-08-05 Thread Bob Tausworthe
Thank you for the reply. Sorry for the confusion. I am using lib usb
1.0.19. I guess I am on the wrong mailing list. So many flavors of open
source... what is the correct list for lib usb for windows? Can I transfer
the thread or do I need to repost in the correct list?

Bob Tausworthe
On Aug 5, 2014 5:57 PM, Xiaofan Chen xiaof...@gmail.com wrote:

 On Wed, Jul 30, 2014 at 5:28 AM, Bob Tausworthe t...@sentons.com wrote:
  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.
 

 libusbx is no longer been updated since it has merged back to libusb.
 You should try libusb-1.0.19 first to see if that helps.
 http://sourceforge.net/projects/libusb/files/libusb-1.0/

 --
 Xiaofan


 --
 Infragistics Professional
 Build stunning WinForms apps today!
 Reboot your WinForms applications with our WinForms controls.
 Build a bridge from your legacy apps to the future.

 http://pubads.g.doubleclick.net/gampad/clk?id=153845071iu=/4140/ostg.clktrk
 ___
 libusbx-devel mailing list
 libusbx-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/libusbx-devel

--
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071iu=/4140/ostg.clktrk___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Getting unsupported API call for 'open' on Windows 8.1 libusb

2014-08-05 Thread Xiaofan Chen
On Wed, Aug 6, 2014 at 9:08 AM, Bob Tausworthe t...@sentons.com wrote:
 Thank you for the reply. Sorry for the confusion. I am using lib usb 1.0.19.
 I guess I am on the wrong mailing list. So many flavors of open source...
 what is the correct list for lib usb for windows? Can I transfer the thread
 or do I need to repost in the correct list?

You can use libusb-devel.
https://lists.sourceforge.net/lists/listinfo/libusb-devel

You will have to repost in the libusb-devel list.

-- 
Xiaofan

--
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071iu=/4140/ostg.clktrk
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Getting unsupported API call for 'open' on Windows 8.1 libusb

2014-08-04 Thread Matthias Bolte
Hi, I had a similar problem a while ago, but my device look-up
strategy was a bit different. My problem was related to a driver bug
that made the Window API report the same hub port for two devices.
This should be impossible and confused libusb, as it assumes that hub
ports are unique. In the end I got the same error as you, because I
tried to open a device for which libusb didn't assign the proper
backend to. This made the open call fail with an unsupported error.

Anyway, you said this problem only occurs on Windows 8. How do you
test the different operating systems? Do you use different virtual
machines, or do you use different physical PCs? Maybe Windows 8 is not
the problem, but you're testing Windows 8 on a PC that has a USB host
controller with a buggy driver.

Things you could test:

- Test Windows 8 on different hardware.

- Test with your device connected to a different USB port, if it's
connected to a USB3 port then try a USB2 port.

- If you're testing Windows 8 in a virtual machine then try with
Windows 8 on an actual PC, maybe the problem is in the USB
pass-through of the virtual machine.

- In the for loop where you call is_correctdev(), don't break on the
first matching device, but check all devices in the list to see if
libusb reports multiple matching ones. If it does and you only have
one device actually connected, then you might have a similar problem
compared to the problem I had.

- Did you try the xusb examples that comes with libusb? Is xusb able
to list information about your device?

Some more things to test. This should not make a difference, but I
suggest testing it anyway:

- Simplify your test program: remove the config descriptor stuff
before the libusb_open() call.

- You said you're using cygwin, try without cygwin.

Regards,
Matthias


2014-08-02 3:18 GMT+02:00 Bob Tausworthe t...@sentons.com:
 Hi, it checks the VID and PID

 int is_correctdev( libusb_device *dev )
 {
 struct libusb_device_descriptor desc;
 int r = libusb_get_device_descriptor( dev, desc );

 //printf(Checking VID=0x%04x, PID=0x%04x\n, desc.idVendor,
 desc.idProduct);
 if( desc.idVendor == VENDOR_ID 
   (desc.idProduct  == PRODUCT_ID)
   {
 //printf(device found: class=0x%x\n, desc.bDeviceClass);

 return 1;
 }
 return 0;
 }



 On Thu, Jul 31, 2014 at 3:42 AM, Matthias Bolte
 matthias.bo...@googlemail.com wrote:

 2014-07-29 23:28 GMT+02:00 Bob Tausworthe t...@sentons.com:
  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
  t...@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) ){

 How does the is_correctdev() function decide which device to pick?

 --
 Matthias Bolte
 http://photron.blogspot.com


 --
 Infragistics Professional
 Build stunning WinForms apps today!
 Reboot your WinForms applications with our WinForms controls.
 Build a bridge from your legacy apps to the future.

 http://pubads.g.doubleclick.net/gampad/clk?id=153845071iu=/4140/ostg.clktrk
 

Re: [Libusbx-devel] Getting unsupported API call for 'open' on Windows 8.1 libusb

2014-08-01 Thread Bob Tausworthe
Hi, it checks the VID and PID

int is_correctdev( libusb_device *dev )
{
struct libusb_device_descriptor desc;
int r = libusb_get_device_descriptor( dev, desc );

//printf(Checking VID=0x%04x, PID=0x%04x\n, desc.idVendor,
desc.idProduct);
if( desc.idVendor == VENDOR_ID 
  (desc.idProduct  == PRODUCT_ID)
  {
//printf(device found: class=0x%x\n, desc.bDeviceClass);

return 1;
}
return 0;
}



On Thu, Jul 31, 2014 at 3:42 AM, Matthias Bolte 
matthias.bo...@googlemail.com wrote:

 2014-07-29 23:28 GMT+02:00 Bob Tausworthe t...@sentons.com:
  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
  t...@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) ){

 How does the is_correctdev() function decide which device to pick?

 --
 Matthias Bolte
 http://photron.blogspot.com


 --
 Infragistics Professional
 Build stunning WinForms apps today!
 Reboot your WinForms applications with our WinForms controls.
 Build a bridge from your legacy apps to the future.

 http://pubads.g.doubleclick.net/gampad/clk?id=153845071iu=/4140/ostg.clktrk
 ___
 libusbx-devel mailing list
 libusbx-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/libusbx-devel

--
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


Re: [Libusbx-devel] Getting unsupported API call for 'open' on Windows 8.1 libusb

2014-07-31 Thread Matthias Bolte
2014-07-29 23:28 GMT+02:00 Bob Tausworthe t...@sentons.com:
 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
 t...@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) ){

How does the is_correctdev() function decide which device to pick?

-- 
Matthias Bolte
http://photron.blogspot.com

--
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071iu=/4140/ostg.clktrk
___
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel


[Libusbx-devel] Getting unsupported API call for 'open' on Windows 8.1 libusb

2014-07-29 Thread Bob Tausworthe
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
t...@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#', 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_2848PID_8003MI_00#619BCFBB80'