PyUSB provides USB access on the Python language.
Please go to github page for more details. Discussion here will be ignored by the admins. https://github.com/pyusb/pyusb
Dear Wanders,
I need your help for pyusb use.
I use ,for my python program, libusb library on a windows pc.
I have two identical spectrometers with idVendor = 0x2457, idProduct =0x1022. I am using bus and address, but I do not know how to write the code to differentiate them. eg dev = usb.core.find (idVendor = 0x2457, idProduct =0x1022)
dev = usb.core.find (= \. \ libusb0-0001--0x2457-0x1022)
thanking you in advance.
laurent
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Dear Wanders,
I need your help for pyusb use.
I use ,for my python program, libusb library on a windows pc.
I have two identical spectrometers with idVendor = 0x2457, idProduct
=0x1022. I am using bus and address, but I do not know how to write the code
to differentiate them. eg dev = usb.core.find (idVendor = 0x2457, idProduct
=0x1022)
dev = usb.core.find (= . \ libusb0-0001--0x2457-0x1022)
thanking you in advance.
laurent
Hi,
There were a recent discussion in PyUSB mailing list on this topic [1].
I need your help for pyusb. I want to be able to send
control transfers to usb devices, but this fails for
devices that aren't HID devices, such as a hub or camera.
I want to describe the problem with the following example:
The print function for the hub info fails in getting the strings for
iManufacturer and iProduct, while the print function for the keyboard
succeeds. The try-except block in _try_get_string in core.py fails
when it calls util.get_string, which in turn fails in the try-except
block in langids when it calls util.get_langids, which in turn fails
when it calls ctrl_transfer in get_descriptor in control.py which
then fails in managed_open, which then fails in open_device in
libusb1.py when it calls init for _DeviceHandle which fails in
_check(_lib.libusb_open(self.devid, byref(self.handle))), which
returns -12 (the value for LIBUSB_ERROR_NOT_SUPPORTED). Since
ctrl_transfer fails in get_descriptor, it also fails when I try to
use ctrl_transfer for anything else.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the link. I found in: https://github.com/pyusb/pyusb/discussions/419 a response from jonasmalacofilho that provides the link: https://github.com/libusb/libusb/wiki/Windows#How_to_use_libusb_on_Windows that states: "If your target device is not HID, and your device is not using WinUSB driver, you must install a driver before you can communicate with it using libusb. Currently, this means installing one of Microsoft's WinUSB, libusb-win32 or libusbK drivers." This does appear to describe the behavior I see. Since I see that you have edited this page, you may already be aware of this. While Zadig appears to work by installing the WinUSB driver, it's not clear what other side effects may happen.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the module libusb1.py the call to _lib.libusb_open passes
two 64 bit ints, the first is a device ID (devid) and the
second is the address of a pointer which the open call should
return the address of a device handle object (_DeviceHandle).
The name of the dll called is 'C:\WINDOWS\system32\libusb-1.0.dll'
found in _lib._name and it is this call that fails if the
device ID is for a non HID device.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Dear Wanders,
I need your help for pyusb use.
I use ,for my python program, libusb library on a windows pc.
I have two identical spectrometers with idVendor = 0x2457, idProduct =0x1022. I am using bus and address, but I do not know how to write the code to differentiate them. eg dev = usb.core.find (idVendor = 0x2457, idProduct =0x1022)
dev = usb.core.find (= \. \ libusb0-0001--0x2457-0x1022)
thanking you in advance.
laurent
2014-09-15 7:19 GMT-03:00 laurent lorenz7791@users.sf.net:
Hi,
There were a recent discussion in PyUSB mailing list on this topic [1].
[1] http://comments.gmane.org/gmane.comp.python.pyusb.user/1730
--
Best Regards,
Wander Lairson Costa
Dear Wander and team,
I need your help for pyusb. I want to be able to send
control transfers to usb devices, but this fails for
devices that aren't HID devices, such as a hub or camera.
I want to describe the problem with the following example:
output:
The print function for the hub info fails in getting the strings for
iManufacturer and iProduct, while the print function for the keyboard
succeeds. The try-except block in _try_get_string in core.py fails
when it calls util.get_string, which in turn fails in the try-except
block in langids when it calls util.get_langids, which in turn fails
when it calls ctrl_transfer in get_descriptor in control.py which
then fails in managed_open, which then fails in open_device in
libusb1.py when it calls init for _DeviceHandle which fails in
_check(_lib.libusb_open(self.devid, byref(self.handle))), which
returns -12 (the value for LIBUSB_ERROR_NOT_SUPPORTED). Since
ctrl_transfer fails in get_descriptor, it also fails when I try to
use ctrl_transfer for anything else.
You may also try here : https://github.com/pyusb/pyusb/discussions
In any case, you will have to provide more context and info on versions, OS, drivers etc.
Thanks for the link. I found in: https://github.com/pyusb/pyusb/discussions/419 a response from jonasmalacofilho that provides the link: https://github.com/libusb/libusb/wiki/Windows#How_to_use_libusb_on_Windows that states: "If your target device is not HID, and your device is not using WinUSB driver, you must install a driver before you can communicate with it using libusb. Currently, this means installing one of Microsoft's WinUSB, libusb-win32 or libusbK drivers." This does appear to describe the behavior I see. Since I see that you have edited this page, you may already be aware of this. While Zadig appears to work by installing the WinUSB driver, it's not clear what other side effects may happen.
In the module libusb1.py the call to _lib.libusb_open passes
two 64 bit ints, the first is a device ID (devid) and the
second is the address of a pointer which the open call should
return the address of a device handle object (_DeviceHandle).
The name of the dll called is 'C:\WINDOWS\system32\libusb-1.0.dll'
found in _lib._name and it is this call that fails if the
device ID is for a non HID device.
Please go to pyusb discussion and not to discuss issues here. Thanks.
https://github.com/pyusb/pyusb/discussions