I’m not sure if it is just a bad motherboard, cable, USB device or just bad luck, but when I reboot the computer the UPS doesn’t appear. It’s not even seen in lsusb and of course that makes nut-server fail which makes nut-client complain that it cannot work out the UPS status.The solution was to unplug and plug the cable in then reset nut-server and all was good. But playing with cables seems so last century, surely there was a better way?
Some Googling showed up a way to Reset USB without a reboot but the directories the entry mentioned didn’t exist on my computer; though there was something very close to it. Perhaps that would work? A few tweaks later and I had a working UPS monitoring cable!
The changed script is below:
I’m not sure if it is just a bad motherboard, cable, USB device or just bad luck, but when I reboot the computer the UPS doesn’t appear. It’s not even seen in lsusb and of course that makes nut-server fail which makes nut-client complain that it cannot work out the UPS status.The solution was to unplug and plug the cable in then reset nut-server and all was good. But playing with cables seems so last century, surely there was a better way?
Some Googling showed up a way to Reset USB without a reboot but the directories the entry mentioned didn’t exist on my computer; though there was something very close to it. Perhaps that would work? A few tweaks later and I had a working UPS monitoring cable!
The changed script is below:
#!/bin/sh SYSXHCI=/sys/bus/pci/drivers/xhci_hcd if [ "$(id -u)" != 0 ] ; then echo This must be run as root! exit 1 fi if ! cd $SYSXHCI ; then echo Weird error. Failed to change directory to $SYSXHCI exit 1 fi for dev_id in ????:??:??.? ; do printf "${dev_id}" > unbind printf "${dev_id}" > bind done
Thanks to Eli for the original idea which got me onto the right path.