I just found how to pass custom options. You just have to declare the extra option with addvar() at upsdrv_makevartable() and then at any other point of the driver test if it was set at ups.conf with testvar() and retrieve its value with getval().
On Sat, Sep 5, 2020 at 5:38 PM João Luis Meloni Assirati <[email protected]> wrote: > Hello, > > I am developing a new NUT driver for brazilian UPS brand "Ragtech" by > reverse engeneering. I have never been involved in NUT driver development, > so I wish to ask some basic questions. Any help will be much appreciated! > > 1. Is there a mandatory C code style? I mean, any strong recommendation? > If there are none, I prefer to keep mine. > > 2. What are the purposes of "instant commands" test.battery.start and > calibration.start? I know an UPS command that will put the load on battery > until it reaches a low level and then put the UPS online back. After that, > an UPS variable regarding the detected battery capacity will get updated. > To which one of those "instant commands" should I associate this UPS > command? Also, it seems that in this case the status flag CAL must be > reported, is this right? > > 4. When doing the command above, the load is on battery *and* also there > is line power present. In this case, does it make sense to report both OL > and OB status flags? Or are OL and OB mutually exclusive? > > 3. The UPS connects to computer by USB and appears as a serial port > /dev/ttyACM?. My driver completely supports hotplugging, so I can plug or > unplug the usb cable before or after the driver has started. In any case, > the driver connects, disconnects or reconnects to the UPS. The way I did > this is by doing connection to the serial port and detection of UPS model > all in upsdrv_initinfo(), with upsdrv_initups() doing almost nothing. Is > this alright? > > 4. I wish to be able to pass to the driver some custom options besides the > "port = " that appears in ups.conf (for example, only manage a device > that reports a specific serial number). What is the standard way to do this? > > I probably will have more questions, please forgive me if I don't ask them > all in a single e-mail. I plan to submit my code as soon as these naive > questions get resolved. > > Thank you very much, > > João Luis. >
_______________________________________________ Nut-upsdev mailing list [email protected] https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsdev
