Time-out when reading from USB on Raspberry Pi
Posted: Sat Aug 26, 2017 9:53 am
Hello,
I am trying to read data from an ANT device using the python-ant project (currently maintained here).
When I first started on it over a year ago, I managed to get it working. But now I've come back to it and for some reason it has trouble working. It will occasionally work, but often it terminates with a timeout error.
It may have happened after I updated the software on the Pi.
The problem happens when I attempt to start up the device:
And I get this error:
I was able to narrow down the problem to the USB driver code.
The above code gives this error:
I'm running Raspbian 4.9.43-v7+ on a Pi 2 (Model B). Info on the USB device can be found here.
I am trying to read data from an ANT device using the python-ant project (currently maintained here).
When I first started on it over a year ago, I managed to get it working. But now I've come back to it and for some reason it has trouble working. It will occasionally work, but often it terminates with a timeout error.
It may have happened after I updated the software on the Pi.
The problem happens when I attempt to start up the device:
Code: Select all
from ant.core import driver
from ant.core.node import Node
antNode = Node(driver.USB2Driver())
antNode.start()
Code: Select all
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/ant-0.1.1-py3.5.egg/ant/core/node.py", line 209, in start
File "/usr/local/lib/python3.5/site-packages/ant-0.1.1-py3.5.egg/ant/core/node.py", line 199, in reset
File "/usr/local/lib/python3.5/site-packages/ant-0.1.1-py3.5.egg/ant/core/event.py", line 166, in waitForMessage
File "/usr/local/lib/python3.5/site-packages/ant-0.1.1-py3.5.egg/ant/core/event.py", line 114, in waitFor
ant.core.exceptions.MessageError: <class 'ant.core.message.StartupMessage'>: timeout
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/site-packages/ant-0.1.1-py3.5.egg/ant/core/node.py", line 214, in start
ant.core.exceptions.NodeError: <class 'ant.core.message.StartupMessage'>: timeout
I was able to narrow down the problem to the USB driver code.
Code: Select all
from ant.core import driver
device = driver.USB2Driver()
device.open()
device.read(1)
Code: Select all
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/site-packages/ant-0.1.1-py3.5.egg/ant/core/driver.py", line 79, in read
File "/usr/local/lib/python3.5/site-packages/ant-0.1.1-py3.5.egg/ant/core/driver.py", line 237, in _read
File "/usr/local/lib/python3.5/site-packages/pyusb-1.0.0-py3.5.egg/usb/core.py", line 402, in read
File "/usr/local/lib/python3.5/site-packages/pyusb-1.0.0-py3.5.egg/usb/core.py", line 988, in read
File "/usr/local/lib/python3.5/site-packages/pyusb-1.0.0-py3.5.egg/usb/backend/libusb1.py", line 833, in bulk_read
File "/usr/local/lib/python3.5/site-packages/pyusb-1.0.0-py3.5.egg/usb/backend/libusb1.py", line 936, in __read
File "/usr/local/lib/python3.5/site-packages/pyusb-1.0.0-py3.5.egg/usb/backend/libusb1.py", line 595, in _check
usb.core.USBError: [Errno 110] Operation timed out
I'm running Raspbian 4.9.43-v7+ on a Pi 2 (Model B). Info on the USB device can be found here.