qmk / qmk_firmware

Open-source keyboard firmware for Atmel AVR and Arm USB families
https://qmk.fm
GNU General Public License v2.0
18.34k stars 39.5k forks source link

[Bug] Mouse key feature prevents Windows 10 from entering sleep #8323

Open stbohne opened 4 years ago

stbohne commented 4 years ago

With MOUSEKEY_ENABLE = yes when I press the power button my laptop goes to sleep only to wake up a few seconds later.

Describe the Bug

The Event Log shows for example:

Information 2020/03/06 19:57:18 Kernel-Power 507 (158) System The system is exiting connected standby

Reason: Input Mouse. Information 2020/03/06 19:57:13 Kernel-Power 506 (157) System The system is entering connected standby

Reason: Power Button.

Setting MOUSEKEY_ENABLE = yes seems to fix the issue. Setting MOUSEKEY_ENABLE = no seems to fix the issue.

System Information

Additional Context

yiancar commented 4 years ago

Sorry you are saying you have the issue with : MOUSEKEY_ENABLE = yes and that MOUSEKEY_ENABLE = yes fixes your issue?:)

stbohne commented 4 years ago

MOUSEKEY_ENABLE = no fixes it. But of course then I lose mouse keys.

tzarc commented 4 years ago

Maybe it's something as simple as not sending a report if there's no change?

stbohne commented 4 years ago

I've tracked it down to a call to mousekey_send() in clear_keyboard_but_mods_and_keys() in tmk_core/common/actions.c. Commenting that call out seems to avoid the issue without affecting mousekey functionality.

clear_keyboard_but_mods_and_keys() gets called in all sorts of different situations, so I have no idea what negative effects this has. For example, I noticed that no-op mouse events get sent when the layer is changed.

andrebrait commented 2 years ago

Just chiming in, this is also the case on my Ubuntu laptop

arrowtype commented 9 months ago

I’m also experiencing this on a RP2040-based keyboard, running vial-qmk. When I try to put my computer to sleep, while this keyboard is connected, the computer wakes instantly. I have to put the computer to sleep about 3 times for it to actually work.

Setting MOUSEKEY_ENABLE = no seems to fix the issue.

Same here. This setting, when placed in my QMK keymap’s rules.mk, does workaround the issue. However, that means I can’t use the encoder on the keyboard for scrolling, which is a huge downside.

Is there any other potential solution here?

arrowtype commented 9 months ago

~Oh, actually, if I explicitly set MOUSEKEY_ENABLE = yes, then this issue goes away for me.~

Nevermind; the issue came back after a moment. Maybe it’s something that has to do with actually setting up mouse scroll keys, possibly also on an encoder?

arrowtype commented 9 months ago

Upon further testing, MOUSEKEY_ENABLE seems to have no impact on my Mac sleep function. The problem exists whether or not I use MOUSEKEY_ENABLE. I’m still trying to figure out a pattern, however.

drashna commented 1 month ago

Is this still occurring?

andrebrait commented 1 month ago

I haven't tried again. Will see if I can get the chance to do that the coming days.

arrowtype commented 1 month ago

This still occurs for me on macOS 14.4, with either QMK or ZMK keyboards. My guess is, it’s a general issue of custom keyboards and macOS. I haven’t updated to macOS 15 yet, though, and it is possible it’s been fixed there.