te923: usb error while reading: could not release intf 0: No such device

97 views
Skip to first unread message

cyrix2000

unread,
Jan 22, 2015, 8:47:42 PM1/22/15
to weewx...@googlegroups.com
Hi,

I have setup my TFA Nexus station  (TE923 driver) with weewx and for a few days everything was working perfectly. But today the wind speed and direction is just showing N/A and if I set debug = 1 the log is just showing this:


Jan 23 01:40:57 janschwarz weewx[2890]: message repeated 3 times: [ te923: usb error while reading: could not release intf 0: No such device]
Jan 23 01:40:57 janschwarz weewx[2890]: te923: Bad read (attempt 1 of 100): Not enough bytes: 0 < 34
Jan 23 01:40:57 janschwarz weewx[2890]: te923: usb error while reading: could not release intf 0: No such device
Jan 23 01:41:08 janschwarz weewx[2890]: message repeated 3 times: [ te923: usb error while reading: could not release intf 0: No such device]
Jan 23 01:41:08 janschwarz weewx[2890]: te923: Bad read (attempt 1 of 100): Not enough bytes: 0 < 34
Jan 23 01:41:08 janschwarz weewx[2890]: te923: usb error while reading: could not release intf 0: No such device
Jan 23 01:41:08 janschwarz weewx[2890]: te923: Bad read (attempt 2 of 100): Not enough bytes: 0 < 34
Jan 23 01:41:08 janschwarz weewx[2890]: te923: usb error while reading: could not release intf 0: No such device
Jan 23 01:41:19 janschwarz weewx[2890]: message repeated 3 times: [ te923: usb error while reading: could not release intf 0: No such device]
Jan 23 01:41:19 janschwarz weewx[2890]: te923: Bad read (attempt 1 of 100): Not enough bytes: 0 < 34
Jan 23 01:41:19 janschwarz weewx[2890]: te923: usb error while reading: could not release intf 0: No such device
Jan 23 01:41:30 janschwarz weewx[2890]: message repeated 3 times: [ te923: usb error while reading: could not release intf 0: No such device]
Jan 23 01:41:30 janschwarz weewx[2890]: te923: Bad read (attempt 1 of 100): Not enough bytes: 0 < 34
Jan 23 01:41:30 janschwarz weewx[2890]: te923: usb error while reading: could not release intf 0: No such device
Jan 23 01:41:30 janschwarz weewx[2890]: te923: Bad read (attempt 2 of 100): Not enough bytes: 0 < 34
Jan 23 01:41:30 janschwarz weewx[2890]: te923: usb error while reading: could not release intf 0: No such device
Jan 23 01:41:41 janschwarz weewx[2890]: message repeated 3 times: [ te923: usb error while reading: could not release intf 0: No such device]
Jan 23 01:41:41 janschwarz weewx[2890]: te923: Bad read (attempt 1 of 100): Not enough bytes: 0 < 34
Jan 23 01:41:41 janschwarz weewx[2890]: te923: usb error while reading: could not release intf 0: No such device
Jan 23 01:41:52 janschwarz weewx[2890]: message repeated 3 times: [ te923: usb error while reading: could not release intf 0: No such device]
Jan 23 01:41:52 janschwarz weewx[2890]: te923: Bad read (attempt 1 of 100): Not enough bytes: 0 < 34
Jan 23 01:41:52 janschwarz weewx[2890]: te923: usb error while reading: could not release intf 0: No such device
Jan 23 01:41:52 janschwarz weewx[2890]: te923: Bad read (attempt 2 of 100): Not enough bytes: 0 < 34
Jan 23 01:41:52 janschwarz weewx[2890]: te923: usb error while reading: could not release intf 0: No such device
Jan 23 01:42:03 janschwarz weewx[2890]: message repeated 3 times: [ te923: usb error while reading: could not release intf 0: No such device]
Jan 23 01:42:03 janschwarz weewx[2890]: te923: Bad read (attempt 1 of 100): Not enough bytes: 0 < 34
Jan 23 01:42:03 janschwarz weewx[2890]: te923: usb error while reading: could not release intf 0: No such device
Jan 23 01:42:14 janschwarz weewx[2890]: message repeated 3 times: [ te923: usb error while reading: could not release intf 0: No such device]
Jan 23 01:42:14 janschwarz weewx[2890]: te923: Bad read (attempt 1 of 100): Not enough bytes: 0 < 34
Jan 23 01:42:14 janschwarz weewx[2890]: te923: usb error while reading: could not release intf 0: No such device
Jan 23 01:42:14 janschwarz weewx[2890]: te923: Bad read (attempt 2 of 100): Not enough bytes: 0 < 34
Jan 23 01:42:14 janschwarz weewx[2890]: te923: usb error while reading: could not release intf 0: No such device
Jan 23 01:42:25 janschwarz weewx[2890]: message repeated 3 times: [ te923: usb error while reading: could not release intf 0: No such device]
Jan 23 01:42:25 janschwarz weewx[2890]: te923: Bad read (attempt 1 of 100): Not enough bytes: 0 < 34
Jan 23 01:42:25 janschwarz weewx[2890]: te923: usb error while reading: could not release intf 0: No such device
Jan 23 01:42:36 janschwarz weewx[2890]: message repeated 3 times: [ te923: usb error while reading: could not release intf 0: No such device]
Jan 23 01:42:36 janschwarz weewx[2890]: te923: Bad read (attempt 1 of 100): Not enough bytes: 0 < 34
Jan 23 01:42:36 janschwarz weewx[2890]: te923: usb error while reading: could not release intf 0: No such device
Jan 23 01:42:36 janschwarz weewx[2890]: te923: Bad read (attempt 2 of 100): Not enough bytes: 0 < 34
Jan 23 01:42:36 janschwarz weewx[2890]: te923: usb error while reading: could not release intf 0: No such device
Jan 23 01:42:47 janschwarz weewx[2890]: message repeated 3 times: [ te923: usb error while reading: could not release intf 0: No such device]
Jan 23 01:42:47 janschwarz weewx[2890]: te923: Bad read (attempt 1 of 100): Not enough bytes: 0 < 34
Jan 23 01:42:47 janschwarz weewx[2890]: te923: usb error while reading: could not release intf 0: No such device
Jan 23 01:42:58 janschwarz weewx[2890]: message repeated 3 times: [ te923: usb error while reading: could not release intf 0: No such device]
Jan 23 01:42:58 janschwarz weewx[2890]: te923: Bad read (attempt 1 of 100): Not enough bytes: 0 < 34
Jan 23 01:42:58 janschwarz weewx[2890]: te923: usb error while reading: could not release intf 0: No such device
Jan 23 01:42:58 janschwarz weewx[2890]: te923: Bad read (attempt 2 of 100): Not enough bytes: 0 < 34
Jan 23 01:42:58 janschwarz weewx[2890]: te923: usb error while reading: could not release intf 0: No such device
Jan 23 01:42:58 janschwarz weewx[2890]: te923: Bad read (attempt 3 of 100): Not enough bytes: 0 < 34
Jan 23 01:42:59 janschwarz weewx[2890]: te923: usb error while reading: could not release intf 0: No such device
Jan 23 01:43:20 janschwarz weewx[2890]: message repeated 6 times: [ te923: usb error while reading: could not release intf 0: No such device]
Jan 23 01:43:20 janschwarz weewx[2890]: te923: Bad read (attempt 1 of 100): Not enough bytes: 0 < 34
Jan 23 01:43:20 janschwarz weewx[2890]: te923: usb error while reading: could not release intf 0: No such device
Jan 23 01:43:20 janschwarz weewx[2890]: te923: Bad read (attempt 2 of 100): Not enough bytes: 0 < 34
Jan 23 01:43:20 janschwarz weewx[2890]: te923: usb error while reading: could not release intf 0: No such device
Jan 23 01:43:21 janschwarz weewx[2890]: message repeated 2 times: [ te923: usb error while reading: could not release intf 0: No such device]
Jan 23 01:43:21 janschwarz weewx[2890]: te923: Bad read (attempt 1 of 100): Not enough bytes: 0 < 34
Jan 23 01:43:21 janschwarz weewx[2890]: te923: usb error while reading: could not release intf 0: No such device

And so on...

Any idea why it suddenly started and how I could solve this?

On my website all data are correct except the wind related information. The weather station itself is showing all wind data correctly and they are immediately changing when the wind direction or speed is changing, so I think there is no radio transmission problem).

mwall

unread,
Jan 23, 2015, 7:12:31 PM1/23/15
to weewx...@googlegroups.com
On Thursday, January 22, 2015 at 8:47:42 PM UTC-5, cyrix2000 wrote:
I have setup my TFA Nexus station  (TE923 driver) with weewx and for a few days everything was working perfectly. But today the wind speed and direction is just showing N/A and if I set debug = 1 the log is just showing this:

Jan 23 01:40:57 janschwarz weewx[2890]: message repeated 3 times: [ te923: usb error while reading: could not release intf 0: No such device]
Jan 23 01:40:57 janschwarz weewx[2890]: te923: Bad read (attempt 1 of 100): Not enough bytes: 0 < 34
Jan 23 01:40:57 janschwarz weewx[2890]: te923: usb error while reading: could not release intf 0: No such device

And so on...

Any idea why it suddenly started and how I could solve this?

you might be getting exceptionally high wind readings from the station.  if so, StdQC will change the values to None, which shows up as N/A.

to test this theory, enable decode verbosity by putting this in weewx.conf:

debug=1
...
[TE923]
    debug_decode=1
    ...

then run weewx directly:

sudo /path/to/weewxd /path/to/weewx.conf

then watch for the windSpeed values in the LOOP and REC data in one window. tail the log file in another window to see the raw and decoded values as they come from the station.

i typically see a few bad windSpeed values per day, but never enough to result in a None for windSpeed in a REC record.

i am pretty sure this is due to the very crude implementation of reading the usb in the te923 driver.  

the log messages about "Not enough bytes" are definitely the result of the crude timing.  at least you're never seeing more than 2 or 3 retries.

the timing between asking for data and receiving data seems to matter - the two sources i used to help write the driver, wview and te923tool, each do it differently.  the values i use in the te923.py driver are the result of experimentation.  it is quite possible that the timing needs to be tuned.  i did a bunch of wireshark/pcap sniffing last year, but still have not gotten around to optimizing the driver from those captures.  if you want to help figure it out, install pcap on windows, run the vendor's software, and watch the usb traffic.  it is a rather painstaking process, but when you start to decode things it is oddly satisfying.

most of these weather stations use a HID implementation for their usb.  HID is Human Interface Device - a mouse or a keyboard.  some (cheap? lazy? brilliant?) hardware vendors do this so that they do not have to write drivers for their hardware.  the computer will then recognize it since it already has generic HID support, but it cannot talk to it.  then the vendor has to shoe-horn the communication into the protocols designed for mouse and keyboard, and every vendor does it differently.

that is my totally amateur take on it, anyway.

i'd love to see a comprehensive guide to writing for (and reverse engineering of) usb...

m

cyrix2000

unread,
Jan 26, 2015, 8:09:46 AM1/26/15
to weewx...@googlegroups.com


On Saturday, 24 January 2015 00:12:31 UTC, mwall wrote:

you might be getting exceptionally high wind readings from the station.  if so, StdQC will change the values to None, which shows up as N/A.

to test this theory, enable decode verbosity by putting this in weewx.conf:

debug=1
...
[TE923]
    debug_decode=1
    ...

then run weewx directly:

sudo /path/to/weewxd /path/to/weewx.conf

then watch for the windSpeed values in the LOOP and REC data in one window. tail the log file in another window to see the raw and decoded values as they come from the station.

Bad readings seemed to be the problem. I swapped the USB cable for a better one with ferrites and since then the wind readings are displayed again. I guess something went wrong on the USB interface. 
Reply all
Reply to author
Forward
0 new messages