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

John Bayly freebsd.ports at tipstrade.net
Wed Dec 1 18:03:08 UTC 2010

On 01/12/2010 14:17, Arjen de Korte wrote:
> Citeren Charles Lepple <clepple at gmail.com>:
>> The get_belkin_reply() function looks fragile to me. Three seconds 
>> should be
>> enough to fill the buffer, but if you put a few upsdebugx() calls 
>> around ser_get_buf_len(), it should be evident whether the read is 
>> timing out, or if there is a problem with the format of the response.
> Starting with
>     ser_flush_io(upsfd);
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().
> in the send_belkin_command function (before the ser_send call) might 
> also help. It doesn't look like the driver deals with partial replies 
> gracefully.
Accepted, however not dealing with a partial reply means that it will 
cause a datastale state, and there should be no way for it to cause OB 
or LB states.
> Best regards, Arjen

I've also *beefed* up the logic in do_status(), it was assuming that if 
certain fields were not "1" they would be "0", instead I've made sure it 
checks if the fields are either "0" or "1", as it's possible the UPS 
could return blank fields. Of course, I don't know if this is the cause, 
but it's the only thought I have.


More information about the Nut-upsuser mailing list