[Nut-upsdev] Why Type: UNKNOWN?

Charles Lepple clepple at gmail.com
Wed Feb 15 13:03:24 UTC 2012


On Feb 14, 2012, at 5:02 PM, William R. Elliot wrote:

> I am trying to make ups.delay.shutdown writable so the user can use upsrw to change it.
> 
> In the driver, after setting the variable to 0, I am using:  dstate_setflags("ups.delay.shutdown", ST_FLAG_RW);

As in the other thread, this is not something I am terribly familiar with, but I'll give it a shot.

I think the only two types of R/W variables in NUT are strings and enumerations. If it is an enumeration, you would need to provide a list of all possible values:

   http://www.networkupstools.org/docs/developer-guide.chunked/ar01s04.html#_enumerated_types

It sounds like you are looking for an integer variable, which I have handled in the past by using ST_FLAG_STRING and parsing the string with sscanf().

The "OK" return code is only a confirmation of receipt of the command - there was some discussion about how to handle return values, but often this would result in a round-trip to the device-- and the simplest way to handle this without blocking is to re-read the variable after setting it.

-- 
Charles Lepple
clepple at gmail



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20120215/8591586a/attachment.html>


More information about the Nut-upsdev mailing list