[Nut-upsuser] usbhid-ups dying, consistently
clepple at gmail.com
Thu Dec 31 23:43:33 UTC 2015
Thanks for the libusb version numbers. By the way, which version of NUT are you using?
On Dec 31, 2015, at 6:23 PM, Nicholas Leippe <leippe at gmail.com> wrote:
> I haven't cracked open the nut sources yet, but am curious why it should fail to open the usb device after already succeeding many times.
> Could it be a USB power management issue? Or simply opening it too many times somehow breaks it?
One major difference between the initial startup of usbhid-ups and when it tries to reconnect: in the former case, the USB stack has had time to fully start up all of the kernel-side drivers.
When usbhid-ups attempts to claim the UPS HID interface for the first time after the UPS is plugged in (or has reattached itself), the kernel USB HID driver causes an EBUSY return code ("failed to claim USB device: Device or resource busy"). Usually, the EBUSY code goes away after usbhid-ups tells the kernel to relinquish the interface (line 271 [*]), but in your case, it is possible that the USB HID driver hasn't completely started up. This might explain the "failed to detach kernel driver from USB device: No such file or directory" error.
Since dmesg now shows timestamps, you might want to check to see the time delta between when the UPS is first detected, and when USB-related messages stop appearing. It's about half a second on this Raspberry Pi (which incidentally is now running a 4.1.x kernel):
[ 2.893909] usb 1-1.2: new low-speed USB device number 4 using dwc_otg
[ 3.041108] usb 1-1.2: New USB device found, idVendor=09ae, idProduct=3016
[ 3.050101] usb 1-1.2: New USB device strings: Mfr=3, Product=1, SerialNumber=5
[ 3.059367] usb 1-1.2: Product: TRIPP LITE UPS
[ 3.065704] usb 1-1.2: Manufacturer: Tripp Lite
[ 3.558046] hid-generic 0003:09AE:3016.0001: hiddev0,hidraw0: USB HID v1.11 Device [Tripp Lite TRIPP LITE UPS] on usb-20980000.usb-1.2/input0
Note that NUT does not use the kernel USB HID drivers, which is why it has to detach those drivers to allow libusb to connect.
Other than the reconnection attempts, usbhid-ups only fully opens the UPS USB device once.
More information about the Nut-upsuser