[Nut-upsdev] Default format for HID debugging (was Re: [Nut-upsuser] Liebert PSP)

Charles Lepple clepple at gmail.com
Sun Sep 19 21:00:48 UTC 2010


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.




More information about the Nut-upsdev mailing list