[Nut-upsdev] zero-prepended values - why oh why?

Peter Selinger selinger at mathstat.dal.ca
Thu Feb 23 18:24:49 UTC 2006


Niklas,

I have never seen NUT produce a zero-prepended value, except perhaps
in the case of decimal fractions or version numbers such as 0.8.
Typical output I get looks like this:

battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 50
battery.date: not set
battery.mfr.date: 2005/04/02
battery.runtime: 2850
battery.runtime.low: 120
battery.voltage: 13.0
battery.voltage.nominal: 12.0
driver.name: newhidups
driver.parameter.port: auto
driver.version: 2.0.3
driver.version.data: APC HID 0.8
driver.version.internal: 0.28
input.transfer.high: 139
input.transfer.low: 88
input.voltage: 110.0
input.voltage.nominal: 120
ups.beeper.status: disabled
ups.delay.shutdown: -1
ups.firmware: 818.w1.D
ups.firmware.aux: w1
ups.load: 20
ups.mfr: APC
ups.mfr.date: 2005/04/02
ups.model: Back-UPS ES 650
ups.serial: QB0514132764  
ups.status: OL

Could you give some examples of what you mean? -- Peter

Charles Lepple wrote:
> 
> On 2/23/06, Niklas Edmundsson <nikke at acc.umu.se> wrote:
> > Can somebody please explain why values are 0-prepended in almost every
> > driver? Since it's done almost everywhere I suspect it's due to some
> > old policy.
> 
> I don't have time at the moment to look into this, but this probably
> started because some of the older UPSes actually returned values
> padded with zeroes. Other people probably looked at the driver output
> and made their code output similar values.
> 
> You should probably check with Arnaud to see whether clients are
> counting on certain widths for their numbers. I agree in principle
> that a '0' prefix should only be used for octal numbers, but then
> again, the only bases that you generally see with UPS protocols are 2,
> 10, and 16.
> 
> --
> - Charles Lepple
> 
> _______________________________________________
> Nut-upsdev mailing list
> Nut-upsdev at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/nut-upsdev
> 




More information about the Nut-upsdev mailing list