<div dir="ltr">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().</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Sep 5, 2020 at 5:38 PM João Luis Meloni Assirati <<a href="mailto:jlmassir@gmail.com">jlmassir@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>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!</div><div><br></div><div>1. Is there a mandatory C code style? I mean, any strong recommendation? If there are none, I prefer to keep mine.</div><div><br></div><div>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?</div><div><br></div><div>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?</div><div><br></div><div></div><div>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?</div><div><br></div><div>4. I wish to be able to pass to the driver some custom options besides the "port = " that appears in <span style="color:rgb(0,0,0);font-family:monospace">ups.conf (for example, only manage a device that reports a specific serial number). What is the standard way to do this?</span></div><span style="font-family:monospace"><br></span><div><span style="font-family:monospace">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.</span></div><div><span style="font-family:monospace"><br></span></div><div><span style="font-family:monospace">Thank you very much,</span></div><div><span style="font-family:monospace"><br></span></div><div><span style="font-family:monospace">João Luis.</span></div></div>
</blockquote></div>