|
From: Daniel K. <ma...@we...> - 2016-09-16 13:41:27
|
When I use libusb (via pyusb) I cannot read the complete usb-description of
an attached device.
Several values show "Error accessing string"
So far I did not succeed to get values for:
- Manufacturer
- Product
- SerialNumber
- Interfaces
I am working on Windows 8 (64bit) with a libusb_1.0.20-dll (64bit) and
python 3.5.
The 64bit-dll seems to be correct: If I replace it with the 32bit version I
get an error message...
My code:
import os
os.environ['PYUSB_DEBUG'] = 'debug'import usb.core
if __name__ == '__main__':
dev = usb.core.find(idVendor=0x0403, idProduct=0x864A)
print(dev)
# was it found?
if dev is None:
raise ValueError('Device not found')
Output:
2016-09-14 14:57:57,475
DEBUG:usb.backend.libusb1:_LibUSB.__init__(<WinDLL 'libusb-1.0.dll',
handle 7ffeb63d0000 at 0xb27492dc88>)
2016-09-14 14:57:57,478 INFO:usb.core:find(): using backend
"usb.backend.libusb1"
2016-09-14 14:57:57,478 DEBUG:usb.backend.libusb1:_LibUSB.enumerate_devices()
2016-09-14 14:57:57,497
DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2749210B8>)
2016-09-14 14:57:57,497
DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2765512B0>)
2016-09-14 14:57:57,497
DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>)
2016-09-14 14:57:57,497
DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2765512E8>)
2016-09-14 14:57:57,497
DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2749210B8>)
2016-09-14 14:57:57,498
DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
object at 0x000000B276551358>)
2016-09-14 14:57:57,498
DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>)
2016-09-14 14:57:57,498
DEBUG:usb.backend.libusb1:_LibUSB.open_device(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>)
2016-09-14 14:57:57,498
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>, 0)
2016-09-14 14:57:57,498
DEBUG:usb.backend.libusb1:_LibUSB.get_interface_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>, 0, 0, 0)
2016-09-14 14:57:57,498
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>, 0)
2016-09-14 14:57:57,499
DEBUG:usb.backend.libusb1:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>, 0, 0, 0, 0)
2016-09-14 14:57:57,499
DEBUG:usb.backend.libusb1:_LibUSB.get_interface_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>, 0, 0, 0)
2016-09-14 14:57:57,499
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>, 0)
2016-09-14 14:57:57,499
DEBUG:usb.backend.libusb1:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>, 1, 0, 0, 0)
2016-09-14 14:57:57,499
DEBUG:usb.backend.libusb1:_LibUSB.get_interface_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>, 0, 0, 0)
2016-09-14 14:57:57,499
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>, 0)
2016-09-14 14:57:57,499
DEBUG:usb.backend.libusb1:_LibUSB.get_interface_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>, 0, 1, 0)
2016-09-14 14:57:57,499
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>, 0)
2016-09-14 14:57:57,500
DEBUG:usb.backend.libusb1:_LibUSB.get_interface_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>, 1, 0, 0)
2016-09-14 14:57:57,500
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>, 0)
2016-09-14 14:57:57,500
DEBUG:usb.backend.libusb1:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>, 0, 1, 0, 0)
2016-09-14 14:57:57,500
DEBUG:usb.backend.libusb1:_LibUSB.get_interface_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>, 1, 0, 0)
2016-09-14 14:57:57,500
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>, 0)
2016-09-14 14:57:57,500
DEBUG:usb.backend.libusb1:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>, 1, 1, 0, 0)
2016-09-14 14:57:57,500
DEBUG:usb.backend.libusb1:_LibUSB.get_interface_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>, 1, 0, 0)
2016-09-14 14:57:57,500
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>, 0)
2016-09-14 14:57:57,500
DEBUG:usb.backend.libusb1:_LibUSB.get_interface_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>, 1, 1, 0)
2016-09-14 14:57:57,501
DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device
object at 0x000000B2748F0AC8>, 0)
DEVICE ID 0403:864a on Bus 005 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 : 0x0403
idProduct : 0x864a
bcdDevice : 0x700 Device 7.0
iManufacturer : 0x1 Error Accessing String
iProduct : 0x2 Error Accessing String
iSerialNumber : 0x3 Error Accessing String
bNumConfigurations : 0x1
CONFIGURATION 1: 100 mA ==================================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x2 Configuration
wTotalLength : 0x37 (55 bytes)
bNumInterfaces : 0x2
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 : 0x2
bInterfaceClass : 0xff Vendor Specific
bInterfaceSubClass : 0xff
bInterfaceProtocol : 0xff
iInterface : 0x2 Error Accessing String
ENDPOINT 0x81: Bulk IN ===============================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x81 IN
bmAttributes : 0x2 Bulk
wMaxPacketSize : 0x200 (512 bytes)
bInterval : 0x0
ENDPOINT 0x2: Bulk OUT ===============================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x2 OUT
bmAttributes : 0x2 Bulk
wMaxPacketSize : 0x200 (512 bytes)
bInterval : 0x0
INTERFACE 1: Vendor Specific ===========================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x4 Interface
bInterfaceNumber : 0x1
bAlternateSetting : 0x0
bNumEndpoints : 0x2
bInterfaceClass : 0xff Vendor Specific
bInterfaceSubClass : 0xff
bInterfaceProtocol : 0xff
iInterface : 0x2 Error Accessing String
ENDPOINT 0x83: Bulk IN ===============================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x83 IN
bmAttributes : 0x2 Bulk
wMaxPacketSize : 0x200 (512 bytes)
bInterval : 0x0
ENDPOINT 0x4: Bulk OUT ===============================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x4 OUT
bmAttributes : 0x2 Bulk
wMaxPacketSize : 0x200 (512 bytes)
bInterval : 0x0
2016-09-14 14:57:57,501 DEBUG:usb.backend.libusb1:_LibUSB._finalize_object()
This output does not change when I reread the device info, and also not
when I unplug / plug the device and reread.
But: When I use a program like "FT Prog", I can read the device info.
[image: Inline-Bild 1]
Any help is very much appreciated.
Thanks
Daniel
|