2

I'm trying to communicate with a USB device with python. I am running Windows 10 and that I use Python 3.7.2 32bit. I installed PyUSB with pip

pip install pyusb

Here is my test code

import usb.core

dev = usb.core.find(idVendor=0x1664, idProduct=0x0001)
if dev is None:
    raise ValueError('Device not found')
dev.set_configuration()
print("Read: ", dev.read(0x81, 7))
print("Write: ", dev.write(1, '0xB1')) 

On my reading function or my writing function I have an error:

usb.core.USBError: [Errno 5] Input/Output Error

Do you have any idea what's wrong?

Thank you in advance for your help.

Mick
  • 53
  • 1
  • 1
  • 8
  • Are you running the code with admin priviledges ? Most of the times this error happens because your code has no elevated priviledges. – shuberman Sep 27 '19 at 08:59
  • I just did the administrator test, it doesn't work I get the same error message. – Mick Sep 27 '19 at 09:17
  • What's the full traceback? Just showing the error doesn't tell us what part of the code is triggering it. – martineau Sep 27 '19 at 09:56

1 Answers1

3

I found a solution. I used this software zadig to change the usb driver of my device from WinUSB to libusb-win32.

Now read write work perfectly.

Mick
  • 53
  • 1
  • 1
  • 8
  • what else did you do? I don't get it to run. see https://stackoverflow.com/q/59105167/7295599 – theozh Jan 30 '20 at 09:00