Hello, I'm kinda stuck. If I use libusb0 back-end first device works just
fine but second one uses isochronous transfer which is not implemented in
libusb0 back-end.
If I switch to libusb1 back-end I'm getting strange errors even with first
device:

2014-07-13 12:23:38,073 DEBUG:usb.backend.libusb1:_LibUSB.__init__(<WinDLL
'C:\Windows\system32\libusb-1.0.dll', handle 721f0000 at 2a09390>)
2014-07-13 12:23:38,076
DEBUG:usb.backend.libusb1:_LibUSB.enumerate_devices()
2014-07-13 12:23:38,329
DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
object at 0x02A1EFD0>)
2014-07-13 12:23:38,331
DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
object at 0x02A55070>)
2014-07-13 12:23:38,331
DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
object at 0x02A1EFD0>)
2014-07-13 12:23:38,332
DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
object at 0x02A55090>)
2014-07-13 12:23:38,332
DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
object at 0x02A1EFD0>)
2014-07-13 12:23:38,334
DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
object at 0x02A55070>)
2014-07-13 12:23:38,334
DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
object at 0x02A1EFD0>)
2014-07-13 12:23:38,335
DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
object at 0x02A55090>)
2014-07-13 12:23:38,335
DEBUG:usb.backend.libusb1:_LibUSB.open_device(<usb.backend.libusb1._Device
object at 0x02A55090>)
2014-07-13 12:23:38,336
DEBUG:usb.backend.libusb1:_LibUSB.ctrl_transfer(<usb.backend.libusb1._DeviceHandle
object at 0x02A1EEF0>, 128, 6, 768, 0, array('B', [0, 0, 0, 0, 0, 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
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 1000)
2014-07-13 12:23:38,339
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x02A55090>, 0)
2014-07-13 12:23:38,341
DEBUG:usb.backend.libusb1:_LibUSB.get_interface_descriptor(<usb.backend.libusb1._Device
object at 0x02A55090>, 0, 0, 0)
2014-07-13 12:23:38,342
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x02A55090>, 0)
2014-07-13 12:23:38,342
DEBUG:usb.backend.libusb1:_LibUSB.get_interface_descriptor(<usb.backend.libusb1._Device
object at 0x02A55090>, 0, 1, 0)
2014-07-13 12:23:38,342
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x02A55090>, 0)
2014-07-13 12:23:38,344
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x02A55090>, 0)
2014-07-13 12:23:38,344
DEBUG:usb.backend.libusb1:_LibUSB.set_configuration(<usb.backend.libusb1._DeviceHandle
object at 0x02A1EEF0>, 1)
Traceback (most recent call last):
  ...
  File "C:\Python27\lib\site-packages\usb\core.py", line 799, in
set_configuration
    self._ctx.managed_set_configuration(self, configuration)
  File "C:\Python27\lib\site-packages\usb\core.py", line 128, in
managed_set_configuration
    self.backend.set_configuration(self.handle, cfg.bConfigurationValue)
  File "C:\Python27\lib\site-packages\usb\_debug.py", line 60, in do_trace
    return f(*args, **named_args)
  File "C:\Python27\lib\site-packages\usb\backend\libusb1.py", line 730, in
set_configuration
    _check(self.lib.libusb_set_configuration(dev_handle.handle,
config_value))
  File "C:\Python27\lib\site-packages\usb\backend\libusb1.py", line 552, in
_check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 2] Entity not found
2014-07-13 12:23:38,371
DEBUG:usb.backend.libusb1:_LibUSB.close_device(<usb.backend.libusb1._DeviceHandle
object at 0x02A1EEF0>)
2014-07-13 12:23:38,371 DEBUG:usb.backend.libusb1:_LibUSB.__del__()

I even tried to implement missing iso_read method for libusb0 because
apparently windows version does support it.
Unfortunately I had no luck usb_submit_async returns -22 and I have no idea
why.

@methodtrace(_logger)
def iso_read(self, dev_handle, ep, intf, buff, timeout):
  ctx = c_void_p(0)
    _lib.usb_isochronous_setup_async(dev_handle, byref(ctx), ep, 1024)
    address, length = buff.buffer_info()
    length *= buff.itemsize
    _lib.usb_submit_async(byref(ctx), cast(address, c_char_p), length)
    _lib.usb_reap_async(ctx, timeout)
...

device descs :

DEVICE ID 045e:02b0 on Bus 000 Address 001 =================
 bLength                :   0x12 (18 bytes)
 bDescriptorType        :    0x1 Device
 bcdUSB                 :  0x200 USB 2.0
 bDeviceClass           :    0x0 Specified at interface
 bDeviceSubClass        :    0x0
 bDeviceProtocol        :    0x0
 bMaxPacketSize0        :   0x40 (64 bytes)
 idVendor               : 0x045e
 idProduct              : 0x02b0
 bcdDevice              :  0x105 Device 1.05
 iManufacturer          :    0x1 Microsoft
 iProduct               :    0x2 Xbox NUI Motor
 iSerialNumber          :    0x0
 bNumConfigurations     :    0x1
  CONFIGURATION 1: 100 mA ==================================
   bLength              :    0x9 (9 bytes)
   bDescriptorType      :    0x2 Configuration
   wTotalLength         :   0x12 (18 bytes)
   bNumInterfaces       :    0x1
   bConfigurationValue  :    0x1
   iConfiguration       :    0x0
   bmAttributes         :   0xc0 Self Powered
   bMaxPower            :   0x32 (100 mA)
    INTERFACE 0: Vendor Specific ===========================
     bLength            :    0x9 (9 bytes)
     bDescriptorType    :    0x4 Interface
     bInterfaceNumber   :    0x0
     bAlternateSetting  :    0x0
     bNumEndpoints      :    0x0
     bInterfaceClass    :   0xff Vendor Specific
     bInterfaceSubClass :    0x0
     bInterfaceProtocol :    0x0
     iInterface         :    0x0

DEVICE ID 045e:02ae on Bus 000 Address 003 =================
 bLength                :   0x12 (18 bytes)
 bDescriptorType        :    0x1 Device
 bcdUSB                 :  0x200 USB 2.0
 bDeviceClass           :    0x0 Specified at interface
 bDeviceSubClass        :    0x0
 bDeviceProtocol        :    0x0
 bMaxPacketSize0        :   0x40 (64 bytes)
 idVendor               : 0x045e
 idProduct              : 0x02ae
 bcdDevice              :  0x10b Device 1.011
 iManufacturer          :    0x2 Microsoft
 iProduct               :    0x1 Xbox NUI Camera
 iSerialNumber          :    0x3 A00365A11965050A
 bNumConfigurations     :    0x1
  CONFIGURATION 1: 16 mA ===================================
   bLength              :    0x9 (9 bytes)
   bDescriptorType      :    0x2 Configuration
   wTotalLength         :   0x20 (32 bytes)
   bNumInterfaces       :    0x1
   bConfigurationValue  :    0x1
   iConfiguration       :    0x0
   bmAttributes         :   0xc0 Self Powered
   bMaxPower            :    0x8 (16 mA)
    INTERFACE 0: Vendor Specific ===========================
     bLength            :    0x9 (9 bytes)
     bDescriptorType    :    0x4 Interface
     bInterfaceNumber   :    0x0
     bAlternateSetting  :    0x0
     bNumEndpoints      :    0x2
     bInterfaceClass    :   0xff Vendor Specific
     bInterfaceSubClass :   0xff
     bInterfaceProtocol :   0xff
     iInterface         :    0x0
      ENDPOINT 0x81: Isochronous IN ========================
       bLength          :    0x7 (7 bytes)
       bDescriptorType  :    0x5 Endpoint
       bEndpointAddress :   0x81 IN
       bmAttributes     :    0x1 Isochronous
       wMaxPacketSize   :  0xbc0 (3008 bytes)
       bInterval        :    0x1
      ENDPOINT 0x82: Isochronous IN ========================
       bLength          :    0x7 (7 bytes)
       bDescriptorType  :    0x5 Endpoint
       bEndpointAddress :   0x82 IN
       bmAttributes     :    0x1 Isochronous
       wMaxPacketSize   :  0xbc0 (3008 bytes)
       bInterval        :    0x1

Any help would be appreciated.
Regards, PetrS.
------------------------------------------------------------------------------
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to