diff mbox series

HID: apple: Properly handle function keys on misset non-apple keyboards

Message ID 20220530094215.646432cd@ultrarare.space (mailing list archive)
State New, archived
Delegated to: Jiri Kosina
Headers show
Series HID: apple: Properly handle function keys on misset non-apple keyboards | expand

Commit Message

Hilton Chain May 30, 2022, 1:42 a.m. UTC
This commit extends fa33382c7f74 ("HID: apple: Properly handle function
keys on Keychron keyboards") to support all misset non-apple keyboards.

Signed-off-by: Hilton Chain <hako@ultrarare.space>
---

 drivers/hid/hid-apple.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)


base-commit: b00ed48bb0a7c295facf9036135a573a5cdbe7de
--
2.36.1
diff mbox series

Patch

diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index 42a568902f49..3b15753be467 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -36,7 +36,7 @@ 
 #define APPLE_NUMLOCK_EMULATION	BIT(8)
 #define APPLE_RDESC_BATTERY	BIT(9)
 #define APPLE_BACKLIGHT_CTL	BIT(10)
-#define APPLE_IS_KEYCHRON	BIT(11)
+#define APPLE_IS_BAD_APPLE	BIT(11)

 #define APPLE_FLAG_FKEY		0x01

@@ -363,7 +363,7 @@  static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
 	}

 	if (fnmode == 3) {
-		real_fnmode = (asc->quirks & APPLE_IS_KEYCHRON) ? 2 : 1;
+		real_fnmode = (asc->quirks & APPLE_IS_BAD_APPLE) ? 2 : 1;
 	} else {
 		real_fnmode = fnmode;
 	}
@@ -669,9 +669,9 @@  static int apple_input_configured(struct hid_device *hdev,
 		asc->quirks &= ~APPLE_HAS_FN;
 	}

-	if (strncmp(hdev->name, "Keychron", 8) == 0) {
-		hid_info(hdev, "Keychron keyboard detected; function keys will default to fnmode=2 behavior\n");
-		asc->quirks |= APPLE_IS_KEYCHRON;
+	if (strncmp(hdev->name, "Apple", 5)) {
+		hid_info(hdev, "Non-apple keyboard detected; function keys will default to fnmode=2 behavior\n");
+		asc->quirks |= APPLE_IS_BAD_APPLE;
 	}

 	return 0;