diff options
author | ValdikSS <iam@valdikss.org.ru> | 2022-02-14 00:49:23 +0300 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2022-05-02 18:49:44 +0300 |
commit | a0a5c2a696990520eba366fae67573306641b93b (patch) | |
tree | d5d309a431c755687b8a717c787781d8320057df /drivers/hid | |
parent | 24401f291dcc4f2c18b9e2f65763cbaadc7a1528 (diff) | |
download | linux-a0a5c2a696990520eba366fae67573306641b93b.tar.xz |
HID: lenovo: Sync Fn-lock state on button press for Compact and TrackPoint II keyboards
When Fn-Esc is pressed on the keyboard, it emits the scancode which could
be used to sync the fn_lock sysfs state.
Previously fn_lock only allowed to set new Fn-lock state and did not
keep the value in sync upon Fn-Esc press, which is now fixed.
Signed-off-by: Florian Klink <flokli@flokli.de>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-lenovo.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c index a612ae7dfbfc..e9466ae8a9cb 100644 --- a/drivers/hid/hid-lenovo.c +++ b/drivers/hid/hid-lenovo.c @@ -690,6 +690,15 @@ static int lenovo_event_cptkbd(struct hid_device *hdev, return 1; } + if (usage->type == EV_KEY && usage->code == KEY_FN_ESC && value == 1) { + /* + * The user has toggled the Fn-lock state. Toggle our own + * cached value of it and sync our value to the keyboard to + * ensure things are in sync (the syncing should be a no-op). + */ + cptkbd_data->fn_lock = !cptkbd_data->fn_lock; + } + return 0; } |