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

Bug#336382: linux-2.6: [powerpc] support for powerbooks fn-key



Package: linux-2.6
Severity: wishlist

The fn key doesnt work by default on apple powerbooks. The attached
patch solve this problem.

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable')
Architecture: powerpc (ppc)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.14
Locale: LANG=en_US.ISO-8859-15, LC_CTYPE=en_US.ISO-8859-15 (charmap=ISO-8859-15)
diff -Naur a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
--- a/drivers/usb/input/hid-core.c	2005-10-29 12:51:55.000000000 +0200
+++ b/drivers/usb/input/hid-core.c	2005-10-29 12:51:38.000000000 +0200
@@ -1451,6 +1451,9 @@
  * Alphabetically sorted blacklist by quirk type.
  */
 
+#define USB_DEVICE_ID_POWERBOOK_KB_US	0x020E
+#define USB_DEVICE_ID_POWERBOOK_KB_UK	0x020F
+
 static struct hid_blacklist {
 	__u16 idVendor;
 	__u16 idProduct;
@@ -1566,6 +1569,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 }
 };
 
diff -Naur a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c
--- a/drivers/usb/input/hid-input.c	2005-10-29 12:51:55.000000000 +0200
+++ b/drivers/usb/input/hid-input.c	2005-10-29 12:51:38.000000000 +0200
@@ -107,6 +107,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:
@@ -320,15 +324,17 @@
 		case HID_UP_MSVENDOR:
 			goto ignore;
 
-		case HID_UP_CUSTOM: /* Reported on Logitech and Powerbook USB keyboards */
-
-			set_bit(EV_REP, input->evbit);
-			switch(usage->hid & HID_USAGE) {
-				case 0x003: map_key_clear(KEY_FN);		break;
-				default:    goto ignore;
-			}
-			break;
-
+/*	Who has shit who in his head for this? The need for XFree/Xorg to change their
+ *	input drivers? No thanks. (mcp)
+ *		case HID_UP_CUSTOM:*/ /*Reported on Logitech and Powerbook USB keyboards*/
+ /*
+ *			set_bit(EV_REP, input->evbit);
+ *			switch(usage->hid & HID_USAGE) {
+ *				case 0x003: map_key_clear(KEY_FN);		break;
+ *				default:    goto ignore;
+ *			}
+ *			break;
+ */
 		case HID_UP_LOGIVENDOR: /* Reported on Logitech Ultra X Media Remote */
 
 			set_bit(EV_REP, input->evbit);
@@ -380,6 +386,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);
diff -Naur a/drivers/usb/input/hid.h b/drivers/usb/input/hid.h
--- a/drivers/usb/input/hid.h	2005-10-29 12:51:55.000000000 +0200
+++ b/drivers/usb/input/hid.h	2005-10-29 12:51:38.000000000 +0200
@@ -246,6 +246,7 @@
 #define HID_QUIRK_2WHEEL_MOUSE_HACK_5		0x100
 #define HID_QUIRK_2WHEEL_MOUSE_HACK_ON		0x200
 #define HID_QUIRK_2WHEEL_POWERMOUSE		0x400
+#define HID_QUIRK_POWERBOOK_FN_BUTTON		0x800
 
 /*
  * This is the global environment of the parser. This information is

Reply to: