1

I have written a small python script to read data from a digital thermometer, and everything works just fine in my computer. however, i need to run this same script in other systems, but i keep getting a "[Errno 10060] Operation timed out" error.

in the second computer i can see the device, it's endpoints and everything, but it's when i try to read from it that i'm getting the error.

this is the code (i intentionally did not set the configuration for the device, as i'm trying to speed up the reading, and in my system it proved not to be necessary):

import usb.core

def get_temp(T):

    # find our device
    dev = usb.core.find(idVendor=0x04d9, idProduct=0xe000)
    # was it found?
    if dev is None:
        raise ValueError('Device not found')

    # poll the thermometer for current temperature
    t = dev.read(0x83, 32) # gets 32 bytes from ENDPOINT address 0x83

so, in the computer where i wrote this, it works as expected, and it returns a nice 32-byte array. but in other systems, i got the error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\usb\core.py", line 402, in read
    return self.device.read(self, size_or_buffer, timeout)
  File "C:\Python27\lib\site-packages\usb\core.py", line 988, in read
    self.__get_timeout(timeout))
  File "C:\Python27\lib\site-packages\usb\backend\libusb1.py", line 851, in 
intr_read
    timeout)
  File "C:\Python27\lib\site-packages\usb\backend\libusb1.py", line 936, in 
__read
    _check(retval)
  File "C:\Python27\lib\site-packages\usb\backend\libusb1.py", line 595, in 
_check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 10060] Operation timed out

i tried also setting device configuration this time, but still same error.

any ideas on what i might be missing?

edit: this is my output log with PYUSB_DEBUG environment variable set to debug:

>>> dev.read(0x83,32)
2019-01-11 10:35:06,951 DEBUG:usb.backend.libusb1:_LibUSB.get_configuration(<usb.backend.libusb1._DeviceHandle object at 0x02A2A610>)
2019-01-11 10:35:06,953 DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device object at 0x02A2A650>, 0)
2019-01-11 10:35:06,954 DEBUG:usb.backend.libusb1:_LibUSB.get_interface_descriptor(<usb.backend.libusb1._Device object at 0x02A2A650>, 0, 0, 0)
2019-01-11 10:35:06,956 DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device object at 0x02A2A650>, 0)
2019-01-11 10:35:06,957 DEBUG:usb.backend.libusb1:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb1._Device object at 0x02A2A650>, 0, 0, 0, 0)
2019-01-11 10:35:06,957 DEBUG:usb.backend.libusb1:_LibUSB.get_interface_descriptor(<usb.backend.libusb1._Device object at 0x02A2A650>, 0, 0, 0)
2019-01-11 10:35:06,957 DEBUG:usb.backend.libusb1:_LibUSB.get_configuration_descriptor(<usb.backend.libusb1._Device object at 0x02A2A650>, 0)
2019-01-11 10:35:06,957 DEBUG:usb.backend.libusb1:_LibUSB.claim_interface(<usb.backend.libusb1._DeviceHandle object at 0x02A2A610>, 0)
2019-01-11 10:35:06,957 DEBUG:usb.backend.libusb1:_LibUSB.intr_read(<usb.backend.libusb1._DeviceHandle object at 0x02A2A610>, 131, 0, array('B', [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 1000)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\usb\core.py", line 988, in read
    self.__get_timeout(timeout))
  File "C:\Python27\lib\site-packages\usb\_debug.py", line 60, in do_trace
    return f(*args, **named_args)
  File "C:\Python27\lib\site-packages\usb\backend\libusb1.py", line 851, in intr_read
    timeout)
  File "C:\Python27\lib\site-packages\usb\backend\libusb1.py", line 936, in __read
    _check(retval)
  File "C:\Python27\lib\site-packages\usb\backend\libusb1.py", line 595, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 10060] Operation timed out
>>>

0 Answers0