Temper-poll timeouts then stops getting data
Closed this issue · 4 comments
Hi,
Thanks for this software :-)
I'm trying to make it work, but I keep getting this output after running the command for some time, once every 30 second. After an hour or so it starts crashing with this message:
ERROR:temperusb.temper:[Errno 110] Operation timed out
Traceback (most recent call last):
File "/usr/bin/temper-poll", line 9, in <module>
load_entry_point('temperusb==1.5.2', 'console_scripts', 'temper-poll')()
File "/usr/lib/python2.6/site-packages/temperusb-1.5.2-py2.6.egg/temperusb/cli.py", line 53, in main
readings.append(dev.get_temperatures(sensors=sensors))
File "/usr/lib/python2.6/site-packages/temperusb-1.5.2-py2.6.egg/temperusb/temper.py", line 300, in get_temperatures
data = self.get_data()
File "/usr/lib/python2.6/site-packages/temperusb-1.5.2-py2.6.egg/temperusb/temper.py", line 250, in get_data
return self.get_data(True)
File "/usr/lib/python2.6/site-packages/temperusb-1.5.2-py2.6.egg/temperusb/temper.py", line 230, in get_data
self._interrupt_read()
File "/usr/lib/python2.6/site-packages/temperusb-1.5.2-py2.6.egg/temperusb/temper.py", line 334, in _interrupt_read
data = self._device.read(ENDPOINT, REQ_INT_LEN, timeout=TIMEOUT)
File "/usr/lib/python2.6/site-packages/pyusb-1.0.0-py2.6.egg/usb/core.py", line 988, in read
self.__get_timeout(timeout))
File "/usr/lib/python2.6/site-packages/pyusb-1.0.0-py2.6.egg/usb/backend/libusb1.py", line 851, in intr_read
timeout)
File "/usr/lib/python2.6/site-packages/pyusb-1.0.0-py2.6.egg/usb/backend/libusb1.py", line 936, in __read
_check(retval)
File "/usr/lib/python2.6/site-packages/pyusb-1.0.0-py2.6.egg/usb/backend/libusb1.py", line 595, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 110] Operation timed out
Once this happens, it happens all the time.
I get this on /var/log/messages (or dmesg):
Mar 13 14:19:16 master kernel: usb 4-2: reset low speed USB device number 66 using ohci_hcd
Mar 13 14:19:16 master kernel: usb 4-2: usbfs: process 61958 (temper-poll) did not claim interface 1 before use
Mar 13 14:19:16 master kernel: usb 4-2: reset low speed USB device number 66 using ohci_hcd
The last line repeats itself after each execution of the command.
This is the device information (lsusb -v)
Bus 004 Device 066: ID 0c45:7401 Microdia
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x0c45 Microdia
idProduct 0x7401
bcdDevice 0.01
iManufacturer 1 RDing
iProduct 2 TEMPerV1.4
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 59
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 1 Keyboard
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 65
Report Descriptor: (length is 65)
Item(Global): Usage Page, data= [ 0x01 ] 1
Generic Desktop Controls
Item(Local ): Usage, data= [ 0x06 ] 6
Keyboard
Item(Main ): Collection, data= [ 0x01 ] 1
Application
Item(Global): Report ID, data= [ 0x01 ] 1
Item(Global): Usage Page, data= [ 0x07 ] 7
Keyboard
Item(Local ): Usage Minimum, data= [ 0xe0 ] 224
Control Left
Item(Local ): Usage Maximum, data= [ 0xe7 ] 231
GUI Right
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0x01 ] 1
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x08 ] 8
Item(Main ): Input, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Report Count, data= [ 0x01 ] 1
Item(Global): Report Size, data= [ 0x08 ] 8
Item(Main ): Input, data= [ 0x01 ] 1
Constant Array Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Report Count, data= [ 0x03 ] 3
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Usage Page, data= [ 0x08 ] 8
LEDs
Item(Local ): Usage Minimum, data= [ 0x01 ] 1
NumLock
Item(Local ): Usage Maximum, data= [ 0x03 ] 3
Scroll Lock
Item(Main ): Output, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Report Count, data= [ 0x05 ] 5
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Main ): Output, data= [ 0x01 ] 1
Constant Array Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Report Count, data= [ 0x05 ] 5
Item(Global): Report Size, data= [ 0x08 ] 8
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0xff ] 255
Item(Global): Usage Page, data= [ 0x07 ] 7
Keyboard
Item(Local ): Usage Minimum, data= [ 0x00 ] 0
No Event
Item(Local ): Usage Maximum, data= [ 0xff ] 255
(null)
Item(Main ): Input, data= [ 0x00 ] 0
Data Array Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Main ): End Collection, data=none
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 10
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 2 Mouse
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 41
Report Descriptor: (length is 41)
Item(Global): Usage Page, data= [ 0x00 0xff ] 65280
(null)
Item(Local ): Usage, data= [ 0x01 ] 1
(null)
Item(Main ): Collection, data= [ 0x01 ] 1
Application
Item(Local ): Usage, data= [ 0x01 ] 1
(null)
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
Item(Global): Report Size, data= [ 0x08 ] 8
Item(Global): Report Count, data= [ 0x08 ] 8
Item(Main ): Input, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Local ): Usage, data= [ 0x01 ] 1
(null)
Item(Global): Report Count, data= [ 0x08 ] 8
Item(Main ): Output, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Usage Page, data= [ 0x0c ] 12
Consumer
Item(Local ): Usage, data= [ 0x00 ] 0
Unassigned
Item(Global): Logical Minimum, data= [ 0x80 ] 128
Item(Global): Logical Maximum, data= [ 0x7f ] 127
Item(Global): Report Size, data= [ 0x08 ] 8
Item(Global): Report Count, data= [ 0x08 ] 8
Item(Main ): Feature, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Main ): End Collection, data=none
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 10
Device Status: 0x0000
(Bus Powered)
I'm using RHEL6.
I've read some similar issues, but I think they were marked as solved after changing the code. My temper-poll version is the last one, I just reinstalled it to be sure in included the last updates.
Cheers
Hi,
I have been using a C program based on this one, modified to be able to use it with up to 4 devices, since it was made for one.
When I use this program, instead of crashing every-time after it times-out for the first time, it works when being run again. Here is the gist of my version, in case you can get any clue of what's going on with temper-python. When using this program, lsusb shows that the device number is increased by one after each crash ¿?
Cheers
Hi @Pizzicato , thanks for the info! I think you are seeing a problem similar to what I described here:
#61 (comment)
There most likely is something in the USB interaction with your device that makes it choke and reset. That would explain the increasing device number.
Problem is: I have neither the device nor the time to look at this.
What you could do is trying to carefully inspect what the C version does (or doesn't) and compare it to the code around here:
https://github.com/padelt/temper-python/blob/master/temperusb/temper.py#L239
Then try to mimick what the C version does in temper.py
.
Maybe you can find a combination that works for you! If you do, please report it so we can add it to the codebase.
Until then, I'll close this issue.
Hi!
I'm quite busy right now too, but I'll try to do it and fix it.
Cheers
Hi,
I have found out a couple of things that might be useful: temper-poll device resetting doesn't actually resets my USB devices. Using this C program, which is a little modification of the one I posted before (adds a call to usb_reset
when reading fails) changes the failing device ID, which can be seen using lsusb, while temper-poll doesn't.
So when the USB device fails, if reset is done properly, subsequent reads should work. I don't have time to make the changes in the temper-poll script, but this may point someone out in the right direction to fix this issue.
Cheers