#usb-device #error #devices #reset #automatic

app usbautoreset

Tool to automatically reset USB devices on error

4 releases

0.1.3 Apr 2, 2024
0.1.2 Apr 2, 2024
0.1.1 Apr 2, 2024
0.1.0 Apr 2, 2024

#158 in Hardware support

Download history 268/week @ 2024-03-29 36/week @ 2024-04-05 1/week @ 2024-04-12

305 downloads per month

MIT license

4KB
58 lines

usbautoreset

If you are like me, your USB devices sometimes stop working and even unplugging and plugging them back in doesn't help. This is a simple script that resets the USB devices by unbinding and binding them.

It looks for errors like this:

xhci_hcd 0000:00:14.0: WARN: buffer overrun event for slot 10 ep 1 on endpoint
xhci_hcd 0000:00:14.0: WARN: buffer overrun event for slot 10 ep 1 on endpoint

When it sees a message like this, it does the equivalent of:

echo -n "0000:00:14.0" > /sys/bus/pci/drivers/xhci_hcd/unbind && echo -n "0000:00:14.0" > /sys/bus/pci/drivers/xhci_hcd/bind

Installation

cargo install usbautoreset

Usage

sudo ./usbautoreset

Dependencies

~2–3MB
~53K SLoC