[Nut-upsdev] Flushing the report buffer
Peter Selinger
selinger at mathstat.dal.ca
Wed Aug 15 12:48:22 UTC 2007
Arjen de Korte wrote:
>
> Hi Peter,
>
> The explanation on why I want to flush the report buffer after running
> instcmd() or setvar() was incorrect. It is not the variable thats get
> written, that needs to be read fresh from the UPS. That is already handled
> by HIDSetItemValue(), which reads back the value and thereby refreshes the
> report buffer. I goofed up here, I looked at the wrong parameters. :-(
>
> However, when I change the "output.voltage.nominal" on my Evolution 650,
> it also adjusts the settings for "input.transfer.*" (automatically). There
> is an odd chance that you might miss changes in the UPS if you change two
> parameters in quick succession otherwise. Since you can never know what
> values change after writing a variable to the UPS, I think the safest
> option is to flush whatever is in the report buffer.
>
> Maybe flushing the report buffer should be the default behaviour of
> HIDSetItemValue(), so that it invalidates all timestamps in the report
> buffer before reading back the parameter just set. Or would this be too
> inflexible? What's your opinion on that?
Sure, that makes lots of sense. And setting a variable or sending a
command is almost always the result of user action or rare events
(such as a shutdown), and therefore the extra communications overhead
is likely to be nil.
-- Peter
More information about the Nut-upsdev
mailing list