Comment 2 for bug 499013

Andrei Andreyanau (hatsumeka) wrote :

O.k. so the answer was close to the surface. Here is the recipe:

/usr/src/linux-source/drivers/hid/hid-ids.h: added following line describing my keyboard
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_MY 0x023a

/usr/src/linux-source/drivers/hid/hid-core.c: inserted into static const struct hid_device_id hid_blacklist[]:
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_MY) }

/usr/src/linux-source/drivers/hid/hid-apple.c: inserted into static const struct hid_device_id apple_devices[]:
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_MY),
                .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | APPLE_ISO_KEYBOARD }

After all: make oldconfig && make

Then! Do backup of following modules in the current kernel modules derictories:
/lib/modules/$(uname -r)/kernel/drivers/hid/hid-apple.ko
/lib/modules/$(uname -r)/kernel/drivers/hid/usbhid/usbhid.ko
and replace them with freshly build ones.

Then edit and add into /etc/modules new line with 'hid_apple' and create hid_apple.conf under directory /etc/modprobe.d/ with root previleges and following contents:
# 0 = disabled : Disable the 'fn' key. Pressing 'fn'+'F8' will behave
# like you only press 'F8' 1 = fkeyslast : Function keys are used as
# last key. Pressing 'F8' key will act as a special key. Pressing
# 'fn'+'F8' will behave like a F8. 2 = fkeysfirst : Function keys are
# used as first key. Pressing 'F8' key will behave like a F8. Pressing
# 'fn'+'F8' will act as special key (play/pause).
options hid_apple fnmode=2

Then simply reboot and it will definitely work.
I think (and hope) that the question is solved. Merry coming X-Mas and Happy New Year to everyone!