From 238ef9ee1ce9ffad12e057e9f26473d4d85a202c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bogdziewicz?= Date: Wed, 6 Nov 2024 20:05:58 +0100 Subject: [PATCH 1/2] drivers/usbhid-ups.c: handle zero HID events with reconnection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MichaƂ Bogdziewicz --- drivers/usbhid-ups.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usbhid-ups.c b/drivers/usbhid-ups.c index b5968d0a02..4b3250a045 100644 --- a/drivers/usbhid-ups.c +++ b/drivers/usbhid-ups.c @@ -1088,6 +1088,7 @@ void upsdrv_makevartable(void) } #define MAX_EVENT_NUM 32 +#define NO_EVENTS 0 void upsdrv_updateinfo(void) { @@ -1144,6 +1145,7 @@ void upsdrv_updateinfo(void) #if WITH_LIBUSB_0_1 /* limit to libusb 0.1 implementation */ case -EPERM: /* Operation not permitted */ #endif + case NO_EVENTS: /* No HID Events */ case LIBUSB_ERROR_NO_DEVICE: /* No such device */ case LIBUSB_ERROR_ACCESS: /* Permission denied */ #if WITH_LIBUSB_0_1 /* limit to libusb 0.1 implementation */ From c56b08da117e8ba29d2a4fb56508b5344665d9b7 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 15 Nov 2024 11:58:43 +0100 Subject: [PATCH 2/2] NEWS.adoc: document usbhid-ups fix for 0 HID Objects and lock-up on some devices [#2671] * Grew from https://github.com/user-attachments/files/17646606/0001-apc-fix.patch.txt proposed at https://github.com/networkupstools/nut/issues/2644#issuecomment-2459538691 Signed-off-by: Jim Klimov --- NEWS.adoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS.adoc b/NEWS.adoc index 82fce8afc9..5800677b00 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -146,6 +146,10 @@ https://github.com/networkupstools/nut/milestone/11 - usbhid-ups updates: * Support of the `onlinedischarge_log_throttle_hovercharge` in the NUT v2.8.2 release was found to be incomplete. [#2423, follow-up to #2215] + * Prevent UPS Lockup on "0 HID Objects" by reconnecting on stale data. + Note that while some devices just report information upon subsequent + poll, others (APC BXnnnnMI) were seen to lock up until full connection + restart. [#2671] * Added support for `lbrb_log_delay_sec=N` setting to delay propagation of `LB` or `LB+RB` state (buggy with APC BXnnnnMI devices circa 2023-2024). This may work better with flags like `onlinedischarge_calibration` and