[Nut-upsdev] Too much logging from libusb.c (patch supplied)
Arjen de Korte
nut+devel at de-korte.org
Tue Apr 20 08:56:20 UTC 2010
Citeren Sean Conner <sean op conman.org>:
>
> I recently installed NUT 2.4.3 and found that the USB drivers were logging
> an insane amount of data to syslog:
>
> usbhid-ups | daemon debug | Apr 16 18:29:40 | libusb_get_report: No error
> usbhid-ups | daemon debug | Apr 16 18:29:40 | libusb_get_report: No error
> usbhid-ups | daemon debug | Apr 16 18:29:40 | libusb_get_report: No error
> usbhid-ups | daemon debug | Apr 16 18:29:40 | libusb_get_report: No error
> usbhid-ups | daemon debug | Apr 16 18:29:40 | libusb_get_report: No error
> usbhid-ups | daemon debug | Apr 16 18:29:40 | libusb_get_report: No error
>
> (and so on and so on)
>
> I found the location where this is happening and did the following patch:
>
> diff --git a/drivers/libusb.c b/drivers/libusb.c
> index 50bfc7f..3eae478 100644
> --- a/drivers/libusb.c
> +++ b/drivers/libusb.c
> @@ -353,7 +353,7 @@ static int libusb_open(usb_dev_handle **udevp,
> USBDevice_t *curDevice, USBDevice
> */
> static int libusb_strerror(const int ret, const char *desc)
> {
> - if (ret > 0) {
> + if (ret >= 0) {
> return ret;
> }
No.
The above *is* an error condition (despite the 'No error' message),
most likely due to buggy UPS firmware. Normally, we should not expect
that when asking for a report, the UPS returns nothing. After all it
is 'advertising' the report in the report descriptor, so silently
ignoring this would be a grievous mistake. At the very least, if
someone is debugging the we should provide some indication why this
fails.
As you can see, this is logged at LOG_DEBUG level. If you don't want
to see this message, don't log messages at this level (there usually
is no reason to do so on production systems). The development version
(and the next stable release) will allow you to raise the log level
threshold by adding '-q' (in a similar fashion as the '-D' flag) to
the startup command line.
But do remember, that this is an error condition and you really should
ask yourself what problem you're attempting to mask out, before doing
so. Running the driver in debug mode might help in determining where
the UPS is lying to us. We're not logging this without reason.
Best regards, Arjen
--
Please keep list traffic on the list
More information about the Nut-upsdev
mailing list