[Nut-upsdev] Too much logging from libusb.c (patch supplied)

Arjen de Korte nut+devel at de-korte.org
Tue Apr 20 11:55:08 UTC 2010


Citeren Sean Conner <sean op conman.org>:

>   Well, the comment above that function reads:
>
> /*
>  * Error handler for usb_get/set_* functions. Return value > 0 success,
>  * 0 unknown or temporary failure (ignored), < 0 permanent failure  
> (reconnect)
>  */

And this is exactly what happens.

> You might want to have a custom message for the 0 case, as usb_strerror()
> (which I suppose is a wrapper for strerror(), but I haven't checked) just
> returns "No error" for a value of 0, which to me, is misleading (and the
> comment says it's ignored anyway, so either the code is wrong, or the
> comment).  All I saw logged were countless "No error" messages.

You misunderstood the 'ignored' part here. The driver just doesn't  
know what to do to resolve the error condition (and most likely can't  
do anything about it anyway). That still doesn't make it a 'non-error'  
condition and still may result in abnormal behavior that we want to be  
informed about. Depending on the HID path that returns this error,  
this may be an insignificant problem (reading serial number of the  
device) or a critical one (line/battery status). There is no way to  
tell at this point.

> The problem is I'm monitoring two UPSes via USB and the logging
> information is insufficient to determine which UPS is giving the bogus
> information.

The driver should also log the PID in the log message (at least,  
that's what it is configured to do so). If you're running multiple  
drivers, you should still be able to tell them apart by the PID.

Best regards, Arjen
-- 
Please keep list traffic on the list




More information about the Nut-upsdev mailing list