X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2020-03.git/blobdiff_plain/17d7b80328e653a7d65c4aac24c4f8173409c321..0d22dfcdb7eab1975d56ed36967885707470c828:/user/bkusbreset diff --git a/user/bkusbreset b/user/bkusbreset new file mode 100755 index 0000000..4e135f9 --- /dev/null +++ b/user/bkusbreset @@ -0,0 +1,24 @@ +#!/bin/bash +# script to force reset USB devices +# soruce: http://billauer.co.il/blog/2013/02/usb-reset-ehci-uhci-linux/ + + +if [[ $EUID != 0 ]] ; then + echo This must be run as root! + exit 1 +fi + +for xhci in /sys/bus/pci/drivers/?hci_hcd ; do + + if ! cd $xhci ; then + echo Weird error. Failed to change directory to $xhci + exit 1 + fi + + echo Resetting devices from $xhci... + + for i in ????:??:??.? ; do + echo -n "$i" > unbind + echo -n "$i" > bind + done +done