On Sep 19, 2010, at 3:55 PM, Will Cooke wrote:

In drivers/usbhid-ups.c, can you change %f to %g in the following lines (2
occurrences) :

upsdebugx(2, "Path: %s, Type: %s, ReportID: 0x%02x, Offset: %i, Size:
%i, Value: %f",

This changes it from a fixed-point notation to floating point.


Done.

I now see this reported when there is power applied to the UPS:

Path: UPS.PowerSummary.PresentStatus.ACPresent, Type: Feature,
ReportID: 0x07, Offset: 2, Size: 1, Value: 1e-07

And this when there isn't:

Path: UPS.PowerSummary.PresentStatus.ACPresent, Type: Feature,
ReportID: 0x07, Offset: 2, Size: 1, Value: 0

usbhid-ups developers:

Any objections to changing the default format string in these debug messages from %f to %g? I know it's nice to have a constant-width output format, but the Type string is variable-length, and in this case, we had a value hiding just outside the precision of the printf output.


_______________________________________________
Nut-upsdev mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/nut-upsdev

Reply via email to