chore(config-shared): Remove emacs config files
[BK-2020-03.git] / user / bkusbreset
... / ...
CommitLineData
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
6if [[ $EUID != 0 ]] ; then
7 echo This must be run as root!
8 exit 1
9fi
10
11for 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
24done