← Back to team overview

mactel-support team mailing list archive

[Bug 207127] Re: fn key doesn't work in hardy with macbook pro fourth generation (4, 1)

 

Okay, I did some more digging regarding the F4-F6 keys: turns out older
macbooks had no secondary functionality for those keys, so the lookup
table in drivers/hid/hid-input.c reads:

static struct hidinput_key_translation apple_fn_keys[] = {
	{ KEY_BACKSPACE, KEY_DELETE },
	{ KEY_F1,       KEY_BRIGHTNESSDOWN,     APPLE_FLAG_FKEY },
	{ KEY_F2,       KEY_BRIGHTNESSUP,       APPLE_FLAG_FKEY },
	{ KEY_F3,       KEY_CYCLEWINDOWS,       APPLE_FLAG_FKEY }, /* Exposé */
	{ KEY_F4,       KEY_FN_F4,              APPLE_FLAG_FKEY }, /* Dashboard */
	{ KEY_F5,       KEY_FN_F5 },
	{ KEY_F6,       KEY_FN_F6 },
	{ KEY_F7,       KEY_BACK,               APPLE_FLAG_FKEY },
	{ KEY_F8,       KEY_PLAYPAUSE,          APPLE_FLAG_FKEY },
	{ KEY_F9,       KEY_FORWARD,            APPLE_FLAG_FKEY },
	{ KEY_F10,      KEY_MUTE,               APPLE_FLAG_FKEY },
	{ KEY_F11,      KEY_VOLUMEDOWN,         APPLE_FLAG_FKEY },
	{ KEY_F12,      KEY_VOLUMEUP,           APPLE_FLAG_FKEY },
	{ KEY_UP,       KEY_PAGEUP },
	{ KEY_DOWN,     KEY_PAGEDOWN },
	{ KEY_LEFT,     KEY_HOME },
	{ KEY_RIGHT,    KEY_END },
	{ }
};

Changing the F4, F5 lines to:
	{ KEY_F5,       KEY_KBDILLUMDOWN,       APPLE_FLAG_FKEY },
	{ KEY_F6,       KEY_KBDILLUMUP,         APPLE_FLAG_FKEY },

Adds the desired functionality (that is you get key codes in xev when
pressing fn+F5/F6). However, it does not affect the backlight state of
my keyboard (running pommed 1.18).

Key observations:
KEY_FN_F* does not produce key codes in xev.
KEY_KBDILLUMUP, KEY_KBDILLUMDOWN seems to be the correct setting for fn+F5, fn+F6. Looking at the source, no constant seems to have been defined for the dashboard key... APPLE_FLAG_FKEY specifies the default key state.

This cannot be fixed dynamically. As it's unrelated to the fn key
problem I won't add it to the above patch. However, I've included a
compiled hid module for amd64, with the above changes (it also has my
patch applied so the fn key will work out of the box without the dynamic
quirk).

I consider the fn key problem fixed. Hopefully someone with more
experience than me will commit this patch to the source so that it makes
it into the next update cycle ;)

** Attachment added: "hid.tar.gz"
   http://launchpadlibrarian.net/14649798/hid.tar.gz

-- 
fn key doesn't work in hardy with macbook pro fourth generation (4,1)
https://bugs.launchpad.net/bugs/207127
You received this bug notification because you are a member of Mactel
Support, which is the registrant for Mactel Support.

Status in Mactel Support: In Progress
Status in Source Package "linux-meta" in Ubuntu: Confirmed

Bug description:
hardware:  macbook pro generation 4,1 (feb 2008)
problem:  fn key not detected
test:  run xev.  press fn key.  nothing happens.
consequences:  home/end/pgup/pgdown don't work.

i was able to fix this issue by compiling my own kernel.
i downloaded linux-source from ubuntu hardy
(VERSION = 2,PATCHLEVEL = 6,SUBLEVEL = 24,EXTRAVERSION = .3)

and revised this file:
 drivers/hid/usbhid/hid-quirks.c 

used lsusb to grab the id of the internal keyboard device:
  Bus 005 Device 003: ID 05ac:0230 Apple Computer, Inc.

and revised the c file accordingly:

/* next line commented out by eitan and replaced with line below;
  changing address for device from 0x021b to 0x0230 which is what lsusb tells me
  my internal keyboard device id actually is
#define USB_DEVICE_ID_APPLE_GEYSER4_ISO 0x021b
 */
#define USB_DEVICE_ID_APPLE_GEYSER4_ISO 0x0230

rebooting with the new kernel, the fn key now works.
i don't know if this breaks other versions of the macbook pro
and am otherwise ignorant of the linux kernel source code.

thanks,
/ eitan