提交 a0a5c2a6 编写于 作者: V ValdikSS 提交者: Jiri Kosina

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: NFlorian Klink <flokli@flokli.de>
Reviewed-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 24401f29
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册