Comment 26 for bug 207127

Revision history for this message
Alex Karpenko (alexkarpenko) wrote :

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