HID: lenovo: Sync Fn-lock state on button press for Compact and TrackPoint II keyboards
[linux-2.6-microblaze.git] / drivers / hid / hid-lenovo.c
index a612ae7..e9466ae 100644 (file)
@@ -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;
 }