* [PATCH] Add MacBookAir4,1 keyboard support
@ 2011-09-07 20:15 Pieter-Augustijn Van Malleghem
2011-09-16 16:05 ` Bastien Nocera
0 siblings, 1 reply; 3+ messages in thread
From: Pieter-Augustijn Van Malleghem @ 2011-09-07 20:15 UTC (permalink / raw)
To: linux-input
This patch adds support for the Apple MacBookAir4,1 released in July
2011. It was inspired by Joshua Dillon's patch for the MacBookAir4,2
posted on http://www.almostsure.com/mba42/hid-apple-dkms.patch.
Signed-off-by: Pieter-Augustijn Van Malleghem <p-a@scarlet.be>
diff -uNr linux/drivers/hid/hid-apple.c patched/drivers/hid/hid-apple.c
--- linux/drivers/hid/hid-apple.c 2011-09-06 23:41:58.000000000 -0400
+++ patched/drivers/hid/hid-apple.c 2011-09-06 23:53:05.000000000 -0400
@@ -183,6 +183,9 @@
if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS)
table = macbookair_fn_keys;
+ else if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI &&
+ hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS)
+ table = macbookair_fn_keys;
else if (hid->product < 0x21d || hid->product >= 0x300)
table = powerbook_fn_keys;
else
@@ -493,6 +499,12 @@
.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS),
.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI),
+ .driver_data = APPLE_HAS_FN },
+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO),
+ .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS),
+ .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
diff -uNr linux/drivers/hid/hid-core.c patched/drivers/hid/hid-core.c
--- linux/drivers/hid/hid-core.c 2011-09-06 23:41:58.000000000 -0400
+++ patched/drivers/hid/hid-core.c 2011-09-06 23:56:22.000000000 -0400
@@ -1340,6 +1340,9 @@
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_JIS) },
@@ -1892,6 +1895,9 @@
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_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) },
{ }
diff -uNr linux/drivers/hid/hid-ids.h patched/drivers/hid/hid-ids.h
--- linux/drivers/hid/hid-ids.h 2011-09-06 23:41:58.000000000 -0400
+++ patched/drivers/hid/hid-ids.h 2011-09-06 23:57:39.000000000 -0400
@@ -109,6 +109,9 @@
#define USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI 0x0245
#define USB_DEVICE_ID_APPLE_WELLSPRING5_ISO 0x0246
#define USB_DEVICE_ID_APPLE_WELLSPRING5_JIS 0x0247
+#define USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI 0x0249
+#define USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO 0x024a
+#define USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS 0x024b
#define USB_DEVICE_ID_APPLE_ALU_REVB_ANSI 0x024f
#define USB_DEVICE_ID_APPLE_ALU_REVB_ISO 0x0250
#define USB_DEVICE_ID_APPLE_ALU_REVB_JIS 0x0251
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Add MacBookAir4,1 keyboard support
2011-09-07 20:15 [PATCH] Add MacBookAir4,1 keyboard support Pieter-Augustijn Van Malleghem
@ 2011-09-16 16:05 ` Bastien Nocera
2011-09-16 18:20 ` Bastien Nocera
0 siblings, 1 reply; 3+ messages in thread
From: Bastien Nocera @ 2011-09-16 16:05 UTC (permalink / raw)
To: Pieter-Augustijn Van Malleghem; +Cc: linux-input
On Wed, 2011-09-07 at 16:15 -0400, Pieter-Augustijn Van Malleghem wrote:
> This patch adds support for the Apple MacBookAir4,1 released in July
> 2011. It was inspired by Joshua Dillon's patch for the MacBookAir4,2
> posted on http://www.almostsure.com/mba42/hid-apple-dkms.patch.
> Signed-off-by: Pieter-Augustijn Van Malleghem <p-a@scarlet.be>
> diff -uNr linux/drivers/hid/hid-apple.c patched/drivers/hid/hid-apple.c
> --- linux/drivers/hid/hid-apple.c 2011-09-06 23:41:58.000000000 -0400
> +++ patched/drivers/hid/hid-apple.c 2011-09-06 23:53:05.000000000 -0400
> @@ -183,6 +183,9 @@
> if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
> hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS)
> table = macbookair_fn_keys;
> + else if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI &&
> + hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS)
> + table = macbookair_fn_keys;
> else if (hid->product < 0x21d || hid->product >= 0x300)
> table = powerbook_fn_keys;
> else
This is broken, the macbookair_fn_keys above are for earlier revisions
of the MacBook Air. MacBookAir4,1 and 4,1 don't have an eject button
anymore, so should use the apple_fn_keys[] translation table.
Cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Add MacBookAir4,1 keyboard support
2011-09-16 16:05 ` Bastien Nocera
@ 2011-09-16 18:20 ` Bastien Nocera
0 siblings, 0 replies; 3+ messages in thread
From: Bastien Nocera @ 2011-09-16 18:20 UTC (permalink / raw)
To: Pieter-Augustijn Van Malleghem; +Cc: linux-input
On Fri, 2011-09-16 at 17:05 +0100, Bastien Nocera wrote:
> On Wed, 2011-09-07 at 16:15 -0400, Pieter-Augustijn Van Malleghem wrote:
> > This patch adds support for the Apple MacBookAir4,1 released in July
> > 2011. It was inspired by Joshua Dillon's patch for the MacBookAir4,2
> > posted on http://www.almostsure.com/mba42/hid-apple-dkms.patch.
>
> > Signed-off-by: Pieter-Augustijn Van Malleghem <p-a@scarlet.be>
> > diff -uNr linux/drivers/hid/hid-apple.c patched/drivers/hid/hid-apple.c
> > --- linux/drivers/hid/hid-apple.c 2011-09-06 23:41:58.000000000 -0400
> > +++ patched/drivers/hid/hid-apple.c 2011-09-06 23:53:05.000000000 -0400
> > @@ -183,6 +183,9 @@
> > if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
> > hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS)
> > table = macbookair_fn_keys;
> > + else if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI &&
> > + hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS)
> > + table = macbookair_fn_keys;
> > else if (hid->product < 0x21d || hid->product >= 0x300)
> > table = powerbook_fn_keys;
> > else
>
> This is broken, the macbookair_fn_keys above are for earlier revisions
> of the MacBook Air. MacBookAir4,1 and 4,1 don't have an eject button
> anymore, so should use the apple_fn_keys[] translation table.
Works with this patch applied on top of yours:
@@ -59,7 +59,7 @@ diff -uNr linux/drivers/hid/hid-apple.c patched/drivers/hid/hid-apple.c
table = macbookair_fn_keys;
+ else if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI &&
+ hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS)
-+ table = macbookair_fn_keys;
++ table = apple_fn_keys;
else if (hid->product < 0x21d || hid->product >= 0x300)
table = powerbook_fn_keys;
else
Tested-by: Bastien Nocera <hadess@hadess.net>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-09-16 18:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-07 20:15 [PATCH] Add MacBookAir4,1 keyboard support Pieter-Augustijn Van Malleghem
2011-09-16 16:05 ` Bastien Nocera
2011-09-16 18:20 ` Bastien Nocera
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).