Skip to content

Commit

Permalink
linux-kernel: hid-lenovo: detect false-positives
Browse files Browse the repository at this point in the history
This patch allows the workaround to work again when wheel signals
are detected after identifying the keyboard as bug-free. False
positives happen when the middle button is released while the
kernel doesn't see it.
  • Loading branch information
chenx97 committed Jan 4, 2024
1 parent fab074b commit d76a295
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 5 deletions.
2 changes: 1 addition & 1 deletion runtime-kernel/linux-kernel/autobuild/amd64/config
Original file line number Diff line number Diff line change
Expand Up @@ -6458,7 +6458,7 @@ CONFIG_PAGE_SIZE_LESS_THAN_64KB=y
CONFIG_PAGE_TABLE_ISOLATION=y
CONFIG_PAHOLE_HAS_LANG_EXCLUDE=y
CONFIG_PAHOLE_HAS_SPLIT_BTF=y
CONFIG_PAHOLE_VERSION=124
CONFIG_PAHOLE_VERSION=125
CONFIG_PALMAS_GPADC=m
CONFIG_PANASONIC_LAPTOP=m
# CONFIG_PANEL_CHANGE_MESSAGE is not set
Expand Down
2 changes: 1 addition & 1 deletion runtime-kernel/linux-kernel/autobuild/arm64/config
Original file line number Diff line number Diff line change
Expand Up @@ -7028,7 +7028,7 @@ CONFIG_PAGE_SIZE_LESS_THAN_64KB=y
# CONFIG_PAGE_TABLE_CHECK is not set
CONFIG_PAHOLE_HAS_LANG_EXCLUDE=y
CONFIG_PAHOLE_HAS_SPLIT_BTF=y
CONFIG_PAHOLE_VERSION=124
CONFIG_PAHOLE_VERSION=125
CONFIG_PALMAS_GPADC=m
# CONFIG_PANEL_CHANGE_MESSAGE is not set
CONFIG_PANEL=m
Expand Down
2 changes: 1 addition & 1 deletion runtime-kernel/linux-kernel/autobuild/mips64r6el/config
Original file line number Diff line number Diff line change
Expand Up @@ -2321,7 +2321,7 @@ CONFIG_PAGE_SIZE_16KB=y
# CONFIG_PAGE_SIZE_64KB is not set
CONFIG_PAGE_SIZE_LESS_THAN_256KB=y
CONFIG_PAGE_SIZE_LESS_THAN_64KB=y
CONFIG_PAHOLE_VERSION=124
CONFIG_PAHOLE_VERSION=125
# CONFIG_PANIC_ON_OOPS is not set
CONFIG_PANIC_ON_OOPS_VALUE=0
CONFIG_PANIC_TIMEOUT=0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
From f075ddc9ed7ce3cc5aa83df98442f71d51fa1688 Mon Sep 17 00:00:00 2001
From: Henry Chen <[email protected]>
Date: Thu, 4 Jan 2024 00:05:49 -0500
Subject: [PATCH] hid-lenovo: detect false-positives

This patch allows the workaround to work again when wheel signals
are detected after identifying the keyboard as bug-free. False
positives happen when the middle button is released while the
kernel doesn't see it.
---
drivers/hid/hid-lenovo.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c
index 149a3c74346b..2db6f85cb4a1 100644
--- a/drivers/hid/hid-lenovo.c
+++ b/drivers/hid/hid-lenovo.c
@@ -686,7 +686,8 @@ static int lenovo_event_cptkbd(struct hid_device *hdev,
{
struct lenovo_drvdata *cptkbd_data = hid_get_drvdata(hdev);

- if (cptkbd_data->middlebutton_state != 3) {
+ if (cptkbd_data->middlebutton_state != 3 ||
+ (usage->code == REL_WHEEL || usage->code == REL_HWHEEL)) {
/* REL_X and REL_Y events during middle button pressed
* are only possible on patched, bug-free firmware
* so set middlebutton_state to 3
--
2.39.1

2 changes: 1 addition & 1 deletion runtime-kernel/linux-kernel/autobuild/ppc64el/config
Original file line number Diff line number Diff line change
Expand Up @@ -5605,7 +5605,7 @@ CONFIG_PAGE_SIZE_64KB=y
CONFIG_PAGE_SIZE_LESS_THAN_256KB=y
CONFIG_PAHOLE_HAS_LANG_EXCLUDE=y
CONFIG_PAHOLE_HAS_SPLIT_BTF=y
CONFIG_PAHOLE_VERSION=124
CONFIG_PAHOLE_VERSION=125
CONFIG_PALMAS_GPADC=m
# CONFIG_PANEL_CHANGE_MESSAGE is not set
CONFIG_PANEL=m
Expand Down
2 changes: 1 addition & 1 deletion runtime-kernel/linux-kernel/autobuild/riscv64/config
Original file line number Diff line number Diff line change
Expand Up @@ -4150,7 +4150,7 @@ CONFIG_PAGE_SIZE_LESS_THAN_256KB=y
CONFIG_PAGE_SIZE_LESS_THAN_64KB=y
CONFIG_PAHOLE_HAS_LANG_EXCLUDE=y
CONFIG_PAHOLE_HAS_SPLIT_BTF=y
CONFIG_PAHOLE_VERSION=124
CONFIG_PAHOLE_VERSION=125
# CONFIG_PANEL_CHANGE_MESSAGE is not set
# CONFIG_PANIC_ON_OOPS is not set
CONFIG_PANIC_ON_OOPS_VALUE=0
Expand Down
1 change: 1 addition & 0 deletions runtime-kernel/linux-kernel/spec
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
VER=6.6.8
REL=1
# RC=
# Use this for RC releases.
#SRCS="tbl::https://git.kernel.org/torvalds/t/linux-${VER%%.0}-rc${RC}.tar.gz"
Expand Down

0 comments on commit d76a295

Please sign in to comment.