diff mbox series

HID: lenovo: fix Fn-Lock on Lenovo TrackPoint Keyboard II in USB mode

Message ID 20240520000527.203644-1-iam@valdikss.org.ru
State New
Headers show
Series HID: lenovo: fix Fn-Lock on Lenovo TrackPoint Keyboard II in USB mode | expand

Commit Message

ValdikSS May 20, 2024, 12:05 a.m. UTC
When Fn-Lock is pressed on Lenovo TrackPoint Keyboard II in USB mode,
the keyboard only sends the scancode to the host and does not toggle
the mode by itself, contrary to Bluetooth mode.

This results in non-working Fn-Lock switching.

Fix this issue by sending switching command upon receiving Fn-Lock
scancode.

Signed-off-by: ValdikSS <iam@valdikss.org.ru>
Reported-by: Rodrigo Aguilera <rodrigoaguileraparraga@gmail.com>
Tested-by: Rodrigo Aguilera <rodrigoaguileraparraga@gmail.com>
Cc: stable@vger.kernel.org # 6.x
---
 drivers/hid/hid-lenovo.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c
index f86c1ea..a84fc55 100644
--- a/drivers/hid/hid-lenovo.c
+++ b/drivers/hid/hid-lenovo.c
@@ -758,6 +758,13 @@  static int lenovo_event_cptkbd(struct hid_device *hdev,
 		 * ensure things are in sync (the syncing should be a no-op).
 		 */
 		cptkbd_data->fn_lock = !cptkbd_data->fn_lock;
+		if (hdev->product == USB_DEVICE_ID_LENOVO_TPIIUSBKBD) {
+			/*
+			 * ThinkPad TrackPoint keyboard II in USB mode needs
+			 * host to toggle Fn-lock
+			 */
+			lenovo_send_cmd_cptkbd(hdev, 0x05, cptkbd_data->fn_lock);
+		}
 	}
 
 	return 0;