The patch didn't change the output. I took a look at the sources:
libusb_get_report() returns libusb_strerror(ret, __func__) which returns 0 for 
ret == -EOVERFLOW. Then in refresh_report_buffer(): r == 0 and the patch 
doesn't work. The log message would be incorrect anyway because "r" is not the 
size of response but a negative error code in this situation.

I made a quick additional patch for 2.6.3 to get the output you wanted.
Looks like the value is still updated only once.

--- drivers/libhid.c.bak        2012-01-24 18:40:32.437247314 +0400
+++ drivers/libhid.c    2012-01-24 18:52:50.624696914 +0400
@@ -155,7 +155,7 @@
 
        /* Some buggy firmware send more data than expected. Log this, but 
process
         * data anyway */
-       if (rbuf->len[id] != r) {
+       if (r > 0 && rbuf->len[id] != r) {
                upsdebugx(2, "%s: expected %d bytes, but got %d instead", 
__func__, rbuf->len[id], r);
                upsdebug_hex(3, "Report[err]", rbuf->data[id], r);
        } else {
--- drivers/libusb.c.bak        2012-01-24 15:08:13.090612484 +0400
+++ drivers/libusb.c    2012-01-24 15:08:21.578110181 +0400
@@ -378,7 +378,7 @@
        case -EOVERFLOW:        /* Value too large for defined data type */
        case -EPROTO:   /* Protocol error */
                upsdebugx(2, "%s: %s", desc, usb_strerror());
-               return 0;
+               return ret;
 
        default:        /* Undetermined, log only */
                upslogx(LOG_DEBUG, "%s: %s", desc, usb_strerror());


** Attachment added: "usbhid-ups_2.6.3+patch2_power_failure.log"
   
https://bugs.launchpad.net/ubuntu/+source/nut/+bug/915985/+attachment/2690943/+files/usbhid-ups_2.6.3%2Bpatch2_power_failure.log

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/915985

Title:
  usbhid-ups regression (APC BE525-RS)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/nut/+bug/915985/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to