Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This file contains one of three words: "on", "auto",
- or "suspend". You can write those words to the file
- to change the device's setting.
- "on" means that the device should be resumed and
- autosuspend is not allowed. (Of course, system
- suspends are still allowed.)
- "auto" is the normal state in which the kernel is
- allowed to autosuspend and autoresume the device.
- "suspend" means that the device should remain
- suspended, and autoresume is not allowed. (But remote
- wakeup may still be allowed, since it is controlled
- separately by the power/wakeup attribute.)
- cat /proc/bus/usb/devices
- T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 4 Spd=1.5 MxCh= 0
- D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
- P: Vendor=046d ProdID=c50e Rev=25.10
- S: Manufacturer=Logitech
- S: Product=USB RECEIVER
- C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr= 70mA
- I:* If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=usbhid
- E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=10ms
- T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 4 Spd=1.5 MxCh= 0
- D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
- P: Vendor=046d ProdID=c50e Rev=25.10
- S: Manufacturer=Logitech
- S: Product=USB RECEIVER
- C: #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr= 70mA
- I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=
- E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=10ms
- echo -n "Bus-Rank" > /sys/bus/usb/drivers/usb/unbind
- echo -n "1-2" > /sys/bus/usb/drivers/usb/unbind (in our example)
- echo -n "Bus-Rank" > /sys/bus/usb/drivers/usb/bind
- echo -n "1-2" > /sys/bus/usb/drivers/usb/bind (in our example)
- #!/bin/bash
- USBmouseProduct="USB RECEIVER"
- USBmouseManufacturer="Logitech"
- signal=$1
- nr3=$(awk '/Product='"$USBmouseProduct"'/ {print NR}' /proc/bus/usb/devices)
- nr3=$(expr $nr3 + 0)
- nr2=$(awk '/Manufacturer='"$USBmouseManufacturer"'/ {print NR}' /proc/bus/usb/devices)
- nr2=$(expr $nr2 + 0)
- nr1=$(expr $nr2 - 3)
- nr4=$(expr $nr3 + 1)
- nrdiff=$(expr $nr3 - $nr2)
- [ $nr3 != 0 -a $nr2 != 0 -a $nrdiff = 1 ] && (
- usbmbus0=$(awk 'NR=='$nr1' {print $2}' /proc/bus/usb/devices | awk -F= '{print $2}')
- usbmbus=$(expr $usbmbus0 + 0)
- usbmdev=$(awk 'NR=='$nr1' {print $8}' /proc/bus/usb/devices)
- usbmrank=$(awk 'NR=='$nr1' {print $5}' /proc/bus/usb/devices | awk -F= '{print $2}')
- usbmrank=$(expr $usbmrank + 1)
- usbmbusrank="$usbmbus""-""$usbmrank"
- usbmpower=$(awk 'NR=='$nr4' {if ( $1=="C:" ) {print 0}; if ( $1=="C:*" ) {print 1}}' /proc/bus/usb/devices)
- case $signal in
- off|0)
- [ $usbmpower = 1 ] && echo -n "$usbmbusrank" > /sys/bus/usb/drivers/usb/unbind
- ;;
- on|1)
- [ $usbmpower = 0 ] && echo -n "$usbmbusrank" > /sys/bus/usb/drivers/usb/bind
- ;;
- esac
- )
- echo suspend | sudo tee /sys/bus/usb/devices/usb3/power/level
- sudo lsusb -v|less
- sudo lsusb -t|less
- /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/2p, 480M
- |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/6p, 480M
- |__ Port 1: Dev 3, If 0, Class=hub, Driver=hub/3p, 480M
- |__ Port 1: Dev 6, If 0, Class=HID, Driver=usbhid, 1.5M
- echo '2-1.1.1'|sudo tee /sys/bus/usb/drivers/usb/unbind
- sleep 1
- echo '2-1.1.1'|sudo tee /sys/bus/usb/drivers/usb/bind
Add Comment
Please, Sign In to add comment