From d4ecd8a79aaaa29d983059ed92868721bf5f995c Mon Sep 17 00:00:00 2001 From: Tim Crawford Date: Sun, 4 Jun 2023 10:01:43 -0600 Subject: [PATCH] kbscan: Remove comparing matrix to keymap Remove checking against the real keys declared in the keymap. It appears to have no effect on behavior. Signed-off-by: Tim Crawford --- src/board/system76/common/kbscan.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/src/board/system76/common/kbscan.c b/src/board/system76/common/kbscan.c index e5e43ce37..aac15fa51 100644 --- a/src/board/system76/common/kbscan.c +++ b/src/board/system76/common/kbscan.c @@ -103,26 +103,10 @@ static inline bool popcount_more_than_one(uint8_t rowdata) { return rowdata & (rowdata - 1); } -static uint8_t kbscan_get_real_keys(uint8_t row, uint8_t rowdata) { - // Remove any "active" blanks from the matrix. - uint8_t realdata = 0; - for (uint8_t col = 0; col < KM_IN; col++) { - // This tests the default keymap intentionally, to avoid blanks in the - // dynamic keymap - if (KEYMAP[0][row][col] && (rowdata & BIT(col))) { - realdata |= BIT(col); - } - } - - return realdata; -} - static bool kbscan_row_has_ghost(uint8_t *matrix, uint8_t col) { uint8_t rowdata = matrix[col]; - rowdata = kbscan_get_real_keys(col, matrix[col]); - - // No ghosts exist when less than 2 keys in the row are active. + // No ghosts exist when less than 2 keys in the row are active. if (!popcount_more_than_one(rowdata)) { return false; } @@ -133,8 +117,7 @@ static bool kbscan_row_has_ghost(uint8_t *matrix, uint8_t col) { continue; } - uint8_t otherrow = kbscan_get_real_keys(i, matrix[i]); - uint8_t common = rowdata & otherrow; + uint8_t common = rowdata & matrix[i]; if (popcount_more_than_one(common)) { return true; }