SUMMARY I'm on Kubuntu 22.04, but this is an issue for years. When I close the lid of my laptop, currently a Lenovo Thinkbook, previously a Lenovo Thinkpad, the laptop goes into sleep. However any slight move of the wireless mouse does wake-up the computer, resulting in draining the battery. This behavior is annoying by itself, however it is getting worse since the battery of the laptop is drained to zero because the (default) power options are not taken into account (Suspend session automatically after 10 minutes on battery). Currently I have a simple Logitech wireless mouse M185, but the issue was the same with other wireless Logitech mouses the last 10 years. I just want an option to choose if the the mouse can wake-up the computer, like on Windows. And I prefer to have this option by default OFF. For some background information see also the discussion below https://askubuntu.com/questions/252743/how-do-i-prevent-mouse-movement-from-waking-up-a-suspended-computer STEPS TO REPRODUCE Close the lid of the laptop → the laptop goes to sleep Move the mouse → the laptop wakes up while closed, and drains the battery till zero.
Can reproduce with a wired mouse too. Yeah we should make external input devices not wake a laptop with its lid closed.
This is not a bug of plasma or powerdevil, this is an intended behaviour of linux kernel drivers and acpi, and while we wait for kde team to create some control options to change this behaviour, you can do the following steps to fix: 1) sudo apt install powertop 2) in terminal, run powertop and go to its last tab 'wake up' (navigate with tab key). in this tab you can control individual usb devices to be able to wake up the laptop or not. unfortunately this settings will not be saved after reboot.
Darn. It sounds like any fix might need to be made at a level below us. I guess we could maybe to this in a KDED module but it seems a bit like scope creep.
@wbqq: I get your point, but if these settings are not saved after reboot it is quite useless for a regular user, so I still consider this as a bug.
(In reply to Nate Graham from comment #3) What about just some additional settings to powerdevil kcm, using kdesu or polkit for writing into /proc/acpi/wakeup and /usr/share/polkit/actions for applying on login without asking for password? I mean look at how this guy gets this done: https://github.com/frankenfruity/plasma-pstate Or does powerdevil already have root permission cuz it can change backlight level? I see it as a little checkbox in systemsettings->Power Management that says "dont wake up from sleep when mouse moved" or something like that. I know what u think about infinite amount of checkboxes everywhere but its better than users adding random things to their rc.local like http://www.das-werkstatt.com/forum/werkstatt/viewtopic.php?f=7&t=1985
We could do it since powerdevil has root privileges, but it would need to be done on every boot, not just once, which means it would need to be in a KDED module. Which is possible and does make some sense IMO, and that's why this feature request is open. :)
A possibly relevant merge request was started @ https://invent.kde.org/plasma/powerdevil/-/merge_requests/279
(In reply to Bug Janitor Service from comment #7) > A possibly relevant merge request was started @ > https://invent.kde.org/plasma/powerdevil/-/merge_requests/279 If I understand correctly, it will wake up each time when mouse moves, check if the reason of waking up is the mouse and sleep again if the lid is still closed, am I right? So basically if I carry my laptop and a mouse in a bag with a lot of other things and something is constantly pressing mouse buttons, the laptop will repeatedly wake up and sleep? Also suspending is still a pretty hard thing to do on modern laptops with nvidia graphics cards, mine usually takes about 10-15 seconds before its fully suspended and sometimes it won't even suspend at all so the fact of sleeping must be verified manually. Like mentioned earlier, linux kernel has its own way to enable\disable waking on certain usb devices, so plasma's input devices manager could monitor if a new mouse is connected and then powerdevil could request the kernel to disable this mouse when suspended. Maybe even some cute little settings window with all of the usb mouses\keyboards listed and checkboxes for whether it should be able to wake the laptop up. Sorry if I misunderstand something, I'm not a developer, I'm just an armchair critic you know. I just would like to know if I'm wrong and this merge request is actually a good thing even for nvidia users.
No, you understood correctly, and your concerns are valid. I wonder if we can be smarter about when to send the system back to sleep, eg waiting at least 15 minutes or so until we try again to avoid too frequent sleep/wake changes in a situation like you describe. But maybe it's better to have this behavior as an opt-in in any case..
I think Natalie's commit would basically solve my problem since my laptop with mouse is only moved occasionally when the lid is closed. It will not solve wbqq's use case I think where laptop and mouse are carried in a bag; since the mouse has a highly sensitive optical sensor I expect the mouse will detect any movement instantly, thereby waking up the laptop. (In reply to wbqq from comment #8) > Like mentioned earlier, linux kernel has its own way to enable\disable > waking on certain usb devices, so plasma's input devices manager could > monitor if a new mouse is connected and then powerdevil could request the > kernel to disable this mouse when suspended. Maybe even some cute little > settings window with all of the usb mouses\keyboards listed and checkboxes > for whether it should be able to wake the laptop up. This would be the preferred solution for the problem, if possible.
(In reply to Jeroen from comment #10) > This would be the preferred solution for the problem, if possible. ok so i guess i can try to do a little tool for those who's interested, although i'm still not a developer so idk what am i doing, any help appreciated https://github.com/MioNya4/usb-wakeup-conf
Maybe I am missing something really obvious here, but wouldn't installing udev rules [1] provided a persistent and reliable solution to block certain devices from waking the system? [1] https://wiki.archlinux.org/title/Power_management/Wakeup_triggers#Event-driven_with_udev