chore(bktemplate):Remove date from file
[BK-2020-03.git] / user / bkusbreset
1 #!/bin/bash
2 # script to force reset USB devices
3 # soruce: http://billauer.co.il/blog/2013/02/usb-reset-ehci-uhci-linux/
4
5
6 if [[ $EUID != 0 ]] ; then
7 echo This must be run as root!
8 exit 1
9 fi
10
11 for xhci in /sys/bus/pci/drivers/?hci_hcd ; do
12
13 if ! cd $xhci ; then
14 echo Weird error. Failed to change directory to $xhci
15 exit 1
16 fi
17
18 echo Resetting devices from $xhci...
19
20 for i in ????:??:??.? ; do
21 echo -n "$i" > unbind
22 echo -n "$i" > bind
23 done
24 done