OSDN Git Service

HID: apple: Properly handle function keys on Keychron keyboards
authorBryan Cain <bryancain3@gmail.com>
Thu, 5 May 2022 19:12:21 +0000 (13:12 -0600)
committerJiri Kosina <jkosina@suse.cz>
Wed, 11 May 2022 12:21:56 +0000 (14:21 +0200)
commitfa33382c7f74a1444f90f324007da1431d7180b2
tree2121bd106cb7b33713ae262b69b0fce4b253a97e
parent5e206459f670b579da9b7861a0f3ce3b989a68b6
HID: apple: Properly handle function keys on Keychron keyboards

Keychron's C-series and K-series of keyboards copy the vendor and
product IDs of an Apple keyboard, but only behave like that device when
set to "Mac" mode. In "Windows" mode, the Fn key doesn't generate a
scancode, so it's impossible to use the F1-F12 keys when fnmode is set
to its default value of 1.

To fix this, make fnmode default to the new value of 3, which behaves
like fnmode=2 for Keychron keyboards and like fnmode=1 for actual Apple
keyboards. This way, Keychron devices are fully usable in both "Windows"
and "Mac" modes, while behavior is unchanged for everything else.

Signed-off-by: Bryan Cain <bryancain3@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-apple.c