[Nut-upsdev] Some questions on driver implementation and variable names

Carlos Rodrigues carlos.efr at mail.telepac.pt
Sun Feb 25 19:35:52 CET 2007


On 2/25/07, Arjen de Korte <nut+devel at de-korte.org> wrote:
> > The driver can calculate some stuff, like the battery
> > runtime, the battery charge (percentage) and so on.
>
> Clients can do exactly the same, with the benefit that this will work
> for all drivers supporting the input variables needed, instead of just one.

Clients can't do it. Clients could only do it if the driver exposed
all the gory details necessary, like minimum and maximum battery
voltages, number of batteries, discharge curves... This would mean
even more variables, for something that a driver can do in only a few
lines of code.

"megatec", for example, calculates "battery.charge" itself, and it
sucks at it too... clients would suck even more...

Besides, some UPSes report these values themselves, others don't. It's
the driver's job to abstract the hardware, and this means doing stuff
in software that some UPSes do in hardware (firmware), thus
"pretending the hardware is fancier than it is".

-- 
Carlos Rodrigues



More information about the Nut-upsdev mailing list