2014-11-09 11:39 GMT-03:00 Charles Lepple <clep...@gmail.com>: > On Nov 9, 2014, at 8:13 AM, Marcelo Fernandez > <marcelo.fidel.fernan...@gmail.com> wrote: > >> 2014-11-09 9:59 GMT-03:00 Charles Lepple <clep...@gmail.com>: >>> >>> Strange, I would have thought that the "Value: 0" would show the actual >>> number. Does it look like drivers/libhid.o got rebuilt? >> >> Yes, at first I thought the same (that I did something wrong), but >> everything seems ok: > > My apologies, you did say the numbers looked different. > > Here's how the numbers get interpreted: > > In hidparser.c:GetValue(), the bits get extracted from the report (example: > "Report[buf]: (5 bytes) => 05 51 00 48 00"). For ConfigVoltage, the offset is > 16 bits, and we skip the first 8 (the report ID; 05 in this case). The size > is 16 bits, so that is "48 00" -> "0048", which should be 72. > > However, this UPS still has a logical Min/Max of 0/1 in effect when the > parser reads this. > > Can you add the attached patch to your tree? I guess leave the other line > commented out; I think there is some other scaling that needs to be > addressed. The proper way to fix this is to override the HID descriptor, and > that will take a little more coding.
Sure, let's do it: marcelo@nut:~/nut-2.7.2.5$ patch -p1 < hidparser_fix_logical_max.patch (Stripping trailing CRs from patch; use --binary to disable.) patching file drivers/hidparser.c plus make and make install. Now seems the values are well obtained, take a look: root@nut:/usr/local/ups/bin# ./upsc liebert battery.charge: 100 battery.charge.low: 20 battery.charge.warning: 20 battery.type: PbAc battery.voltage: 81.0 battery.voltage.nominal: 72.0 device.mfr: Emerson Network Power device.model: Liebert GXT3 device.serial: 1226603098AF453 device.type: ups driver.name: usbhid-ups driver.parameter.pollfreq: 30 driver.parameter.pollinterval: 2 driver.parameter.port: auto driver.version: 2.7.2.5 driver.version.data: Belkin/Liebert HID 0.17 driver.version.internal: 0.38 ups.mfr: Emerson Network Power ups.model: Liebert GXT3 ups.productid: 0008 ups.serial: 1226603098AF453 ups.status: OL CHRG ups.vendorid: 10af Regards -- Marcelo F. Fernández Buenos Aires, Argentina Lic. en Sistemas de Información E-Mail: marcelo.fidel.fernan...@gmail.com Blog: http://blog.marcelofernandez.info Twitter: http://twitter.com/fidelfernandez _______________________________________________ Nut-upsuser mailing list Nut-upsuser@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser