You are not logged in.
Hello there,
I'm currently transitioning my main PC from Windows to Arch. I've used Arch extensively in VMs before, so I never encountered the following issue:
The power button of my PC's chassis does not work from time to time, so I have to resort to my keyboard when it comes to powering on my computer to save myself from opening up the chassis and shorting the power button pins on the board. When I still used a PS/2 Keyboard I could turn it completely off (S5) and the press of a keyboard button would turn it on. Sadly this wasn't possible anymore when I switched to a USB Keyboard, since it was completely ignored in S5. The "solution" was to put my PC in S3 instead of shutting it down completely, since it could then be woken up by my USB Keyboard.
This brought some advantages with it:
Apart from having really really great boot times (my Windows takes some time to cold boot), I became used to coming back to my programs the way I left them before.
Now there's a problem when suspending my Arch installation: It just wakes up after I put it to sleep if I leave my bluetooth adapter plugged in.
On Windows this somehow wasn't a problem, and in the Device Manager you could select if specific devices could wake up the computer IIRC, so the question is, how can I do this on arch / linux in general?
Thanks in Advance
timm0e
EDIT: Found it out!
Here's how you do it:
1. Get the product string of your usb-device (you could also do the same thing with vendor id or something like that, but i guess the product string is the most accurate one).
1. unplug your usb device
2. cd to `/sys/bus/usb/devices`
3. run `grep . */product|cut -d ":" -f 2`
4. plug in your usb device
5. run `grep . */product|cut -d ":" -f 2` again
Now there should be one more line compared to your previous run, that one is the product string of your usb device, so you should write it down (in my case its "CSR8510 A10")
2. Create a systemd-sleep-hook that unbinds your usb device when suspending your computer and rebinds it when you start it again (for un-/binding see https://lwn.net/Articles/143397/)
1. Create a bash script in /usr/lib/systemd/system-sleep/ with the following content (and replace USBNAME with yours):
#!/bin/bash
USBNAME="CSR8510 A10" #REPLACE THIS
cd /sys/bus/usb/devices
USBID=$(grep "$USBNAME" */product | cut -d "/" -f 1)
if [[ $USBID ]];then
if [ "${1}" == "pre" ]; then
echo $USBID > /sys/bus/usb/drivers/usb/unbind
elif [ "${1}" == "post" ]; then
echo $USBID > /sys/bus/usb/drivers/usb/bind
fi
fi2. Mark it as executable
3. Profit!
I hope this comes in handy for someone ![]()
Last edited by timm0e (2018-09-12 15:51:43)
Offline