Note: This is Python 2.7 and PyUSB 0.4.3
I am trying to send serial data from an Arduino Yun to a USB dongle plugged into the Yun's USB host port using a Python script. The data is just a sequence of characters (currently just one to simplify debugging). Here is the script, the data to be written is the character 'W':
import usb
busses = usb.busses()
for bus in busses:
devs = bus.devices
for dev in devs:
if dev.idVendor == 9304 and dev.idProduct == 1:
d = dev
conf = d.configurations[0]
intf = conf.interfaces[0][0]
endpoints = []
for endpoint in intf.endpoints:
endpoints.append(endpoint)
endpoint = endpoints[0]
handle = d.open()
handle.interruptWrite(0, 'W')
This is the error:
Traceback (most recent call last):
File "ser_test.py", line 21, in <module>
handle.interruptWrite(0, 'W')
usb.USBError: error submitting URB: No such file or directory
I have tried 0-1000 for the first argument with no luck. What is the proper way to write this to send a 'W' character from the host to the dongle? I've read in other posts that PyUSB is only a set of wrappers for usblib, but haven't been able to find an answer in the usblib documentation.
Here is the output of lsusb (dongle is 2458:0001):
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 058f:6254 Alcor Micro Corp. USB Hub
Bus 001 Device 003: ID 2458:0001
Bus 001 Device 004: ID 058f:6366 Alcor Micro Corp. Multi Flash Reader
Thanks.