diff options
-rwxr-xr-x | usbreset.sh | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/usbreset.sh b/usbreset.sh index b481513..ef4529b 100755 --- a/usbreset.sh +++ b/usbreset.sh @@ -1,7 +1,14 @@ #!/bin/sh -invoke-rc.d hotplug stop -for mod in sd_mod usb-storage scsi_mod uhci ehci-hcd usbcore; do - modprobe -r $mod +# Unload andd then reload USB drivers, to reset to using sda for new stick + +# Try 2.4 and then 2.6 names: uhci/uhci_hcd +usbchain="usbcore ehci-hcd uhci uhci_hcd ohci_hcd scsi_mod usb_storage sd_mod" +usbchain_reverse="$(echo $usbchain | tr '[:space:]' '\n' | tac -)" + +for module in $usbchain_reverse; do + modprobe -q -r $module || true +done +for module in $usbchain; do + modprobe -q $module || true done -invoke-rc.d hotplug start |