diff options
author | Ting Shen <phoenixshen@google.com> | 2021-08-17 17:12:08 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-08-17 12:06:52 +0000 |
commit | c31a5d73bd2159845930c0f1bd0b9edbe2529624 (patch) | |
tree | fb92a366a4cc41148a95ccf733e275f91bff6d12 /chip | |
parent | 388f3cb3fb7b1bf04c5c3b77cb7524179b287269 (diff) | |
download | chrome-ec-c31a5d73bd2159845930c0f1bd0b9edbe2529624.tar.gz |
usb_hid_keyboard: fix incorrect sleep/lock key position
The position of SLEEP_KEY_MASK bit is not in its intended
position because TK_* enum is 1-indexed. Fix this bug by
shift the mask by 1.
BUG=b:196934919
TEST=evtest
BRANCH=trogdor
Signed-off-by: Ting Shen <phoenixshen@google.com>
Change-Id: I900636f032786510f7870948d1856d0bc4374800
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3097478
Reviewed-by: Rong Chang <rongchang@chromium.org>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r-- | chip/stm32/usb_hid_keyboard.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/chip/stm32/usb_hid_keyboard.c b/chip/stm32/usb_hid_keyboard.c index defe39e845..e2a8d675e9 100644 --- a/chip/stm32/usb_hid_keyboard.c +++ b/chip/stm32/usb_hid_keyboard.c @@ -515,7 +515,8 @@ static const struct action_key_config action_key[] = { [TK_MICMUTE] = { .mask = BIT(18), .usage = 0x000B002F }, }; -static const int SLEEP_KEY_MASK = BIT(ARRAY_SIZE(action_key)); +/* TK_* is 1-indexed, so the next bit is at ARRAY_SIZE(action_key) - 1 */ +static const int SLEEP_KEY_MASK = BIT(ARRAY_SIZE(action_key) - 1); #ifdef CONFIG_USB_HID_KEYBOARD_VIVALDI static uint32_t feature_report[CONFIG_USB_HID_KB_NUM_TOP_ROW_KEYS]; |