linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] appletouch driver and 4th generation macbooks
@ 2008-03-14 17:22 Tobias Müller
  2008-03-15 13:46 ` Johannes Berg
  0 siblings, 1 reply; 8+ messages in thread
From: Tobias Müller @ 2008-03-14 17:22 UTC (permalink / raw)
  To: linux-input, johannes

[-- Attachment #1: Type: text/plain, Size: 1666 bytes --]

Hello!

Adds product ids for 4th generation MacBooks in appletouch driver. 

Signed-off-by: Tobias Mueller <Tobias_Mueller@twam.info>

diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
index b4423a4..8dd3942 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -62,6 +62,10 @@
 #define GEYSER4_ISO_PRODUCT_ID 0x021B
 #define GEYSER4_JIS_PRODUCT_ID 0x021C

+#define GEYSER4_HF_ANSI_PRODUCT_ID     0x0229
+#define GEYSER4_HF_ISO_PRODUCT_ID      0x022A
+#define GEYSER4_HF_JIS_PRODUCT_ID      0x022B
+
 #define ATP_DEVICE(prod)                                       \
        .match_flags = USB_DEVICE_ID_MATCH_DEVICE |             \
                       USB_DEVICE_ID_MATCH_INT_CLASS |          \
@@ -93,6 +97,10 @@ static struct usb_device_id atp_table [] = {
        { ATP_DEVICE(GEYSER4_ISO_PRODUCT_ID) },
        { ATP_DEVICE(GEYSER4_JIS_PRODUCT_ID) },

+       { ATP_DEVICE(GEYSER4_HF_ANSI_PRODUCT_ID) },
+       { ATP_DEVICE(GEYSER4_HF_ISO_PRODUCT_ID) },
+       { ATP_DEVICE(GEYSER4_HF_JIS_PRODUCT_ID) },
+
        /* Terminating entry */
        { }
 };
@@ -217,7 +225,10 @@ static inline int atp_is_geyser_3(struct atp *dev)
                (productId == GEYSER3_JIS_PRODUCT_ID) ||
                (productId == GEYSER4_ANSI_PRODUCT_ID) ||
                (productId == GEYSER4_ISO_PRODUCT_ID) ||
-               (productId == GEYSER4_JIS_PRODUCT_ID);
+               (productId == GEYSER4_JIS_PRODUCT_ID) ||
+               (productId == GEYSER4_HF_ANSI_PRODUCT_ID) ||
+               (productId == GEYSER4_HF_ISO_PRODUCT_ID) ||
+               (productId == GEYSER4_HF_JIS_PRODUCT_ID);
 }

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/x-pkcs7-signature, Size: 3389 bytes --]

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] appletouch driver and 4th generation macbooks
  2008-03-14 17:22 [PATCH] appletouch driver and 4th generation macbooks Tobias Müller
@ 2008-03-15 13:46 ` Johannes Berg
  2008-03-16 10:48   ` Tobias Müller
  2008-04-02 11:16   ` Tobias Müller
  0 siblings, 2 replies; 8+ messages in thread
From: Johannes Berg @ 2008-03-15 13:46 UTC (permalink / raw)
  To: Tobias Müller; +Cc: linux-input



> Adds product ids for 4th generation MacBooks in appletouch driver. 

Looks good.

> Signed-off-by: Tobias Mueller <Tobias_Mueller@twam.info>

Acked-by: Johannes Berg <johannes@sipsolutions.net>

> +#define GEYSER4_HF_ANSI_PRODUCT_ID     0x0229
> +#define GEYSER4_HF_ISO_PRODUCT_ID      0x022A
> +#define GEYSER4_HF_JIS_PRODUCT_ID      0x022B

Any hint why the "HF"? Also, are you working on getting the rest of the
input stuff working, especially the keyboard FN key translations? You
can have below patch I made for my brother but never pushed upstream.
Might not apply against a current kernel any more.

johannes

From: Johannes Berg <johannes@sipsolutions.net>

Preliminary support for new macbook input devices (keyboard/touchpad)

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>

---
Diffed against 2.6.24-rc6.

 hid/hid-input.c          |   50 +++++++++++++++++++++++++++++++++++++++++++----
 hid/usbhid/hid-quirks.c  |    2 +
 input/mouse/appletouch.c |   11 +++++++++-
 3 files changed, 58 insertions(+), 5 deletions(-)

Index: linux-2.6.24-rc6/drivers/input/mouse/appletouch.c
===================================================================
--- linux-2.6.24-rc6.orig/drivers/input/mouse/appletouch.c	2007-12-27 01:17:57.000000000 +0100
+++ linux-2.6.24-rc6/drivers/input/mouse/appletouch.c	2007-12-27 01:35:32.000000000 +0100
@@ -62,6 +62,11 @@
 #define GEYSER4_ISO_PRODUCT_ID	0x021B
 #define GEYSER4_JIS_PRODUCT_ID	0x021C
 
+/*
+ * Geyser IV.1 (no difference to IV known so far)
+ */
+#define GEYSER4_1_ISO_PRODUCT_ID	0x022a
+
 #define ATP_DEVICE(prod)					\
 	.match_flags = USB_DEVICE_ID_MATCH_DEVICE |		\
 		       USB_DEVICE_ID_MATCH_INT_CLASS |		\
@@ -93,6 +98,9 @@
 	{ ATP_DEVICE(GEYSER4_ISO_PRODUCT_ID) },
 	{ ATP_DEVICE(GEYSER4_JIS_PRODUCT_ID) },
 
+	/* Core2 Duo MacBook (late 2007 version) */
+	{ ATP_DEVICE(GEYSER4_1_ISO_PRODUCT_ID) },
+
 	/* Terminating entry */
 	{ }
 };
@@ -217,7 +225,8 @@
 		(productId == GEYSER3_JIS_PRODUCT_ID) ||
 		(productId == GEYSER4_ANSI_PRODUCT_ID) ||
 		(productId == GEYSER4_ISO_PRODUCT_ID) ||
-		(productId == GEYSER4_JIS_PRODUCT_ID);
+		(productId == GEYSER4_JIS_PRODUCT_ID) ||
+		(productId == GEYSER4_1_ISO_PRODUCT_ID);
 }
 
 /*
Index: linux-2.6.24-rc6/drivers/hid/usbhid/hid-quirks.c
===================================================================
--- linux-2.6.24-rc6.orig/drivers/hid/usbhid/hid-quirks.c	2007-12-27 02:05:09.000000000 +0100
+++ linux-2.6.24-rc6/drivers/hid/usbhid/hid-quirks.c	2007-12-27 02:06:52.000000000 +0100
@@ -59,6 +59,7 @@
 #define USB_DEVICE_ID_APPLE_GEYSER4_ANSI	0x021a
 #define USB_DEVICE_ID_APPLE_GEYSER4_ISO	0x021b
 #define USB_DEVICE_ID_APPLE_GEYSER4_JIS	0x021c
+#define USB_DEVICE_ID_APPLE_GEYSER4_1_ISO	0x022a
 #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY	0x030a
 #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY	0x030b
 #define USB_DEVICE_ID_APPLE_IRCONTROL4	0x8242
@@ -551,6 +552,7 @@
 	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
 	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
 	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
+	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_1_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
 	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
 	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
 
Index: linux-2.6.24-rc6/drivers/hid/hid-input.c
===================================================================
--- linux-2.6.24-rc6.orig/drivers/hid/hid-input.c	2007-12-27 02:34:47.000000000 +0100
+++ linux-2.6.24-rc6/drivers/hid/hid-input.c	2007-12-27 02:59:41.000000000 +0100
@@ -119,6 +119,27 @@
 	{ }
 };
 
+static struct hidinput_key_translation macbook_fn_keys[] = {
+	{ KEY_BACKSPACE, KEY_DELETE },
+	{ KEY_F1,	KEY_BRIGHTNESSDOWN,	POWERBOOK_FLAG_FKEY },
+	{ KEY_F2,	KEY_BRIGHTNESSUP,	POWERBOOK_FLAG_FKEY },
+	{ KEY_F3,	KEY_PROG1,		POWERBOOK_FLAG_FKEY },
+	{ KEY_F4,	KEY_PROG2,		POWERBOOK_FLAG_FKEY },
+	{ KEY_F5,	KEY_PROG3,		POWERBOOK_FLAG_FKEY },
+	{ KEY_F6,	KEY_PROG4,		POWERBOOK_FLAG_FKEY },
+	{ KEY_F7,	KEY_PREVIOUSSONG,	POWERBOOK_FLAG_FKEY },
+	{ KEY_F8,	KEY_PLAYPAUSE,		POWERBOOK_FLAG_FKEY },
+	{ KEY_F9,	KEY_NEXTSONG,		POWERBOOK_FLAG_FKEY },
+	{ KEY_F10,	KEY_MUTE,		POWERBOOK_FLAG_FKEY },
+	{ KEY_F11,	KEY_VOLUMEDOWN,		POWERBOOK_FLAG_FKEY },
+	{ KEY_F12,	KEY_VOLUMEUP,		POWERBOOK_FLAG_FKEY },
+	{ KEY_UP,	KEY_PAGEUP },
+	{ KEY_DOWN,	KEY_PAGEDOWN },
+	{ KEY_LEFT,	KEY_HOME },
+	{ KEY_RIGHT,	KEY_END },
+	{ }
+};
+
 static struct hidinput_key_translation powerbook_numlock_keys[] = {
 	{ KEY_J,        KEY_KP1 },
 	{ KEY_K,        KEY_KP2 },
@@ -177,7 +198,10 @@
 	if (hid_pb_fnmode) {
 		int do_translate;
 
-		trans = find_translation(powerbook_fn_keys, usage->code);
+		if (hid->product == 0x22a)
+			trans = find_translation(macbook_fn_keys, usage->code);
+		else
+			trans = find_translation(powerbook_fn_keys, usage->code);
 		if (trans) {
 			if (test_bit(usage->code, hid->pb_pressed_fn))
 				do_translate = 1;
@@ -228,10 +252,28 @@
 	return 0;
 }
 
-static void hidinput_pb_setup(struct input_dev *input)
+static void hidinput_macbook_setup(struct input_dev *input)
+{
+	struct hidinput_key_translation *trans;
+
+	/* Enable all needed keys */
+	for (trans = macbook_fn_keys; trans->from; trans++)
+		set_bit(trans->to, input->keybit);
+
+	for (trans = powerbook_iso_keyboard; trans->from; trans++)
+		set_bit(trans->to, input->keybit);
+}
+
+static void hidinput_pb_setup(struct hid_device *hid, struct input_dev *input)
 {
 	struct hidinput_key_translation *trans;
 
+	/* new MacBooks */
+	if (hid->product == 0x22a) {
+		hidinput_macbook_setup(input);
+		return;
+	}
+
 	set_bit(KEY_NUMLOCK, input->keybit);
 
 	/* Enable all needed keys */
@@ -252,7 +294,7 @@
 	return 0;
 }
 
-static inline void hidinput_pb_setup(struct input_dev *input)
+static inline void hidinput_pb_setup(struct hid_device *hid, struct input_dev *input)
 {
 }
 #endif
@@ -792,7 +834,7 @@
 				case 0x003:
 					/* The fn key on Apple PowerBooks */
 					map_key_clear(KEY_FN);
-					hidinput_pb_setup(input);
+					hidinput_pb_setup(device, input);
 					break;
 
 				default:    goto ignore;



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] appletouch driver and 4th generation macbooks
  2008-03-15 13:46 ` Johannes Berg
@ 2008-03-16 10:48   ` Tobias Müller
  2008-03-16 11:02     ` Johannes Berg
  2008-04-02 11:16   ` Tobias Müller
  1 sibling, 1 reply; 8+ messages in thread
From: Tobias Müller @ 2008-03-16 10:48 UTC (permalink / raw)
  To: Johannes Berg, linux-input

[-- Attachment #1: Type: text/plain, Size: 428 bytes --]

Hi

> Any hint why the "HF"?
No, i found this names from in a usb-quirks patch, when adjusting that one for 2.6.25.

> Also, are you working on getting the rest of the
> input stuff working, especially the keyboard FN key translations? You
> can have below patch I made for my brother but never pushed upstream.
> Might not apply against a current kernel any more.
This is already implemented in 2.6.25-rc5 :)

Regards
  Tobias

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/x-pkcs7-signature, Size: 3389 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] appletouch driver and 4th generation macbooks
  2008-03-16 10:48   ` Tobias Müller
@ 2008-03-16 11:02     ` Johannes Berg
  0 siblings, 0 replies; 8+ messages in thread
From: Johannes Berg @ 2008-03-16 11:02 UTC (permalink / raw)
  To: Tobias Müller; +Cc: linux-input

[-- Attachment #1: Type: text/plain, Size: 543 bytes --]


On Sun, 2008-03-16 at 11:48 +0100, Tobias Müller wrote:
> Hi
> 
> > Any hint why the "HF"?
> No, i found this names from in a usb-quirks patch, when adjusting that one for 2.6.25.

Oh ok.

> > Also, are you working on getting the rest of the
> > input stuff working, especially the keyboard FN key translations? You
> > can have below patch I made for my brother but never pushed upstream.
> > Might not apply against a current kernel any more.
> This is already implemented in 2.6.25-rc5 :)

Oh cool :)

Thanks,
johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] appletouch driver and 4th generation macbooks
  2008-03-15 13:46 ` Johannes Berg
  2008-03-16 10:48   ` Tobias Müller
@ 2008-04-02 11:16   ` Tobias Müller
  2008-04-02 11:23     ` Johannes Berg
  1 sibling, 1 reply; 8+ messages in thread
From: Tobias Müller @ 2008-04-02 11:16 UTC (permalink / raw)
  To: Johannes Berg, linux-input

[-- Attachment #1: Type: text/plain, Size: 356 bytes --]

Hi,

Johannes Berg schrieb:
>> Adds product ids for 4th generation MacBooks in appletouch driver. 
> 
> Looks good.
> 
>> Signed-off-by: Tobias Mueller <Tobias_Mueller@twam.info>
> 
> Acked-by: Johannes Berg <johannes@sipsolutions.net>
 
I still cannot find the new device ids in 2.6.25-rc8. Is there anything to do further from my side?

Regards
  Tobias

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/x-pkcs7-signature, Size: 3389 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] appletouch driver and 4th generation macbooks
  2008-04-02 11:16   ` Tobias Müller
@ 2008-04-02 11:23     ` Johannes Berg
  2008-04-02 14:19       ` Dmitry Torokhov
  0 siblings, 1 reply; 8+ messages in thread
From: Johannes Berg @ 2008-04-02 11:23 UTC (permalink / raw)
  To: Tobias Müller; +Cc: linux-input, Dmitry Torokhov

[-- Attachment #1: Type: text/plain, Size: 784 bytes --]


On Wed, 2008-04-02 at 13:16 +0200, Tobias Müller wrote:
> Hi,
> 
> Johannes Berg schrieb:
> >> Adds product ids for 4th generation MacBooks in appletouch driver. 
> > 
> > Looks good.
> > 
> >> Signed-off-by: Tobias Mueller <Tobias_Mueller@twam.info>
> > 
> > Acked-by: Johannes Berg <johannes@sipsolutions.net>
>  
> I still cannot find the new device ids in 2.6.25-rc8. Is there anything to do further from my side?

I guess I was supposed to pick up the patch and thought somebody else
would. Dmitry, can you pick it up into your input tree?

I don't expect it to be going into 2.6.25 at this point, it's rather
close to being released. On the other hand, it's not like it can cause
regressions, but I guess we need to draw a line at some point.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] appletouch driver and 4th generation macbooks
  2008-04-02 11:23     ` Johannes Berg
@ 2008-04-02 14:19       ` Dmitry Torokhov
  2008-04-03 10:08         ` Johannes Berg
  0 siblings, 1 reply; 8+ messages in thread
From: Dmitry Torokhov @ 2008-04-02 14:19 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Tobias M?ller, linux-input

Hi Johannes, Tobias,

On Wed, Apr 02, 2008 at 01:23:03PM +0200, Johannes Berg wrote:
> 
> On Wed, 2008-04-02 at 13:16 +0200, Tobias M??ller wrote:
> > Hi,
> > 
> > Johannes Berg schrieb:
> > >> Adds product ids for 4th generation MacBooks in appletouch driver. 
> > > 
> > > Looks good.
> > > 
> > >> Signed-off-by: Tobias Mueller <Tobias_Mueller@twam.info>
> > > 
> > > Acked-by: Johannes Berg <johannes@sipsolutions.net>
> >  
> > I still cannot find the new device ids in 2.6.25-rc8. Is there anything to do further from my side?
> 
> I guess I was supposed to pick up the patch and thought somebody else
> would. Dmitry, can you pick it up into your input tree?
> 
> I don't expect it to be going into 2.6.25 at this point, it's rather
> close to being released. On the other hand, it's not like it can cause
> regressions, but I guess we need to draw a line at some point.
> 

I applied the patch to my tree. I will try to push the change to Linus
before 2.6.25 since it is very low risk. Btw, is_geyser3() function
is becoming unwieldy. We might consider changing it to something that
scans array of integers instead of adding more conditions to that "if"
statement next time we add more IDs to it.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] appletouch driver and 4th generation macbooks
  2008-04-02 14:19       ` Dmitry Torokhov
@ 2008-04-03 10:08         ` Johannes Berg
  0 siblings, 0 replies; 8+ messages in thread
From: Johannes Berg @ 2008-04-03 10:08 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Tobias M?ller, linux-input

[-- Attachment #1: Type: text/plain, Size: 467 bytes --]

Hi Dmitry,

> I applied the patch to my tree. I will try to push the change to Linus
> before 2.6.25 since it is very low risk. 

Good, thanks.

> Btw, is_geyser3() function
> is becoming unwieldy. We might consider changing it to something that
> scans array of integers instead of adding more conditions to that "if"
> statement next time we add more IDs to it.

Yeah, good point. I'll try to remember when the next person comes
around :)

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-04-03 10:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-14 17:22 [PATCH] appletouch driver and 4th generation macbooks Tobias Müller
2008-03-15 13:46 ` Johannes Berg
2008-03-16 10:48   ` Tobias Müller
2008-03-16 11:02     ` Johannes Berg
2008-04-02 11:16   ` Tobias Müller
2008-04-02 11:23     ` Johannes Berg
2008-04-02 14:19       ` Dmitry Torokhov
2008-04-03 10:08         ` Johannes Berg

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).