[Nut-upsdev] RFC: allow HID subdriver's to register ups.conf

Peter Selinger selinger at mathstat.dal.ca
Sun Jun 4 16:08:54 UTC 2006

j T wrote:
> Hi Peter
> You see, this is the problem that I'm having; I *really* don't want to be 
> polluting the vartable with all the options from all the different 
> subdrivers, but the current design doesn't allow me to avoid this (atleast 
> that I can tell).
> Basically, main() does:
> 	makevartable()
> 	process command line (while loop)
> 	chroot, setup signals, etc
> 	initups()
> Because main() processes the command line straight after it does 
> makevartable()
> [...]
> Also, the command line needs to have been processed before the initups() 
> happens because it needs to know the regexs and so-on in order to match the 
> relevent UPS.

Yes, you are right. It would be very awkward to have
subdriver-specific command line options, because the command line
already needs to be read to determine which device to connect to. This
is a catch-22. 

Also, newhidups --help should print out a list of available command
line options, which would be impossible if the options were defined by
individual subdrivers. 

So I guess the only feasible solution is to add the -x wait options to
the main newhidups driver, and carefully document the fact (in the man
page, in the help strings) that these are only for use with Belkin
> BTW; is it ok to use #ifdef preprocessor conditionals in NUT code? I don't 
> remember reading anything in the developer notes against it, but I'd rather 
> not go writing something using it if its unofficially tagged as being 
> "yucky"!

#ifdef's are used in various parts of the NUT code, but should not be
introduced needlessly. The main reason for using #ifdef is to make the
code portable to different operating systems. If all you want to do is
mark your changes, then don't. "diff" is your friend.

-- Peter

More information about the Nut-upsdev mailing list