From: Xiaofan C. <xia...@gm...> - 2017-03-07 13:08:22
|
On Tue, Mar 7, 2017 at 5:33 AM, Greg Horler <dr....@gm...> wrote: > I have had partial success in interfacing an 8-bit microcontroller with a PC > running windows 10,Python and PyUsb. > > I am a firmware specialist, i.e. not particularly proficient in Python, I am > new to PyUSB. > > The problem is that my python program fails periodically with the following > error… >... > usb.core.USBError: [Errno None] b'libusb0-dll:err [_usb_reap_async] reaping > request failed, win error: The I/O operation has been aborted because of > either a thread exit or an application request.\r\n\n' > > print ("ep.bEndpointAddress = %s" %out_ep_address) > #print(out_ep_address) > > while True: > > dev.write(0x01, [0x81, 0x08, 0x08,0x03,0x04,0x05,0x06,0x07]) > time.sleep(0.1) # Sample (0.1)s == 1ms > test = dev.read(0x81, 8) > print (test) Did you write the FW by yourself? Since this is an HID device, are you using the libusb-win32 filter driver? pyusb/libusb may not be the best thing to use for USB HID device. Ref: https://github.com/libusb/libusb/wiki/FAQ#does-libusb-support-usb-hid-devices If you need cross platform HID access, then you may need to look at HIDAPI and its python binding. http://www.signal11.us/oss/hidapi/ https://pypi.python.org/pypi/hidapi If you only use Python and only care about Windows, you may want to give pywinusb a try. https://pypi.python.org/pypi/pywinusb/ -- Xiaofan |