Last active
December 18, 2022 07:34
-
-
Save elfmimi/0be2c81b95e0ef90698ca0e22a1bc433 to your computer and use it in GitHub Desktop.
Reset Linux USB subsystem without rebooting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# root privilege required | |
if cd /sys/bus/platform/drivers/ehci-platform >& /dev/null; then | |
for dev in *.usb; do | |
echo -n $dev > unbind | |
echo -n $dev > bind | |
done | |
fi | |
if cd /sys/bus/platform/drivers/ohci-platform >& /dev/null; then | |
for dev in *.usb; do | |
echo -n $dev > unbind | |
echo -n $dev > bind | |
done | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# root privilege required | |
if cd /sys/bus/pci/drivers/ehci-pci >& /dev/null; then | |
for dev in 0000:*; do | |
echo -n $dev > unbind | |
echo -n $dev > bind | |
done | |
fi | |
if cd /sys/bus/pci/drivers/ehci_hcd >& /dev/null; then | |
for dev in 0000:*; do | |
echo -n $dev > unbind | |
echo -n $dev > bind | |
done | |
fi | |
if cd /sys/bus/pci/drivers/xhci_hcd >& /dev/null; then | |
for dev in 0000:*; do | |
echo -n $dev > unbind | |
echo -n $dev > bind | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment