diff mbox

Added product codes and device constants for MacBookAir4,2 keyboard.

Message ID 1312571122-30547-1-git-send-email-chase.douglas@canonical.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chase Douglas Aug. 5, 2011, 7:05 p.m. UTC
From: Joshua V. Dillon <jvdillon@gmail.com>

Added USB device IDs for MacBookAir4,2 keyboard. Device constants were
copied from the MacBookAir3,2 constants. The 4,2 device specification is
reportedly unchanged from the 3,2 predecessor and seems to work well.

Signed-off-by: Joshua V Dillon <jvdillon@gmail.com>
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
---
I received this patch from Joshua. He preferred that I send it on his
behalf. I have compile tested the patch, and Joshua has runtime tested
it using a dkms package against 2.6.38.

 drivers/hid/hid-apple.c |    9 +++++++++
 drivers/hid/hid-ids.h   |    3 +++
 2 files changed, 12 insertions(+), 0 deletions(-)

Comments

Jiri Kosina Aug. 10, 2011, 12:12 p.m. UTC | #1
On Fri, 5 Aug 2011, Chase Douglas wrote:

> From: Joshua V. Dillon <jvdillon@gmail.com>
> 
> Added USB device IDs for MacBookAir4,2 keyboard. Device constants were
> copied from the MacBookAir3,2 constants. The 4,2 device specification is
> reportedly unchanged from the 3,2 predecessor and seems to work well.
> 
> Signed-off-by: Joshua V Dillon <jvdillon@gmail.com>
> Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
> ---
> I received this patch from Joshua. He preferred that I send it on his
> behalf. I have compile tested the patch, and Joshua has runtime tested
> it using a dkms package against 2.6.38.
> 
>  drivers/hid/hid-apple.c |    9 +++++++++
>  drivers/hid/hid-ids.h   |    3 +++
>  2 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
> index b85744f..8bfd87b 100644
> --- a/drivers/hid/hid-apple.c
> +++ b/drivers/hid/hid-apple.c
> @@ -183,6 +183,9 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
>  		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_WELLSPRING6_ANSI &&
> +				hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING6_JIS)
> +			table = macbookair_fn_keys;
>  		else if (hid->product < 0x21d || hid->product >= 0x300)
>  			table = powerbook_fn_keys;
>  		else
> @@ -487,6 +490,12 @@ static const struct hid_device_id apple_devices[] = {
>  		.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_WELLSPRING6_ANSI),
> +		.driver_data = APPLE_HAS_FN },
> +	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO),
> +		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
> +	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_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 --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
> index ea2c338..a0d59d4 100644
> --- a/drivers/hid/hid-ids.h
> +++ b/drivers/hid/hid-ids.h
> @@ -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_WELLSPRING6_ANSI	0x024c
> +#define USB_DEVICE_ID_APPLE_WELLSPRING6_ISO	0x024d
> +#define USB_DEVICE_ID_APPLE_WELLSPRING6_JIS	0x024e
>  #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI  0x0239
>  #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO   0x023a
>  #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS   0x023b

The device needs to be added to hid_have_special_driver[] array, otherwise 
generic driver wouldn't unbind from it and wouldn't let hid-apple to take 
over.

I have fixed that and applied the patch.
diff mbox

Patch

diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index b85744f..8bfd87b 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -183,6 +183,9 @@  static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
 		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_WELLSPRING6_ANSI &&
+				hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING6_JIS)
+			table = macbookair_fn_keys;
 		else if (hid->product < 0x21d || hid->product >= 0x300)
 			table = powerbook_fn_keys;
 		else
@@ -487,6 +490,12 @@  static const struct hid_device_id apple_devices[] = {
 		.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_WELLSPRING6_ANSI),
+		.driver_data = APPLE_HAS_FN },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO),
+		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_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 --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index ea2c338..a0d59d4 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -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_WELLSPRING6_ANSI	0x024c
+#define USB_DEVICE_ID_APPLE_WELLSPRING6_ISO	0x024d
+#define USB_DEVICE_ID_APPLE_WELLSPRING6_JIS	0x024e
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI  0x0239
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO   0x023a
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS   0x023b