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

fn-key on kernel 2.6.12



Hello,

currently I try to switch my laptop to kernel 2.6.12.
One of the problems I encountered is, that the fn-key
does not work properly under X11 any more.

I use plain 2.6.12 with the appended patch applied.  This
patch is my attempt to port Johannes Berg's fn-key patch
to the kernel version 2.6.12.  I also use my xkb keybindings
from http://seehuhn.de/comp/powerbook/ .  Under 2.6.11
this made fn-up produce pageup etc.

The problem: under 2.6.12 fn-up does no longer give pageup.

xev shows that something weird is going on.  If I press fn,
press up, release up, and release fn I get the following
sequence of X events (obtained with xev) under 2.6.11.
Note that Super_L is what I map the fn-key to.

  KeyPress event, serial 27, synthetic NO, window 0x2200001, ...,
      state 0x0, keycode 109 (keysym 0xffeb, Super_L), same_screen YES, ...

  KeyPress event, serial 27, synthetic NO, window 0x2200001, ...,
      state 0x4000, keycode 98 (keysym 0xff55, Prior), same_screen YES, ...

  KeyRelease event, serial 27, synthetic NO, window 0x2200001, ...,
      state 0x4000, keycode 98 (keysym 0xff55, Prior), same_screen YES, ...

  KeyRelease event, serial 27, synthetic NO, window 0x2200001, ...,
      state 0x4000, keycode 109 (keysym 0xffeb, Super_L), same_screen YES, ...

This is what I would expect.  When I boot the machine with 2.6.12 but
change nothing else, the same sequence of key presses leads to the
following weird sequence of X events:

  KeyPress event, serial 27, synthetic NO, window 0x2200001, ...
      state 0x0, keycode 109 (keysym 0xffeb, Super_L), same_screen YES, ...

  KeyRelease event, serial 27, synthetic NO, window 0x2200001, ...
      state 0x4000, keycode 109 (keysym 0xffeb, Super_L), same_screen YES, ...

  KeyPress event, serial 27, synthetic NO, window 0x2200001, ...
      state 0x0, keycode 98 (keysym 0xff52, Up), same_screen YES, ...

  KeyPress event, serial 27, synthetic NO, window 0x2200001, ...
      state 0x0, keycode 109 (keysym 0xffeb, Super_L), same_screen YES, ...

  KeyRelease event, serial 27, synthetic NO, window 0x2200001, ...
      state 0x4000, keycode 109 (keysym 0xffeb, Super_L), same_screen YES, ...

  KeyRelease event, serial 27, synthetic NO, window 0x2200001, ...
      state 0x0, keycode 98 (keysym 0xff52, Up), same_screen YES, ...

  KeyPress event, serial 27, synthetic NO, window 0x2200001, ...
      state 0x0, keycode 109 (keysym 0xffeb, Super_L), same_screen YES, ...

  KeyRelease event, serial 27, synthetic NO, window 0x2200001, ...
      state 0x4000, keycode 109 (keysym 0xffeb, Super_L), same_screen YES, ...

Since the X server wrongly believes that fn is released while I press up,
I do not get pageup any more.

Has anybody an idea what is going on here?
Help would be very much appreciated.

All the best,
Jochen

======================================================================
diff -ur linux-2.6.12.tmp/drivers/usb/input/hid-core.c linux-2.6.12/drivers/usb/input/hid-core.c
--- linux-2.6.12.tmp/drivers/usb/input/hid-core.c	2005-06-21 21:00:26.000000000 +0100
+++ linux-2.6.12/drivers/usb/input/hid-core.c	2005-06-21 21:27:30.000000000 +0100
@@ -1421,6 +1421,9 @@
 #define USB_DEVICE_ID_VERNIER_SKIP	0x0003
 #define USB_DEVICE_ID_VERNIER_CYCLOPS	0x0004
 
+#define USB_VENDOR_ID_APPLE		0x05AC
+#define USB_DEVICE_ID_POWERBOOK_KB_US	0x020E
+#define USB_DEVICE_ID_POWERBOOK_KB_UK	0x020F
 
 /*
  * Alphabetically sorted blacklist by quirk type.
@@ -1523,6 +1526,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_UK, HID_QUIRK_POWERBOOK_FN_BUTTON },
+	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_POWERBOOK_KB_US, HID_QUIRK_POWERBOOK_FN_BUTTON },
+
 	{ 0, 0 }
 };
 
diff -ur linux-2.6.12.tmp/drivers/usb/input/hid-input.c linux-2.6.12/drivers/usb/input/hid-input.c
--- linux-2.6.12.tmp/drivers/usb/input/hid-input.c	2005-06-21 21:00:26.000000000 +0100
+++ linux-2.6.12/drivers/usb/input/hid-input.c	2005-06-21 21:24:50.000000000 +0100
@@ -408,6 +408,11 @@
 	if (!usage->type)
 		return;
 
+	if ((hid->quirks & HID_QUIRK_POWERBOOK_FN_BUTTON) && (usage->type == EV_ABS) && (usage->code == 40)) {
+		input_event(input, EV_KEY, 0x61 /* seems to be Control_R in X which this KB doesn't have */, value);
+		return;
+	}
+
 	if (((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_5) && (usage->hid == 0x00090005))
 		|| ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_7) && (usage->hid == 0x00090007))) {
 		if (value) hid->quirks |=  HID_QUIRK_2WHEEL_MOUSE_HACK_ON;
diff -ur linux-2.6.12.tmp/drivers/usb/input/hid.h linux-2.6.12/drivers/usb/input/hid.h
--- linux-2.6.12.tmp/drivers/usb/input/hid.h	2005-06-21 21:00:26.000000000 +0100
+++ linux-2.6.12/drivers/usb/input/hid.h	2005-06-21 21:24:52.000000000 +0100
@@ -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
======================================================================

Attachment: signature.asc
Description: Digital signature


Reply to: