[Nut-upsuser] Cyberpower/powerpanel error: Data stale

Arjen de Korte nut+users at de-korte.org
Wed Oct 29 21:16:47 UTC 2008

Citeren Kjell Claesson <kjell.claesson at epost.tidanet.se>:

> The driver looks OK, and changing the timing (delays) in it is not going to
> help.

There is one slight problem in it. The ser_get_buf_len() that is used  
will not differentiate between 'no characters read' and 'not enough  
characters read'. It will either return the requested number of  
characters or '-1'. This fooled me once again, so I think I will  
rework that part. Lines 382 - 385 in powerp-bin.c are basically a  
no-op now.

I think the best way to fix this, would be to change the  
ser_get_buf_len() function in serial.c, as other drivers also seem to  
expect that on timeout the number of characters actually read are  
returned as well. I'll check with the other drivers that use this  
function (and possibly others as well). I guess most drivers will  
already check if the returned number of characters is what they  
expect, so this should have little impact.

Something similar should be done for partial sending of data, although  
here quite a couple of drivers don't seem to bother checking the  
return code of the ser_send_* functions at all.

Best regards, Arjen
Please keep list traffic on the list

More information about the Nut-upsuser mailing list