qmk / qmk_firmware

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

[Bug] KBO-5000 prevents Windows 10 machine from sleep #13295

Open HenryHu opened 3 years ago

HenryHu commented 3 years ago

Describe the Bug

Somehow the KBO-5000 keyboard prevents Windows 10 machine from sleep. I'm running a locally compiled qmk firmware.

System Information

Additional Context

I've read issue #375, which describes a similar issue. I tried a similar approach (return false directly in suspend_wakeup_condition()), and interestingly this fixed the issue (of course, you can't wake-up with the keyboard, too).

I wonder what would be the next step to diagnose this issue.

HenryHu commented 3 years ago

I tried to play with that method, and do a key counting there. If I change it to this:

int count = 0;
for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
    for (uint8_t c = 0; c < MATRIX_COLS; c++) {
        if (matrix_is_on(r, c)) ++count;
    }
}
return count >= 13;

i.e., requires at least 13 keys to wake up, then I can wake up the machine with 1 key press. It seems like that somehow 12 keys are reported as on, even if they're not pressed?

HenryHu commented 3 years ago

Okay, as mentioned in https://beta.docs.qmk.fm/using-qmk/hardware-features/feature_split_keyboard#handedness-by-matrix-pin, we need to define MATRIX_MASKED, and define matrix_mask as

const matrix_row_t matrix_mask[MATRIX_ROWS] = { 0xFDFD, 0xFDFD, 0xFDFD, 0xFDFD, 0xFDFD, 0xFDFD, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, };

then the problem is resolved.