qmk_firmware icon indicating copy to clipboard operation
qmk_firmware copied to clipboard

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

Open stbohne opened this issue 5 years ago • 10 comments

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

  • Keyboard: Kyria Rev 1.1, Viterbi Rev 1.0
  • Operating system: Windows 10 Pro build 18363
  • AVR GCC version: avr-gcc.exe (GCC) 8.3.0
  • ARM GCC version: arm-none-eabi-gcc.exe (GNU Tools for Arm Embedded Processors 8-2019-q3-update) 8.3.1 20190703 (release) [gcc-8-branch revision 273027]
  • QMK Firmware version: 0.6.190
  • Any keyboard related software installed?
    • [ ] AutoHotKey
    • [ ] Karabiner
    • [ ] Other:

Additional Context

stbohne avatar Mar 06 '20 11:03 stbohne

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

yiancar avatar Mar 06 '20 11:03 yiancar

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

stbohne avatar Mar 07 '20 06:03 stbohne

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

tzarc avatar Mar 10 '20 04:03 tzarc

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.

stbohne avatar Mar 27 '20 03:03 stbohne

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

andrebrait avatar Jan 20 '22 13:01 andrebrait

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 avatar Jan 30 '24 18:01 arrowtype

~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 avatar Jan 31 '24 15:01 arrowtype

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.

arrowtype avatar Feb 04 '24 18:02 arrowtype

Is this still occurring?

drashna avatar Oct 13 '24 00:10 drashna

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

andrebrait avatar Oct 14 '24 10:10 andrebrait

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.

arrowtype avatar Oct 15 '24 15:10 arrowtype