Last active
August 2, 2022 18:07
-
-
Save FlafyDev/925cb58aaa3e16dad8483e8702e257af to your computer and use it in GitHub Desktop.
shell script to make a usb device be able to wake up from suspend.
This file contains 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
input=$1 | |
dmesg | grep "\[.*\] usb [^:]*: .*$input" | grep -o -P "usb .*?:" | grep -o "[0-9][^:]*" | uniq | while read device; do echo enabled >/sys/bus/usb/devices/$device/power/wakeup; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is how it gets the ids of the device:
input="HyperX"
dmesg | grep "\[.*\] usb [^:]*: .*$input"
dmesg | grep "\[.*\] usb [^:]*: .*HyperX" | grep -o -P "usb .*?:"
dmesg | grep "\[.*\] usb [^:]*: .*HyperX" | grep -o -P "usb .*?:" | grep -o "[0-9][^:]*" | uniq