mcclown / pyseneye

A module for interacting with Seneye range of aquarium and pond sensors
Apache License 2.0
8 stars 4 forks source link

Timeout on Sensor Reading #5

Closed iamthecage closed 5 years ago

iamthecage commented 5 years ago

Everything starts out fine. USB shows as Bus 002 Device 008: ID 24f7:2204 `>>> from pyseneye.sud import SUDevice, Action

d = SUDevice() d.action(Action.ENTER_INTERACTIVE_MODE) <pyseneye.sud.EnterInteractiveResponse object at 0x7f8ac53d9dd8>`

At this point, the light on the Seneye comes on and stays solid red When trying to get the sensor reading, the following happens

>>> s = d.action(Action.SENSOR_READING) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.6/dist-packages/pyseneye/sud.py", line 608, in action raise TimeoutError("Operation timed out reading response.") TimeoutError: Operation timed out reading response.

Trying to run a sensor reading again results in the following

>>> s = d.action(Action.SENSOR_READING) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.6/dist-packages/pyseneye/sud.py", line 584, in action self._write(cdef.cmd_str) File "/usr/local/lib/python3.6/dist-packages/pyseneye/sud.py", line 557, in _write return self._instance.write(self._ep_out, msg) File "/usr/local/lib/python3.6/dist-packages/usb/core.py", line 948, in write self.__get_timeout(timeout) File "/usr/local/lib/python3.6/dist-packages/usb/backend/libusb1.py", line 842, in intr_write timeout) File "/usr/local/lib/python3.6/dist-packages/usb/backend/libusb1.py", line 920, in __write _check(retval) File "/usr/local/lib/python3.6/dist-packages/usb/backend/libusb1.py", line 595, in _check raise USBError(_strerror(ret), ret, _libusb_errno[ret]) usb.core.USBError: [Errno 19] No such device (it may have been disconnected)

Running Ubuntu 18.04.1 LTS in a VM, USB is passthrough from Windows 10 host.

mcclown commented 5 years ago

Thanks for opening the ticket.

Can you get a USB capture of this happening, on the Ubuntu VM? It may also be useful to capture it from the Windows side as well?

I've seen the second error before but only in a very different scenario. It's probably just a result of the first error but can you grab the dmesg output from you Ubuntu VM, so I can see if there's anything there?

mcclown commented 5 years ago

Sorry, I meant to say. To get the USB capture you can use Wireshark

iamthecage commented 5 years ago

I've got it resolved. Something from the Windows host USB driver is not compatible with being passed through to Linux. I created a device driver with libusb-win32 and was able to get the script running in the Ubuntu VM and just natively running on Windows 10 as well.

https://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.6.0/