[Nut-upsdev] [Nut-upsuser] genericups CP custom config not working

Arjen de Korte nut+devel at de-korte.org
Wed Feb 13 14:29:19 UTC 2008


>>> Do any of you see any reason why we shouldn't move the signal
>>> overrides out of upsdrv_initinfo() and into upsdrv_initups()?
>> Well, other than the fact that overriding the OL and LB signals in
>> upsdrv_initups() is not needed (since these signals are irrelevant until
>> we call upsdrv_updateinfo() for the first time), this is probably a good
>> idea.
> You're right that the input signals are irrelevant at first, but it
> also makes sense to keep all of the configuration code together.

The upsdrv_shutdown() and upsdrv_updateinfo() functions require that the
CP is set and only upsdrv_shutdown() requires that the SD override is set.
The place that makes most sense then, is to do both at the time of running
upsdrv_initups(), since we are sure that we have the console so that any
errors can be shown on the console (and that any configuration error in
the SD override doesn't showup when we attempt to shutdown the UPS).

What I'm also trying, is to adhere to the following comment for
upsdrv_initups() in 'docs/new-drivers.txt':

"Don't do any sort of hardware detection here, since you may be going
 into upsdrv_shutdown next."

There difference in runtime between putting just the output overrides in
upsdrv_initups() (and leaving the input overrides where they are) or
moving everything to upsdrv_initups() is academic at best. However, I
don't want to set a 'bad example' here. We don't need the input overrides
in order to successfully send the UPS a shutdown command, so in order to
keep this clean, I prefer to have them in upsdrv_initinfo(). By doing so,
they are also neatly grouped in 'output' and 'input' overrides.

Best regards, Arjen




More information about the Nut-upsdev mailing list