aboutsummaryrefslogtreecommitdiffstats
path: root/main/linux-vanilla/0001-HID-apple-fix-Fn-key-Magic-Keyboard-on-bluetooth.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/linux-vanilla/0001-HID-apple-fix-Fn-key-Magic-Keyboard-on-bluetooth.patch')
-rw-r--r--main/linux-vanilla/0001-HID-apple-fix-Fn-key-Magic-Keyboard-on-bluetooth.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/main/linux-vanilla/0001-HID-apple-fix-Fn-key-Magic-Keyboard-on-bluetooth.patch b/main/linux-vanilla/0001-HID-apple-fix-Fn-key-Magic-Keyboard-on-bluetooth.patch
new file mode 100644
index 0000000000..ec2a1dd2c5
--- /dev/null
+++ b/main/linux-vanilla/0001-HID-apple-fix-Fn-key-Magic-Keyboard-on-bluetooth.patch
@@ -0,0 +1,67 @@
+From 0a802b5595bc6769a8984ad83662204db79c5e31 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Mon, 4 Sep 2017 19:44:18 +0000
+Subject: [PATCH] HID: apple: fix Fn key Magic Keyboard on bluetooth
+
+The vendor id is 0x004c, when Magic Keyboard is connected via bluetooth.
+This appears to be the bluetooth fendor id for Apple.
+
+We also need to check against HID_UP_MSVENDOR to get the Fn key working
+properly.
+
+Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
+---
+ drivers/hid/hid-apple.c | 4 +++-
+ drivers/hid/hid-core.c | 1 +
+ drivers/hid/hid-ids.h | 1 +
+ 3 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
+index 25b7bd56ae11..c79dbf836925 100644
+--- a/drivers/hid/hid-apple.c
++++ b/drivers/hid/hid-apple.c
+@@ -335,7 +335,7 @@ static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi,
+ struct hid_field *field, struct hid_usage *usage,
+ unsigned long **bit, int *max)
+ {
+- if (usage->hid == (HID_UP_CUSTOM | 0x0003)) {
++ if (usage->hid == (HID_UP_CUSTOM | 0x0003) || usage->hid == (HID_UP_MSVENDOR | 0x0003)) {
+ /* The fn key on Apple USB keyboards */
+ set_bit(EV_REP, hi->input->evbit);
+ hid_map_usage_clear(hi, usage, bit, max, EV_KEY, KEY_FN);
+@@ -472,6 +472,8 @@ static const struct hid_device_id apple_devices[] = {
+ .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI),
+ .driver_data = APPLE_HAS_FN },
++ { HID_BLUETOOTH_DEVICE(BLUETOOTH_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI),
++ .driver_data = APPLE_HAS_FN },
+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI),
+ .driver_data = APPLE_HAS_FN },
+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO),
+diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
+index 9017dcc14502..36e43986f415 100644
+--- a/drivers/hid/hid-core.c
++++ b/drivers/hid/hid-core.c
+@@ -1964,6 +1964,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO) },
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI) },
++ { HID_BLUETOOTH_DEVICE(BLUETOOTH_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
+ #endif
+diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
+index c9ba4c6db74c..3f654444c011 100644
+--- a/drivers/hid/hid-ids.h
++++ b/drivers/hid/hid-ids.h
+@@ -85,6 +85,7 @@
+ #define USB_DEVICE_ID_ANTON_TOUCH_PAD 0x3101
+
+ #define USB_VENDOR_ID_APPLE 0x05ac
++#define BLUETOOTH_VENDOR_ID_APPLE 0x004c
+ #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304
+ #define USB_DEVICE_ID_APPLE_MAGICMOUSE 0x030d
+ #define USB_DEVICE_ID_APPLE_MAGICTRACKPAD 0x030e
+--
+2.14.1
+