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

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

#465 in Hardware support

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.1–3MB
~54K SLoC