I have an APC Smart UPS 1500 connected via USB cable to a BeagleBone Green running NUT 2.8.1-5 on Linux 6.18.36-bone40. Even on earlier Linux kernels and versions of NUT, during some sort of UPS transition, I would start to get a log full of the these error messages:
usbhid-ups: nut_libusb_get_report: No such device (it may have been disconnected)
In detail:
kernel: musb-hdrc musb-hdrc.1: Babble kernel: usb 1-1: USB disconnect, device number 15 kernel: usb 1-1.4: USB disconnect, device number 16 kernel: usb 1-1: new high-speed USB device number 17 using musb-hdrc kernel: usb 1-1: New USB device found, idVendor=1a40, idProduct=0201, bcdDevice= 1.00 kernel: usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0 kernel: usb 1-1: Product: USB 2.0 Hub [MTT] kernel: hub 1-1:1.0: USB hub found kernel: hub 1-1:1.0: 7 ports detected kernel: usb 1-1.4: new full-speed USB device number 18 using musb-hdrc kernel: usb 1-1.4: New USB device found, idVendor=051d, idProduct=0003, bcdDevice= 0.01 kernel: usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 kernel: usb 1-1.4: Product: Smart-UPS_1500 FW:UPS 06.0 / ID=1028 kernel: usb 1-1.4: Manufacturer: American Power Conversion kernel: usb 1-1.4: SerialNumber: unique_number kernel: hid-generic 0003:051D:0003.0008: hiddev0,hidraw0: USB HID v1.11 Device [American Power Conversion Smart-UPS_1500 FW:UPS 06.0 / ID=1028] on usb-musb-hdrc.1-1.4/input0 usbhid-ups[31894]: nut_libusb_get_report: No such device (it may have been disconnected) usbhid-ups[31894]: nut_libusb_get_report: No such device (it may have been disconnected)
For some reason, USB devices 'disconnect' and reconnect. Then 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.
One forum article suggested that there is not enough power in the BeagleBone system to propery power a USB connection. The suggested solution is to add a powered USB hub. I gave that a try with no success in eliminating the problem.
To resolve this, I'm not sure if recent versions of the driver fix this, but I used Debian's udev system to sense the device id change and to restart the NUT USB driver.
In /home/debian, which is the default home directory, I created two files and ran 'chmod +x' on each to make them executable. When a USB 'ADD' state is detected, nut.target is restarted to initiate the detection and connection process. When a removal is detected, the service is stopped. The stop does not seem to be reliable, but the restart appears to be reliable enough to get things started again.
$ 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
$ 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
To determine useful attributes I used the following (the first is a shorter result than the second):
udevadm info --name=/dev/bus/usb/001/017 udevadm info --name=/dev/bus/usb/001/017 --attribute-walk
The rule which invokes these scripts is:
# 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}"
These command variations were suggested to simulate a cable re-connect but did not reliably work. I resorted to physically disconnecting and reconnecting the cable to perform a proper test for tuning and production (using the major:minor usb device manufacturer code):
# major:minor usb device manufacturer code usbreset 051d:0003 # dev bus id udevadm test /dev/bus/usb/001/007
Each rule change test required the following to reload the udev rules:
udevadm control --reload-rules
To see what Nut sees:
# nut-scanner -U
Scanning USB bus.
[nutdev1]
driver = "apc_modbus"
port = "auto"
vendorid = "051D"
productid = "0003"
product = "Smart-UPS_1500 FW:UPS 06.0 / ID=1028"
serial = "unique id"
vendor = "American Power Conversion"
bus = "001"
device = "017"
busport = "002"
###NOTMATCHED-YET###bcdDevice = "0001"
A linux command provides a concise device and manufacturer id:
# lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 016: ID 050d:0234 Belkin Components F5U234 USB 2.0 4-Port Hub Bus 001 Device 017: ID 051d:0003 American Power Conversion UPS
Other troubleshooting commands include:
udevadm monitorThis solution for those who might encounter Update 2.7.4 to 2.8.4 CP UPS driver disconnect (nut_libusb_get_report: No such device)


