digitemp_DS2490 fails to detect sensors
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
digitemp (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
The version of digitemp_DS2490 in Trusty and later (and possibly previous versions, though it has worked for us before) does not detect temperature sensors connected to the One-wire network. For reference, we're using
digitemp:
but it is likely that other versions are affected too.
To reproduce:
- Connect some temperature sensors via a DS2490 USB-to-1wire adapter
- Run: digitemp_DS2490 -i
Expected results:
- The sensors are detected and listed on the output (and in a .digitemprc file); this takes a few seconds
Actual results:
- No sensors are detected; the program returns immediately.
Diagnosis:
This seems to be a (long-standing?) bug in how the code resets the 1-Wire bus via USB. There are a number of issues:
- The DS2490 returns the operation result via interrupt data, but the program reads it via normal data.
- A result is only returned if the appropriate bit is set to request it; the program does not set this bit.
- The program requests 32 (0x20) bytes from the USB device, but does not check how many were actually returned (and hence whether any result actually came back) - the device will always return 16 (0x10) status bytes, but any result bytes follow these.
Thus the program detects status or failure by reading a byte in the buffer that the device has not actually modified. In cases where the program worked, this is likely to be because the value happened to be set to the right value (0 will do) by chance.
Fix:
I'll attach a patch to the bug that addresses these issues.
The attachment "Patch to fix issue reading result after resetting 1wire bus via USB" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.
[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]