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

Charles Lepple clepple at gmail.com
Wed Feb 13 16:17:12 UTC 2008

On Feb 13, 2008 9:29 AM, Arjen de Korte <nut+devel at de-korte.org> wrote:
> >>> 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.

That's a good point. As far as setting an example, though, it wouldn't
hurt to have a comment to point any potential driver writers to the
other half of the initialization code.

I should really reexamine the tripplite_usb code and make sure I am
following all the guidelines in new-drivers.txt :-)

- Charles Lepple

More information about the Nut-upsdev mailing list