Josh Boyer 5f0e65d
Path: news.gmane.org!not-for-mail
Josh Boyer 5f0e65d
From: Pieter-Augustijn Van Malleghem <p-a@scarlet.be>
Josh Boyer 5f0e65d
Newsgroups: gmane.linux.kernel.input
Josh Boyer 5f0e65d
Subject: [PATCH] Add MacBookAir4,1 keyboard support
Josh Boyer 5f0e65d
Date: Wed, 7 Sep 2011 16:15:52 -0400
Josh Boyer 5f0e65d
Lines: 72
Josh Boyer 5f0e65d
Approved: news@gmane.org
Josh Boyer 5f0e65d
Message-ID: <20110907201552.GA1962@Caligula>
Josh Boyer 5f0e65d
NNTP-Posting-Host: lo.gmane.org
Josh Boyer 5f0e65d
Mime-Version: 1.0
Josh Boyer 5f0e65d
Content-Type: text/plain; charset=us-ascii
Josh Boyer 5f0e65d
X-Trace: dough.gmane.org 1315426570 11003 80.91.229.12 (7 Sep 2011 20:16:10 GMT)
Josh Boyer 5f0e65d
X-Complaints-To: usenet@dough.gmane.org
Josh Boyer 5f0e65d
NNTP-Posting-Date: Wed, 7 Sep 2011 20:16:10 +0000 (UTC)
Josh Boyer 5f0e65d
To: linux-input@vger.kernel.org
Josh Boyer 5f0e65d
Original-X-From: linux-input-owner@vger.kernel.org Wed Sep 07 22:16:06 2011
Josh Boyer 5f0e65d
Return-path: <linux-input-owner@vger.kernel.org>
Josh Boyer 5f0e65d
Envelope-to: glki-linux-input-2@lo.gmane.org
Josh Boyer 5f0e65d
Original-Received: from vger.kernel.org ([209.132.180.67])
Josh Boyer 5f0e65d
	by lo.gmane.org with esmtp (Exim 4.69)
Josh Boyer 5f0e65d
	(envelope-from <linux-input-owner@vger.kernel.org>)
Josh Boyer 5f0e65d
	id 1R1OXV-0007QX-Ll
Josh Boyer 5f0e65d
	for glki-linux-input-2@lo.gmane.org; Wed, 07 Sep 2011 22:16:06 +0200
Josh Boyer 5f0e65d
Original-Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
Josh Boyer 5f0e65d
	id S1751419Ab1IGUQE (ORCPT <rfc822;glki-linux-input-2@m.gmane.org>);
Josh Boyer 5f0e65d
	Wed, 7 Sep 2011 16:16:04 -0400
Josh Boyer 5f0e65d
Original-Received: from mail-vx0-f174.google.com ([209.85.220.174]:57168 "EHLO
Josh Boyer 5f0e65d
	mail-vx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
Josh Boyer 5f0e65d
	with ESMTP id S1751237Ab1IGUQC (ORCPT
Josh Boyer 5f0e65d
	<rfc822;linux-input@vger.kernel.org>); Wed, 7 Sep 2011 16:16:02 -0400
Josh Boyer 5f0e65d
Original-Received: by vxj15 with SMTP id 15so31147vxj.19
Josh Boyer 5f0e65d
        for <linux-input@vger.kernel.org>; Wed, 07 Sep 2011 13:16:02 -0700 (PDT)
Josh Boyer 5f0e65d
Original-Received: by 10.52.69.210 with SMTP id g18mr64348vdu.133.1315426562281;
Josh Boyer 5f0e65d
        Wed, 07 Sep 2011 13:16:02 -0700 (PDT)
Josh Boyer 5f0e65d
Original-Received: from Caligula ([140.247.246.50])
Josh Boyer 5f0e65d
        by mx.google.com with ESMTPS id ch2sm944169vdc.19.2011.09.07.13.16.01
Josh Boyer 5f0e65d
        (version=TLSv1/SSLv3 cipher=OTHER);
Josh Boyer 5f0e65d
        Wed, 07 Sep 2011 13:16:01 -0700 (PDT)
Josh Boyer 5f0e65d
Content-Disposition: inline
Josh Boyer 5f0e65d
User-Agent: Mutt/1.5.21 (2010-09-15)
Josh Boyer 5f0e65d
Original-Sender: linux-input-owner@vger.kernel.org
Josh Boyer 5f0e65d
Precedence: bulk
Josh Boyer 5f0e65d
List-ID: <linux-input.vger.kernel.org>
Josh Boyer 5f0e65d
X-Mailing-List: linux-input@vger.kernel.org
Josh Boyer 5f0e65d
Xref: news.gmane.org gmane.linux.kernel.input:21462
Josh Boyer 5f0e65d
Archived-At: <http://permalink.gmane.org/gmane.linux.kernel.input/21462>
Josh Boyer 5f0e65d
Josh Boyer 5f0e65d
This patch adds support for the Apple MacBookAir4,1 released in July 
Josh Boyer 5f0e65d
2011. It was inspired by Joshua Dillon's patch for the MacBookAir4,2
Josh Boyer 5f0e65d
posted on http://www.almostsure.com/mba42/hid-apple-dkms.patch.
Josh Boyer 5f0e65d
Josh Boyer 5f0e65d
Signed-off-by: Pieter-Augustijn Van Malleghem <p-a@scarlet.be>
Josh Boyer 5f0e65d
diff -uNr linux/drivers/hid/hid-apple.c patched/drivers/hid/hid-apple.c
Josh Boyer 5f0e65d
--- linux/drivers/hid/hid-apple.c	2011-09-06 23:41:58.000000000 -0400
Josh Boyer 5f0e65d
+++ patched/drivers/hid/hid-apple.c	2011-09-06 23:53:05.000000000 -0400
Josh Boyer 5f0e65d
@@ -183,6 +183,9 @@
Josh Boyer 5f0e65d
 		if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
Josh Boyer 5f0e65d
 				hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS)
Josh Boyer 5f0e65d
 			table = macbookair_fn_keys;
Josh Boyer 5f0e65d
+		else if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI &&
Josh Boyer 5f0e65d
+				hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS)
Bastien Nocera c3d9004
+			table = apple_fn_keys;
Josh Boyer 5f0e65d
 		else if (hid->product < 0x21d || hid->product >= 0x300)
Josh Boyer 5f0e65d
 			table = powerbook_fn_keys;
Josh Boyer 5f0e65d
 		else
Josh Boyer 5f0e65d
@@ -493,6 +499,12 @@
Josh Boyer 5f0e65d
 		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
Josh Boyer 5f0e65d
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS),
Josh Boyer 5f0e65d
 		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
Josh Boyer 5f0e65d
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI),
Josh Boyer 5f0e65d
+		.driver_data = APPLE_HAS_FN },
Josh Boyer 5f0e65d
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO),
Josh Boyer 5f0e65d
+		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
Josh Boyer 5f0e65d
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS),
Josh Boyer 5f0e65d
+		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
Josh Boyer 5f0e65d
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
Josh Boyer 5f0e65d
 		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
Josh Boyer 5f0e65d
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
Josh Boyer 5f0e65d
diff -uNr linux/drivers/hid/hid-core.c patched/drivers/hid/hid-core.c
Josh Boyer 5f0e65d
--- linux/drivers/hid/hid-core.c	2011-09-06 23:41:58.000000000 -0400
Josh Boyer 5f0e65d
+++ patched/drivers/hid/hid-core.c	2011-09-06 23:56:22.000000000 -0400
Josh Boyer 5f0e65d
@@ -1340,6 +1340,9 @@
Josh Boyer 5f0e65d
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) },
Josh Boyer 5f0e65d
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) },
Josh Boyer 5f0e65d
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) },
Josh Boyer 5f0e65d
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) },
Josh Boyer 5f0e65d
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) },
Josh Boyer 5f0e65d
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) },
Josh Boyer 5f0e65d
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI) },
Josh Boyer 5f0e65d
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO) },
Josh Boyer 5f0e65d
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_JIS) },
Josh Boyer 5f0e65d
@@ -1892,6 +1895,9 @@
Josh Boyer 5f0e65d
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) },
Josh Boyer 5f0e65d
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) },
Josh Boyer 5f0e65d
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) },
Josh Boyer 5f0e65d
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) },
Josh Boyer 5f0e65d
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) },
Josh Boyer 5f0e65d
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) },
Josh Boyer 5f0e65d
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
Josh Boyer 5f0e65d
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
Josh Boyer 5f0e65d
 	{ }
Josh Boyer 5f0e65d
diff -uNr linux/drivers/hid/hid-ids.h patched/drivers/hid/hid-ids.h
Josh Boyer 5f0e65d
--- linux/drivers/hid/hid-ids.h	2011-09-06 23:41:58.000000000 -0400
Josh Boyer 5f0e65d
+++ patched/drivers/hid/hid-ids.h	2011-09-06 23:57:39.000000000 -0400
Josh Boyer 5f0e65d
@@ -109,6 +109,9 @@
Josh Boyer 5f0e65d
 #define USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI	0x0245
Josh Boyer 5f0e65d
 #define USB_DEVICE_ID_APPLE_WELLSPRING5_ISO	0x0246
Josh Boyer 5f0e65d
 #define USB_DEVICE_ID_APPLE_WELLSPRING5_JIS	0x0247
Josh Boyer 5f0e65d
+#define USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI	0x0249
Josh Boyer 5f0e65d
+#define USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO	0x024a
Josh Boyer 5f0e65d
+#define USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS	0x024b
Josh Boyer 5f0e65d
 #define USB_DEVICE_ID_APPLE_ALU_REVB_ANSI	0x024f
Josh Boyer 5f0e65d
 #define USB_DEVICE_ID_APPLE_ALU_REVB_ISO	0x0250
Josh Boyer 5f0e65d
 #define USB_DEVICE_ID_APPLE_ALU_REVB_JIS	0x0251
Josh Boyer 5f0e65d
--
Josh Boyer 5f0e65d
To unsubscribe from this list: send the line "unsubscribe linux-input" in
Josh Boyer 5f0e65d
the body of a message to majordomo@vger.kernel.org
Josh Boyer 5f0e65d
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Josh Boyer 5f0e65d