Last active
October 22, 2025 16:17
-
-
Save deckerego/1a8596dd504ef584dd3437ae72eb20f3 to your computer and use it in GitHub Desktop.
Reset all USB NICs at the hardware level
This file contains hidden or 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 | |
| for device in /sys/bus/usb/devices/*; do | |
| grep "NIC" "$device/product" &>/dev/null | |
| if [ "$?" == 0 ]; then | |
| echo -n "Resetting " | |
| cat "$device/product" | |
| sh -c "echo 0 > $device/authorized" | |
| sh -c "echo 1 > $device/authorized" | |
| echo "Device reset." | |
| fi | |
| done |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A wireless interface may go so incredibly sideways that it needs to be "ejected" and "re-added" - here's a way to do this in a script.