Skip to content

Instantly share code, notes, and snippets.

@luelista
Created April 7, 2017 23:54
Show Gist options
  • Save luelista/d46154d52f1b74803bc5e7543a670c99 to your computer and use it in GitHub Desktop.
Save luelista/d46154d52f1b74803bc5e7543a670c99 to your computer and use it in GitHub Desktop.
#!/bin/bash
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment