usb restart script

usb restart script

Erez D erez0001 at gmail.com
Wed Nov 21 13:39:34 IST 2012


it may be handy to some people, so here is my usb restart script:


=====  cat /root/scripts/usb_restart ====
#! /bin/bash

echo "please do the following:"

for i in $(lspci|grep "USB controller"|awk '{print $1}') ; do echo echo
"0000:"$i "|" sudo tee /sys/bus/pci/drivers/ehci_hcd/unbind ; echo echo
"0000:"$i "|" sudo tee /sys/bus/pci/drivers/ehci_hcd/bind; done

====================================


this script does not actually do the restart, just tells you what to do, on
my server it is:

please do the following:
echo 0000:00:1a.0 | sudo tee /sys/bus/pci/drivers/ehci_hcd/unbind
echo 0000:00:1a.0 | sudo tee /sys/bus/pci/drivers/ehci_hcd/bind
echo 0000:00:1d.0 | sudo tee /sys/bus/pci/drivers/ehci_hcd/unbind
echo 0000:00:1d.0 | sudo tee /sys/bus/pci/drivers/ehci_hcd/bind
echo 0000:01:00.4 | sudo tee /sys/bus/pci/drivers/ehci_hcd/unbind
echo 0000:01:00.4 | sudo tee /sys/bus/pci/drivers/ehci_hcd/bind



if you want it to really do it, not just tell you what (not tested, may be
a typo):
for i in $(lspci|grep "USB controller"|awk '{print $1}') ; do echo
"0000:"$i | sudo tee /sys/bus/pci/drivers/ehci_hcd/unbind ; echo "0000:"$i
| sudo tee /sys/bus/pci/drivers/ehci_hcd/bind; done
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20121121/5671b7d4/attachment.html>


More information about the Linux-il mailing list