Skip to content

Instantly share code, notes, and snippets.

@mindnuts
Last active August 29, 2015 14:26
Show Gist options
  • Select an option

  • Save mindnuts/3b51a212989d9c3644da to your computer and use it in GitHub Desktop.

Select an option

Save mindnuts/3b51a212989d9c3644da to your computer and use it in GitHub Desktop.
#!/bin/sh
if [ "$(id -u)" != 0 ] ; then
echo This must be run as root!
exit 1
fi
#
# Look for the most comment cases
#
for driver in xhci_hcd ehci_hcd uhci_hcd ; do
#
# The directory to operate within
#
dir=/sys/bus/pci/drivers/${driver}
#
# If it exists we have the appropriate USB-driver
#
if [ -d $dir ]; then
echo "Reseting: ${driver}"
cd ${dir}
for dev_id in ????:??:??.? ; do
printf "${dev_id}" > unbind
printf "${dev_id}" > bind
done
else
echo "Not present: ${driver}"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment