#!/bin/sh # # Script to restart the USB subsystem by unloading and reloading the # USB kernel extension which drives the USB system components. # This is useful if you have unresponding USB ports or devices # which are no longer correctly registered in the USB system # after some weird errors happened and you don't feel like restating # your whole machine just for this to be fixed. # if (( $EUID != 0 )); then echo "PLEASE RUN AS ROOT." exit fi echo "" echo "RESTARTING USB SUBSYSTEM NOW..." sleep 2 echo "SHUTDOWN..." sleep 2 # shutting down here echo "TIME: `date`" kextunload -b com.apple.driver.AppleUSBEHCI echo "TIME: `date`" echo "WAITING 20 SECONDS..." sleep 20 echo "RESTART..." # rebooting here echo "TIME: `date`" kextload -b com.apple.driver.AppleUSBEHCI echo "TIME: `date`" echo "DONE" echo ""