Bug 69681 - [PATCH] HID: Add Apple wireless keyboard 2011 JIS model support
Summary: [PATCH] HID: Add Apple wireless keyboard 2011 JIS model support
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Input Devices (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: drivers_input-devices
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-29 16:56 UTC by Huei-Horng Yo
Modified: 2016-09-14 01:57 UTC (History)
4 users (show)

See Also:
Kernel Version: 3.14-rc1, 3.12.9
Subsystem:
Regression: No
Bisected commit-id:


Attachments
Apple wireless keyboard 2011 (JIS) FN key bug patch (2.31 KB, patch)
2014-01-29 16:56 UTC, Huei-Horng Yo
Details | Diff
Add support for Apple wireless keyboard 2011 JIS model (2.41 KB, patch)
2014-02-03 11:38 UTC, Huei-Horng Yo
Details | Diff
Add Apple wireless keyboard 2011 JIS model support (mainline) (2.47 KB, patch)
2014-02-04 04:18 UTC, Huei-Horng Yo
Details | Diff
HID: Add Apple wireless keyboard 2011 JIS model support. (2.48 KB, patch)
2014-02-04 06:51 UTC, Huei-Horng Yo
Details | Diff

Description Huei-Horng Yo 2014-01-29 16:56:43 UTC
Created attachment 123791 [details]
Apple wireless keyboard 2011 (JIS) FN key bug patch

Be like bug #43135 but for the JIS model keyboard. FN key will be enabled successfully (e.g. press FN + Down-Arrow will do Page Down) after applying the patch in the below attachment.

Thanks,

Huei-Hoeng Yo
Comment 1 Huei-Horng Yo 2014-01-30 00:21:26 UTC
Signed-off-by: Huei-Horng Yo <hiroshi@ghostsinthelab.org>
diff -ruN linux-3.12.orig/drivers/hid/hid-apple.c linux-3.12/drivers/hid/hid-apple.c
--- linux-3.12.orig/drivers/hid/hid-apple.c     2014-01-29 22:32:39.867647547 +0800
+++ linux-3.12/drivers/hid/hid-apple.c  2014-01-29 22:36:57.391920660 +0800
@@ -469,6 +469,9 @@
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
                                USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI),
                .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
+       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
+                               USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS),
+               .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS),
                .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI),
diff -ruN linux-3.12.orig/drivers/hid/hid-core.c linux-3.12/drivers/hid/hid-core.c
--- linux-3.12.orig/drivers/hid/hid-core.c      2014-01-29 22:32:39.867647547 +0800
+++ linux-3.12/drivers/hid/hid-core.c   2014-01-29 22:36:17.284515419 +0800
@@ -1681,6 +1681,7 @@
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI) },
        { 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_FOUNTAIN_TP_ONLY) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
        { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) },
diff -ruN linux-3.12.orig/drivers/hid/hid-ids.h linux-3.12/drivers/hid/hid-ids.h
--- linux-3.12.orig/drivers/hid/hid-ids.h       2014-01-29 22:32:39.867647547 +0800
+++ linux-3.12/drivers/hid/hid-ids.h    2014-01-29 22:33:54.892105604 +0800
@@ -135,6 +135,7 @@
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS   0x023b
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI  0x0255
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO   0x0256
+#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS   0x0257
 #define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI   0x0290
 #define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO    0x0291
 #define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS    0x0292
Comment 2 Huei-Horng Yo 2014-01-30 08:40:26 UTC
CC Jiri Kosina
Comment 3 Alan 2014-02-03 10:42:48 UTC
(See Documentation/SubmittingPatches)
Comment 4 Huei-Horng Yo 2014-02-03 11:16:52 UTC
@Alan

Sorry for my any rudely bug-reporting.

What my patch mainly does is to add support for Apple wireless keyboard 2011 JIS model.

Before applying this patch, the keyboard behaves like a general keyboard, its 'fn' key has no function to be used with arrow keys to do Home, End, Page Up and Page Down. I found that this is because the HID IDs list hasn't it in vendor ID: 0x05ac (APPLE) section, so I add the production ID 0x0257 (got the value by using bluetoothctl) in drivers/hid/hid-ids.h and add the corresponding codes in drivers/hid/hid-apple.c & drivers/hid/hid-core.c. 
 
Here is an updated "diff -uprN" patch:

apple-alu-wireless-kbd-jis.patch

Signed-off-by: Huei-Horng Yo <hiroshi@ghostsinthelab.org>
diff -uprN linux-3.12.vanilla/drivers/hid/hid-apple.c linux-3.12/drivers/hid/hid-apple.c
--- linux-3.12.vanilla/drivers/hid/hid-apple.c  2013-11-04 07:41:51.000000000 +0800
+++ linux-3.12/drivers/hid/hid-apple.c  2014-02-01 01:15:37.532768035 +0800
@@ -447,6 +447,9 @@ static const struct hid_device_id apple_
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
                                USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI),
                .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
+       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
+                               USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS),
+               .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS),
                .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI),
diff -uprN linux-3.12.vanilla/drivers/hid/hid-core.c linux-3.12/drivers/hid/hid-core.c
--- linux-3.12.vanilla/drivers/hid/hid-core.c   2013-11-04 07:41:51.000000000 +0800
+++ linux-3.12/drivers/hid/hid-core.c   2014-02-01 01:15:37.532768035 +0800
@@ -1680,6 +1680,7 @@ static const struct hid_device_id hid_ha
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI) },
        { 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_FOUNTAIN_TP_ONLY) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
        { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) },
diff -uprN linux-3.12.vanilla/drivers/hid/hid-ids.h linux-3.12/drivers/hid/hid-ids.h
--- linux-3.12.vanilla/drivers/hid/hid-ids.h    2013-11-04 07:41:51.000000000 +0800
+++ linux-3.12/drivers/hid/hid-ids.h    2014-02-01 01:15:37.532768035 +0800
@@ -135,6 +135,7 @@
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS   0x023b
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI  0x0255
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO   0x0256
+#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS   0x0257
 #define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI   0x0290
 #define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO    0x0291
 #define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS    0x0292
Comment 5 Huei-Horng Yo 2014-02-03 11:38:34 UTC
Created attachment 124301 [details]
Add support for Apple wireless keyboard 2011 JIS model
Comment 6 Huei-Horng Yo 2014-02-04 04:18:53 UTC
Created attachment 124361 [details]
Add Apple wireless keyboard 2011 JIS model support (mainline)
Comment 7 Huei-Horng Yo 2014-02-04 04:19:29 UTC
From 0e87439aeea995812695b38f8ec13a81d865e4ea Mon Sep 17 00:00:00 2001
From: Huei-Horng Yo <hiroshi@ghostsinthelab.org>
Date: Tue, 4 Feb 2014 12:14:06 +0800
Subject: [PATCH] Add Apple wireless keyboard 2011 JIS model support.

---
 drivers/hid/hid-apple.c | 3 +++
 drivers/hid/hid-core.c  | 1 +
 drivers/hid/hid-ids.h   | 1 +
 3 files changed, 5 insertions(+)

diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index 4975581..f822fd2 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -469,6 +469,9 @@ static const struct hid_device_id apple_devices[] = {
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
 				USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI),
 		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
+	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
+				USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS),
+		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS),
 		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI),
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 3bfac3a..bb5c494 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1679,6 +1679,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI) },
 	{ 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_FOUNTAIN_TP_ONLY) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 5a5248f..2c59283 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -135,6 +135,7 @@
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS   0x023b
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI  0x0255
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO   0x0256
+#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS   0x0257
 #define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI	0x0290
 #define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO	0x0291
 #define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS	0x0292
-- 
1.8.5.3
Comment 8 Huei-Horng Yo 2014-02-04 06:51:22 UTC
Created attachment 124371 [details]
HID: Add Apple wireless keyboard 2011 JIS model support.
Comment 9 Huei-Horng Yo 2014-02-04 07:00:27 UTC
Dear all,

Sorry to forgot to tag HID subsystem again. It's my first time to send Linux kernel patch personally, thanks for your kindly guidance, please correct me if I still have mistakes to contribute.


Huei-Horng Yo


From 9fd98c73db3fad5905eeb73fbc2a30550e64244e Mon Sep 17 00:00:00 2001
From: Huei-Horng Yo <hiroshi@ghostsinthelab.org>
Date: Tue, 4 Feb 2014 12:14:06 +0800
Subject: [PATCH] HID: Add Apple wireless keyboard 2011 JIS model support.

---
 drivers/hid/hid-apple.c | 3 +++
 drivers/hid/hid-core.c  | 1 +
 drivers/hid/hid-ids.h   | 1 +
 3 files changed, 5 insertions(+)

diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index 4975581..f822fd2 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -469,6 +469,9 @@ static const struct hid_device_id apple_devices[] = {
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
 				USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI),
 		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
+	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
+				USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS),
+		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS),
 		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI),
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 3bfac3a..bb5c494 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1679,6 +1679,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI) },
 	{ 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_FOUNTAIN_TP_ONLY) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 5a5248f..2c59283 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -135,6 +135,7 @@
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS   0x023b
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI  0x0255
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO   0x0256
+#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS   0x0257
 #define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI	0x0290
 #define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO	0x0291
 #define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS	0x0292
-- 
1.8.5.3

Note You need to log in before you can comment on or make changes to this bug.