[Nut-upsdev] driver development

Charles Lepple clepple at gmail.com
Tue May 6 03:07:02 UTC 2014


On May 5, 2014, at 10:15 AM, Bruno Salvador wrote:
> 
> 1) How can I compile just the driver, instead of compiling everything? (very noob question)

http://www.networkupstools.org/docs/user-manual.chunked/aphs01.html

> 2) What do you use to debug the driver?

We like to have debugging support in the drivers, so that users can start adding -D flags to the command line to see increasing amounts of messages. The output from just "-D" should not be too verbose - for a serial driver, not much more than one or two lines per poll interval. Something like "-DDDD" might show parsing of individual low-level messages.

Apparently solis.c does not have any upsdebugx() debugging messages, just a few syslog messages (via upslogx()). Feel free to add some while you are working with the code.

Aside from internal debugging, we also use strace, gdb and valgrind from time to time. These are more specialized tools - for instance, valgrind deals with memory allocation errors, and gdb can be useful when tracking down crashes. But for protocol-level debugging, upsdebugx() is the way to go.

-- 
Charles Lepple
clepple at gmail






More information about the Nut-upsdev mailing list