[Nut-upsdev] Why Type: UNKNOWN?

Arnaud Quette aquette.dev at gmail.com
Fri Feb 17 10:22:41 UTC 2012


2012/2/15 Charles Lepple <clepple at gmail.com>:
> 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.

that's indeed still working like that:
we still have only string or enum, so numeric (probably including both
float and integer) is still lacking, and is somehow the default when
you get an "UNKNOWN type" message.

it's still more a cosmetic issue, since everything is passed through
string, and it's up to the driver, in the end, to reformat the value
as expected by the device / protocol.

cheers,
Arnaud
-- 
Linux / Unix Expert R&D - Eaton - http://powerquality.eaton.com
Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org/
Debian Developer - http://www.debian.org
Free Software Developer - http://arnaud.quette.free.fr/



More information about the Nut-upsdev mailing list