CVSROOT:        /cvs
Module name:    src
Changes by:     lan...@cvs.openbsd.org  2025/03/02 01:18:12

Modified files:
        sys/dev/usb    : upd.c 

Log message:
upd(4): fix RunTimeToEmpty on at least some EATON models

for some reason when that hid report is on 4 bytes, the value is
absurdly high (eg 'days'). Comparing with what sysutils/nut says,
right-shifting the value given by the device matches the readings from
nut (eg between 30mn and 1h).

looking at the usbhid parser in nut, it seems to refer to the concept of
'offset' in a reading, but that's something we don't have in hid.c, and
isn't clearly mentioned in the usbhid spec.. besides the cryptic
sentence 'the offset of a field in a report is determined by the fields
that are declared before it'.

tested on macppc & amd64 with an 'EATON Ellipse PRO' (which reports
a broken value on 4 bytes) and an 'APC Back-UPS BX950MI' (which reports
an already correct value on 2 bytes)

a variation of this was tested a while ago by Walter Alejandro Iglesias
to fix the same issue on a 'Eaton 3S 550'.

to know the report size for RunTimeToEmpty:
$lsusb -v -d <vendor>:<product> | grep -A2 'Time To Empty' | grep Size

ok miod@

Reply via email to