[Nut-upsuser] Belkin Regulator Pro dropping connection and halting

John Bayly freebsd.ports at tipstrade.net
Thu Dec 2 10:24:03 UTC 2010

On 02/12/2010 10:08, Arjen de Korte wrote:
> Citeren Arnaud Quette <aquette.dev at gmail.com>:
>>> Thanks for the suggestions, I've added the flush statement as well 
>>> as some
>>> debugging information. As this is a intermittent issue I decided to try
>>> overloading the UPS by sending it repeated beeper commands while 
>>> watching
>>> the debug output. What appears to happen is that the UPS returns an 
>>> unknown
>>> "~00R000" response. This means get_belkin_reply() returns -1, causing a
>>> datastale state is set when called from do_status().
>> you should remove the datastale() call since upsd will automatically 
>> flag
>> the device as stalled if it has failed to update its data for 15 seconds
>> (default of MAXAGE).
> Not at all!
> The upsd server will only declare the *driver* stale if it fails to 
> respond within MAXAGE seconds. However, as long as it keeps answering 
> the PING from the server, it will not be declared stale. This 
> mechanism is something completely different from what happens if the 
> driver calls dstate_datastale(). In that case the driver tells the 
> upsd server that the *UPS* fails to respond. See the chapter on 
> "Staleness control" in docs/new-drivers.txt.
> What really needs to be done, is that the driver doesn't treat the 
> "~00R000" reply as an error condition. Apparently the UPS acknowledges 
> the receipt of data, without further response (indicating that 0 bytes 
> follow). The belkin driver doesn't accept this at the moment and 
> requires that a reply follows. This is what needs to be changed.
Ah, I had actually thought about doing exactly that by allowing for a 
zero-length response, but wasn't sure what the affect of doing so would 
be. I'm going to have a look at the way in which other drivers operate.

> Last but not least, in most drivers, we allow a couple of missed 
> replies before we call dstate_datastale() so that glitches don't lead 
> to automatic reconnects.
Can you suggest what driver would be a good template to use?

> Best regards, Arjen

More information about the Nut-upsuser mailing list