Wakeup from suspend (Trackpad/Mouse/Keyboard)

But mind you of me asking: do you have that Logitech mouse as mentioned in wiki or you simply copy and paste what was there?
Nevermind. Found what i was looking for :wink:
BRB

lsusb result is in the first post under useful info?:

You found it

Lets try to make that rule for keyboard, as i guess your mouse is wireless and it might need a different approach, aka a different id. Provide:
grep c24d /sys/bus/usb/devices/*/idProduct

Little bit weird, but it is not returning anything... If I do 0a4d (the headphone) it works tho

[rogerhfcheng@rogerlinux ~]$ grep c24b /sys/bus/usb/devices/*/idProduct
[rogerhfcheng@rogerlinux ~]$ grep c24b /sys/bus/usb/devices/*/idProduct
[rogerhfcheng@rogerlinux ~]$ grep c24b /sys/bus/usb/devices/*/idProduct
[rogerhfcheng@rogerlinux ~]$ grep 0a4d /sys/bus/usb/devices/*/idProduct
/sys/bus/usb/devices/3-1.3/idProduct:0a4d

I wrote a systemd service to enable my mouse and keyboard to wake from suspend a week or two ago. I will post you the link. I use the same Logitech unified receiver so I'm pretty sure it should work for you if you can't get the udev rule working.

Here it is:

2 Likes

Under [Service]
Do I have to change devices and usb?

I originally wrote it using my individual device bus ID address. Then I figured that's not quite good enough in case you change your USB port the device is plugged into. So I added all my USB buses to the service as well, just to cover all the bases.

You could probably forget about the individual bus addresses, and just do the blanket coverage of all buses. You must check how many buses you have, and change it to your amount of bus numbers accordingly.

1 Like

Sorry, maybe a bit noob here, but how do I check the amount of bus number?

Also, I tried to restart the computer and run the service. It did not work (without changing the bus and address)

I think you will solve it with @tbg service, but just in case, here is a different approach
http://bijan.binaee.com/index.php/2016/10/12/enable-wake-up-on-keyboardmouse-on-arch-linux/

2 Likes

Just to let you know, I'm not at my Linux computer. I'm only on my phone. My memory is far from perfect. I would expect you should find all your USB buses listed in

/sys/bus/usb/devices/

Did you check the services status?

Please post the output:

systemctl status usb-wakeup.service
[rogerhfcheng@rogerlinux ~]$ systemctl status usb-wakeup.service
● usb-wakeup.service - Enables USB wakeup on all ports
   Loaded: loaded (/etc/systemd/system/usb-wakeup.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2019-04-17 17:06:44 AEST; 12min ago
 Main PID: 421 (code=exited, status=1/FAILURE)

Apr 17 17:06:44 rogerlinux systemd[1]: Starting Enables USB wakeup on all ports...
Apr 17 17:06:44 rogerlinux sh[421]: /usr/bin/sh: /sys/bus/usb/devices/7-2/power/wakeup: No such file or directory
Apr 17 17:06:44 rogerlinux systemd[1]: usb-wakeup.service: Main process exited, code=exited, status=1/FAILURE
Apr 17 17:06:44 rogerlinux systemd[1]: usb-wakeup.service: Failed with result 'exit-code'.
Apr 17 17:06:44 rogerlinux systemd[1]: Failed to start Enables USB wakeup on all ports.

The service is failing because your devices are not at the same port address as mine. Remove the individual port entries, and only use the Bus Address entries. You need to alter the bus entries to reflect only the amount of USB buses your machine actually has.

Cool, changed. Still didnt work, I will try restarting my computer and try again
(in /sys/bus/usb/devices/ I have it shows I have usb1 and usb2 only

[rogerhfcheng@rogerlinux ~]$ cat /etc/systemd/system/usb-wakeup.service
#/etc/systemd/system/usb-wakeup.service
#sudo systemctl enable usb-wakeup.service
#sudo systemctl start usb-wakeup.service
#sudo systemctl stop usb-wakeup.service
#sudo systemctl disable usb-wakeup.service
#systemctl status usb-wakeup.service
#sudo systemctl daemon-reload

[Unit]
Description=Enables USB wakeup on all ports

[Service]
Type=oneshot
ExecStart=/usr/bin/sh -c 'echo "enabled" > /sys/bus/usb/devices/usb1/power/wakeup'
ExecStart=/usr/bin/sh -c 'echo "enabled" > /sys/bus/usb/devices/usb2/power/wakeup'

[Install]
WantedBy=multi-user.target


[rogerhfcheng@rogerlinux ~]$ systemctl status usb-wakeup.service
● usb-wakeup.service - Enables USB wakeup on all ports
   Loaded: loaded (/etc/systemd/system/usb-wakeup.service; enabled; vendor pres>
   Active: inactive (dead) since Wed 2019-04-17 17:26:16 AEST; 1min 1s ago
 Main PID: 414 (code=exited, status=0/SUCCESS)

Apr 17 17:26:16 rogerlinux systemd[1]: Starting Enables USB wakeup on all ports>
Apr 17 17:26:16 rogerlinux systemd[1]: usb-wakeup.service: Succeeded.
Apr 17 17:26:16 rogerlinux systemd[1]: Started Enables USB wakeup on all ports.

Restarted and try, did not work

Edit:
if this helps

[rogerhfcheng@rogerlinux ~]$ ls /sys/bus/usb/devices/ 
1-0:1.0  1-1:1.0    1-1.1:1.2  1-3      1-5      2-0:1.0  usb1
1-1      1-1.1:1.0  1-1.2      1-3:1.0  1-5:1.0  2-1      usb2
1-1.1    1-1.1:1.1  1-1.2:1.0  1-3:1.1  1-5:1.1  2-1:1.0

I'm sorry from memory I can't recall exactly which directories or which commands will identify your busses or individual bus addresses. When I get home and have access to my Linux box I can easily figure all that out. Unfortunately, I may not be home until after the weekend. So you may just have to do some research on your own.

I will do some research myself for the time being, if I havent got it sorted after the weekend, can I tag/reply to you on this post again? :slight_smile:
Much appreicated regardless.

Sure, you can but I think you'll figure it out. It's not that hard. You already know the vendor and product ID of your unified receiver. The bus address is Bus 03, Device 03.

Try using only this line and see what happens:

ExecStart=/usr/bin/sh -c 'echo "enabled" > /sys/bus/usb/devices/3-3/power/wakeup'

my mouse is 046d:c52b, external keyboard is 046d:c24d

Simply look for their bus address with the lsusb command.

I'm not sure if you can use the same method for your track pad. If your trackpad is listed in the lsusb command with a bus address then simply add that Adress as well. I'm not a laptop guy, so I can't say if this will work on laptop trackpads.

Maybe using the naming from
ls /sys/bus/usb/drivers/usb/
to /sys/bus/usb/devices/ for the ExecStart thing ?

Without being on one of my Linux boxes I can't say with certainty. It is all doable with a little experimentation though for sure.

Here is more information I've posted in the past on how to locate your devices correct USB bus address:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by Bytemark