I wrote up an article regarding this.

NUT USB APC BeagleBone <https://blog.raymond.burkholder.net/index.php?/archives/1360-NUT-USB-APC-BeagleBone.html>

For some reason, USB devices 'disconnect' and reconnect. When the device reconnects, a new DeviceID is assigned to the USB device. This breaks the usbhid-ups drivers supplied by NUT the packages. That is, usbhid-ups no longer sees the APC USB device.

To resolve this, I used Debian's udev system to sense the device id change and to restart the NUT USB driver.

   # cat /etc/udev/rules.d/89-usb-ups-change.rules
   SUBSYSTEM=="usb", MODE="0660", ACTION=="add",
   ENV{ID_VENDOR_ID}=="051d", ENV{ID_MODEL_ID}=="0003",
   RUN+="/home/debian/usb_add.sh add '$env{DEVNAME}' '$env{ID_USB_SERIAL}'"
   SUBSYSTEM=="usb", MODE="0660", ACTION=="remove",
   RUN+="/home/debian/usb_remove.sh remove $env{DEVNAME}"

Sense a removal, which stops nut.target

   $ cat usb_remove.sh
   #!/usr/bin/env bash

   logger "USB state change detected: $1 $2"
   echo "$(date) USB state change detected: $1 $2" >>
   /home/debian/usb-log.txt
   #systemctl stop nut.target
   exit 0

Sense an addition, which restarts / starts

   $ cat usb_add.sh
   #!/usr/bin/env bash

   logger "USB state change detected: $1 $2 $3"
   echo "$(date) USB state change detected: $1 $2 $3" >>
   /home/debian/usb-log.txt
   systemctl restart nut.target
   exit 0


The blog entry has more detail about parameters

Raymond
https://blog.raymond.burkholder.net


On 2026-07-22 21:02, Robert Nichols via Nut-upsuser wrote:
Is there a way to prevent the usbhid-ups driver from flooding the system log when a monitored UPS is disconnected from its UCB port. I see a steady stream of messages:

 usbhid-ups[3480520]: libusb1: Could not open any HID devices: insufficient permissions on everything

that are posted every 2 seconds until I comment out that device from ups.conf and restart the nut service.
Version is nut-2.8.2-1.el8.x86_64 in Rocky Linux 8.
_______________________________________________
Nut-upsuser mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Reply via email to