New "Apple Wireless Keyboard" (2009) not supported

Bug #499013 reported by Christian Schürer-Waldheim
32
This bug affects 6 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Fix Released
Medium
Unassigned
Nominated for Jaunty by John Doe
Nominated for Karmic by John Doe

Bug Description

Apple sells a new make of the "Apple Wireless Keyboard" (starting in November 2009). This model can be recognized that it has only two batteries. The device IDs changed, so the Apple HID driver does not recognize it. I've added the new ID to a local copy of the current kernel in karmic and compiled it. Additionally, I added the module to /etc/modules so that it is loaded at boot time. Loading this module later did not work for me.

The device ID for the European model (ISO) is: 0x023a. The ANSI device ID should be 0x0239 (see https://bugs.edge.launchpad.net/ubuntu/+source/linux/+bug/227501/comments/21). The device ID for the JIS version could probably be 0x023b, assuming apple follows the scheme of previous makes.

I'll post a diff later (have to clean up my changes first), but basically I did what Andrei Andreyanau described in https://bugs.edge.launchpad.net/ubuntu/+source/linux/+bug/227501/comments/22

I checked the source of the latest kernel version on kernel.org and they all do not have this additional IDs in the source files, so please also push the changes upstream.

Revision history for this message
John Doe (johndoe-deactivatedaccount-deactivatedaccount) wrote :

Hi, Christian!
Thanks for your attention and for your message about this problem. Honestly I must say that yesterday I have rebuilt the core and tried to fix this thing again without success. I added a line into /etc/modules to load hid_apple module before system starts and modified /etc/modprobe.d/hid_apple.conf with the following line:
options hid_apple fnmode=2
with giving configuration file following rights:
-rw-r--r-- 1 root root 428 2009-12-09 22:13 hid_apple.conf

After all I rebooted the system and tried to re-configure keyboard shortcuts, but nothing changed at all (hid_apple module is loaded and stays in the memory according to lsmod). Did you make anything else in addition to those modifications I described in https://bugs.launchpad.net/ubuntu/+source/linux/+bug/227501/comments/22?

Revision history for this message
John Doe (johndoe-deactivatedaccount-deactivatedaccount) 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!

Revision history for this message
John Doe (johndoe-deactivatedaccount-deactivatedaccount) wrote :

Forgot to add. Before making backup of `hid-apple.ko` and `usbhid.ko`, make sure you did unload them from the memory (rmmod hid_apple && rmmod usbhid under root privileges).

Revision history for this message
Christian Schürer-Waldheim (quincunx) wrote :

Patch for vanilla 2.6.31.9 kernel

Revision history for this message
Christian Schürer-Waldheim (quincunx) wrote :

Patch for vanilla 2.6.32.2 kernel

Changed in linux (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Andy Whitcroft (apw)
tags: added: kernel-series-unknown
Revision history for this message
Christian Schürer-Waldheim (quincunx) wrote :

My patch got merged into the vanilla kernel 2.6.32, which is now in Ubuntu.

Changed in linux (Ubuntu):
status: Triaged → Fix Released
tags: removed: kernel-series-unknown
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.