[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Fn key and 2.6.12-rc4



Le mardi 05 juillet 2005 à 16:25 +0200, Johannes Berg a écrit :
> Jochen Voss wrote:
> 
> >My only idea is to take the 2.6.12-rc kernels one by one, to find out
> >in which one it breaks and then to look at the corresponding patch.
> >Maybe something suspicious can be spotted there.  I guess this whole
> >procedure would take me about one day, so I did not yet find time to
> >do this.

I had a few hours to spend and I made it work again.

Now, I didn't look at the previous (working) code so I don't know
exactly what change broke it. In fact, looking at the logic I don't
understand how this could have been working before (unless the logic
itself changed...).

Anyway, the attached patch below replaces the Johannes' one. Note that I
don't use the Fn key myself yet, so testing has been limited to looking
at evtest and xev output...

Should I push this in the mainstream kernel ?

Stelian.


Index: linux-2.6.git/drivers/usb/input/hid-core.c
===================================================================
--- linux-2.6.git.orig/drivers/usb/input/hid-core.c	2005-07-28 09:35:52.000000000 +0200
+++ linux-2.6.git/drivers/usb/input/hid-core.c	2005-07-28 12:22:31.000000000 +0200
@@ -1446,6 +1446,10 @@
  * Alphabetically sorted blacklist by quirk type.
  */
 
+#define USB_VENDOR_ID_APPLE		0x05AC
+#define USB_DEVICE_ID_POWERBOOK_KB_US	0x020E
+#define USB_DEVICE_ID_POWERBOOK_KB_UK	0x020F
+
 static struct hid_blacklist {
 	__u16 idVendor;
 	__u16 idProduct;
@@ -1557,6 +1561,9 @@
 	{ USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD, HID_QUIRK_BADPAD },
 	{ USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD, HID_QUIRK_BADPAD },
 
+	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_POWERBOOK_KB_US, HID_QUIRK_POWERBOOK_FN_BUTTON },
+	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_POWERBOOK_KB_UK, HID_QUIRK_POWERBOOK_FN_BUTTON },
+
 	{ 0, 0 }
 };
 
Index: linux-2.6.git/drivers/usb/input/hid-input.c
===================================================================
--- linux-2.6.git.orig/drivers/usb/input/hid-input.c	2005-07-28 09:35:52.000000000 +0200
+++ linux-2.6.git/drivers/usb/input/hid-input.c	2005-07-28 12:23:14.000000000 +0200
@@ -106,6 +106,10 @@
 			} else
 				map_key(KEY_UNKNOWN);
 
+			if ((device->quirks & HID_QUIRK_POWERBOOK_FN_BUTTON) &&
+			    (hid_keyboard[usage->hid & HID_USAGE] == KEY_RIGHTCTRL))
+				map_key(KEY_UNKNOWN);
+
 			break;
 
 		case HID_UP_BUTTON:
@@ -324,6 +328,10 @@
 
 		default:
 		unknown:
+			if ((device->quirks & HID_QUIRK_POWERBOOK_FN_BUTTON) && (usage->hid == 0x00ff0003)) {
+				map_key_clear(KEY_RIGHTCTRL);
+				break;
+			}
 			if (field->report_size == 1) {
 				if (field->report->type == HID_OUTPUT_REPORT) {
 					map_led(LED_MISC);
Index: linux-2.6.git/drivers/usb/input/hid.h
===================================================================
--- linux-2.6.git.orig/drivers/usb/input/hid.h	2005-07-28 09:35:52.000000000 +0200
+++ linux-2.6.git/drivers/usb/input/hid.h	2005-07-28 12:22:31.000000000 +0200
@@ -242,6 +242,7 @@
 #define HID_QUIRK_2WHEEL_MOUSE_HACK_7		0x080
 #define HID_QUIRK_2WHEEL_MOUSE_HACK_5		0x100
 #define HID_QUIRK_2WHEEL_MOUSE_HACK_ON		0x200
+#define HID_QUIRK_POWERBOOK_FN_BUTTON		0x400
 
 /*
  * This is the global environment of the parser. This information is
 

-- 
Stelian Pop <stelian@popies.net>



Reply to: