Skip to content

Commit

Permalink
Add USB UPS example
Browse files Browse the repository at this point in the history
  • Loading branch information
deajan committed Mar 30, 2023
1 parent 22c36d0 commit d251673
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,26 @@ bind hub /sys/bus/pci/drivers/xhci_hcd/0000:00:14.0
```

Afterwards, all your USB devices should work as if they were just plugged in, since this reset also temporarily cuts power from given USB device, making it reboot.

## Usual suspect: Cypress Semiconductor USB to Serial UPS

These cheap USB UPS have always the same kind of unreliable USB to serial interface.
Most of them use `blazer_usb` driver from NUT, and sometimes the driver can't start because it can't communicate with the UPS. Guess why ? No idea.

Unplugging and plugging the USB port usually fixes this, but that's not handy.

A simple USB device reset isn't sufficient for that one.

We'll need to reset the hub it's attached to.

The command for doing so is:
```
usb_reset.py --reset-hub --device 0665:5161
```

While I have a couple of machines running NUT, I modified the nut-driver.service file to automatically reset the device before trying to load the driver:

In `/etc/systemd/system/nut-driver.service` I added line
```
ExecStartPre=/usr/local/bin/usb_reset.py --reset-hub --device 0665:5161
```

0 comments on commit d251673

Please sign in to comment.