id of apple aluminum wireless keyboard changed??

Bug #227501 reported by MrMEEE
22
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Fix Released
Undecided
Unassigned
Declined for Dapper by Stefan Bader
Declined for Feisty by Stefan Bader
Declined for Gutsy by Stefan Bader
Declined for Intrepid by Stefan Bader
Hardy
Fix Released
Medium
Bryan Wu

Bug Description

SRU Justification:

Impact: This bug causes missing support for the "Fn"-key on the Apple Wireless Keyboard

Fix: This patch based on an upstream patch since 2.6.28 (and is contained in Jaunty) and a backport patch in Intrepid kernel

Testcase: Make sure that "Fn" key works on the Apple Wirelss Keyboard

---

falcon test # lsb_release -rd
Description: Ubuntu 8.04
Release: 8.04

linux-image-generic:
  Installeret: 2.6.24.17.19
  Kandidat: 2.6.24.17.19
  Versionstabel:
 *** 2.6.24.17.19 0
        500 http://se.archive.ubuntu.com hardy-proposed/main Packages
        100 /var/lib/dpkg/status
     2.6.24.16.18 0
        500 http://se.archive.ubuntu.com hardy/main Packages

Using the 2.6.24-7 kernel as well as the 2.6.24-6 kernel:

I'm missing support for the "Fn"-key on my Apple Wireless Keyboard...

hidd gives me:

00:1B:63:FD:3D:6F Apple Inc. Keyboard [05ac:022d] connected

If I in:

linux-2.6.24/net/bluetooth/hidp/core.c

changes

        { 0x05ac, 0x022c, HID_QUIRK_APPLE_HAS_FN },

to

        { 0x05ac, 0x022d, HID_QUIRK_APPLE_HAS_FN },

Then it works...

This patch is only tested on compiling the 2.6.24-6 source... but should work on the 2.6.24-7 as well...

there are probably different versions of the keyboard out there... is it not possible to include both???

By the way, can anyone tell me why:

apt-get source linux-image-2.6.24-17-generic

fetches the 2.6.24-16 kernel???.... Output:

falcon ~ # apt-get source linux-image-2.6.24-17-generic
Indlæser pakkelisterne... Færdig
Opbygger afhængighedstræ
Læser tilstandsoplysninger... Færdig
Overspringer allerede hentet fil 'linux_2.6.24-16.30.dsc'
Overspringer allerede hentet fil 'linux_2.6.24.orig.tar.gz'
Overspringer allerede hentet fil 'linux_2.6.24-16.30.diff.gz'
0B skal hentes fra kildetekst-arkiverne.
Overspringer udpakning af allerede udpakket kildetekst i linux-2.6.24

Sry... it is in Danish... but you'll get the idea.. it fetches version 2.6.24-16 instead of 2.6.24-17...

Revision history for this message
MrMEEE (mj-casalogic) wrote :

I found out that adding
        { 0x05ac, 0x022d, HID_QUIRK_APPLE_HAS_FN },

under
        { 0x05ac, 0x022c, HID_QUIRK_APPLE_HAS_FN },

fixes the problem too....

Can we have this added to the kernel...

Revision history for this message
MrMEEE (mj-casalogic) wrote :

This is really easy to fix... Could someone please implement it into the kernel???

Revision history for this message
MrMEEE (mj-casalogic) wrote :

I can confirm that the fix also works for kernel 2.6.24-18 and 2.6.24-19...

Revision history for this message
Víctor Jiménez (capitangolo) wrote :

It's also working for 2.6.24-20

Revision history for this message
Ben Challenor (ben-challenor) wrote :

I can confirm that this change works in 2.6.24-19 with a UK Apple Wireless Keyboard.

Very similar issues are dealt with in /usr/src/linux-source-2.6.24/drivers/hid/usbhid/hid-quirks.c:

#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI 0x022c
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO 0x022d
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS 0x022e

From this I gather that 0x022c (already working) is the US model - which would explain why you don't see many other people complaining!

But if we fix 0x022d for ourselves then we should also fix 0x022e for the Japanese.

net/bluetooth/hidp/core.c should probably use the symbols defined in hid-quirks.c. I don't know how these files relate though. Note also that the ISO keyboard has its own special quirk, HID_QUIRK_APPLE_ISO_KEYBOARD. I'm not sure what this affects.

Revision history for this message
Víctor Jiménez (capitangolo) wrote :

A quick patch for intrepid.

hid-quirks.c is the key.

Revision history for this message
MrMEEE (mj-casalogic) wrote :

I can't get it to work in Intrepid... the fn-button has effect...

Does this actually work for you, GoLo???

Revision history for this message
MrMEEE (mj-casalogic) wrote :

I think this might be related to some bluetooth bug in intrepid...

Currently, hidd is missing in the bluez-utils package... Even if I compile the package myself, with hidd support, it doesn't work...

hidd gives me:

root@falcon:/var/log# hidd
00:14:51:CE:46:A8 martins mus [0000:0000] connected
00:1B:63:FD:3D:6F Apple Wireless Keyboard [0000:0000] connected

So there seems to be some problem with bluez, not fetching the id... and this is probably why it doesn't work???

Anyone got any ideas??

Revision history for this message
Víctor Jiménez (capitangolo) wrote :

Searching in http://packages.ubuntu.com I found hidd on bluez-compat

Keyboard working, but fn-key still broken.

Revision history for this message
MrMEEE (mj-casalogic) wrote :

I confirm this.. but I still think that the problem has changed... it used to be a missing implementation in the kernel... now it's the problem I descriped above...

Changed in linux:
status: Fix Committed → Confirmed
Revision history for this message
Dominik (dominalien) wrote :

I can confirm both problems in Intrepid.

First: the European Apple Wireless Keyboard's id is 0x022d. Adding this manually to core.c of the hidp module and recompiling the module used to work in 7.10 for me.

Second: now in 8.10, even after recompiling the module, the FN-key still doesn't work. hidd returns

xx:xx:xx:xx:xx:xx Apple Wireless Keyboard [0000:0000] connected

just the way MrMEEE said. For me also it used to return manufacturer/product codes.

I installed a new version of bluez (4.31), but the values returned are still 0000:0000.

Who should I report this to? Is this the fault of bluez? It's really annoying that the Apple Keyboard's FN key doesn't work, even after jumping through the hoops of patching and recompiling the module.

Also, shouldn't adding the quirk be some sort of a load option for hidp? e.g. modprobe hidp option=HID_QUIRK_APPLE_HAS_FN so new keyboards will not have to be explicitly implemented in module code and users can simply enable additional buttons through module options?

Revision history for this message
Dominik (dominalien) wrote :

Sorry for posting again.

Just tested this on openSuse 11.1 and:

The kernel it came with (2.6.27.7-9 in SUSE-speak) did not have quirks for any of the Apple keyboards. Predictably, the FN-key didn't work.

I just updated the kernel to the latest available version (2.6.27.19-3.2) and it has all the quirks already in the code (for the three variants of the Apple wireless keyboard - a, b and c). After restarting the computer, the FN-key on the keyboard works immediately.

I didn't test the output of hidd, because it has been removed from openSUSE completely and I'd have to compile it by hand, but I assume the manufacturer/product codes must be returned correctly.

The bluez package in openSUSE 11.1 is at 4.19, in case it's important.

Thanks,

Revision history for this message
Dominik (dominalien) wrote :

A prolific day for posts from me.

I got this working on Intrepid, in the end.

After I installed bluez 4.31 and restarted the computer the FN-key did not work. But then I started openSUSE and had to pair the keyboard again with it (it's the same machine and the same bluetooth dongle, but somehow I need to pair the keyboard again every time I switch systems or it won't connect) and coming back to Ubuntu I paired it once more.

And now, the FN-key works, miraculously.

So, perhaps upgrading bluez together with re-pairing the keyboard did the trick, somehow.

Revision history for this message
Víctor Jiménez (capitangolo) wrote :

Fn Key and <> key are working for me too on intrepid with the last update.

Dominik, the repairing is only needed with the keyboard? Have you tried other devices?

Revision history for this message
Dominik (dominalien) wrote :

I have no other devices paired, sorry.

However, as an added bonus, now the keyboard continues to work after reboot/wake from sleep. Starting to type makes it reconnect with the computer (there's a short delay before characters appear on screen). No more turning it off and on again :-)

Revision history for this message
Bryan Wu (cooloney) wrote :

Intrepid has already included the back ported patch to support fix this issue. I will post a SRU patch for hardy to kernel team review, if it is OK for hardy LTS kernel, we merge it into hardy kernel.

-Bryan

Changed in linux (Ubuntu):
status: Confirmed → Fix Committed
Bryan Wu (cooloney)
Changed in linux (Ubuntu):
status: Fix Committed → Fix Released
Stefan Bader (smb)
Changed in linux (Ubuntu Hardy):
assignee: nobody → Bryan Wu (cooloney)
importance: Undecided → Medium
status: New → Fix Committed
description: updated
Revision history for this message
Martin Pitt (pitti) wrote :

Accepted linux into hardy-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

tags: added: verification-needed
Steve Beattie (sbeattie)
tags: added: hw-specific
Revision history for this message
Steve Langasek (vorlon) wrote :

Can the users experiencing this bug please test the kernel in hardy-proposed and let us know whether it's fixed there?

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux - 2.6.24-24.56

---------------
linux (2.6.24-24.56) hardy-proposed; urgency=low

  [Stefan Bader]

  * Rebuild of 2.6.24-24.54 with 2.6.24-24.55 security release applied

linux (2.6.24-24.54) hardy-proposed; urgency=low

  [Andy Whitcroft]

  * SAUCE: do not make sysdev links for processors which are not booted
    - LP: #295091

  [Brad Figg]

  * SAUCE: Add information to recognize Toshiba Satellite Pro M10 Alps Touchpad
    - LP: #330885
  * SAUCE: Add signatures to airprime driver to support newer Novatel devices
    - LP: #365291

  [Stefan Bader]

  * SAUCE: vgacon: Return the upper half of 512 character fonts
    - LP: #355057

  [Upstream Kernel Changes]

  * SUNRPC: Fix autobind on cloned rpc clients
    - LP: #341783, #212485
  * Input: atkbd - mark keyboard as disabled when suspending/unloading
    - LP: #213988
  * x86: mtrr: don't modify RdDram/WrDram bits of fixed MTRRs
    - LP: #292619
  * sis190: add identifier for Atheros AR8021 PHY
    - LP: #247889
  * bluetooth hid: enable quirk handling for Apple Wireless Keyboards in
    2.6.24
    - LP: #227501
  * nfsd: move callback rpc_client creation into separate thread
    - LP: #253004
  * nfsd4: probe callback channel only once
    - LP: #253004

 -- Stefan Bader <email address hidden> Sat, 20 Jun 2009 00:14:36 +0200

Changed in linux (Ubuntu Hardy):
status: Fix Committed → Fix Released
Revision history for this message
John Doe (johndoe-deactivatedaccount-deactivatedaccount) wrote :

kernel 2.6.28-15 on Jaunty 9.04 - `fn` key doesn't work for me either. but what strange thing I've got is keyboard id. It's different from those provided by hid-ids.h:
...
#define USB_DEVICE_ID_APPLE_ALU_ANSI 0x0220
#define USB_DEVICE_ID_APPLE_ALU_ISO 0x0221
#define USB_DEVICE_ID_APPLE_ALU_JIS 0x0222
...
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI 0x022c
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO 0x022d
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS 0x022e
...
hidd output is:
xx:xx:xx:xx:xx:xx Apple Wireless Keyboard [05ac:023a] connected
lshal output says:
...
udi = '/org/freedesktop/Hal/devices/bluetooth_acl_xxxxxxxxxxxx_logicaldev_input'
  info.addons.singleton = {'hald-addon-input'} (string list)
  info.callouts.add = {'debian-setup-keyboard'} (string list)
  info.capabilities = {'input', 'input.keyboard', 'input.keypad', 'input.keys', 'button'} (string list)
  info.category = 'input' (string)
  info.parent = '/org/freedesktop/Hal/devices/bluetooth_acl_xxxxxxxxxxxx' (string)
  info.product = 'Apple Wireless Keyboard' (string)
  info.subsystem = 'input' (string)
  info.udi = '/org/freedesktop/Hal/devices/bluetooth_acl_xxxxxxxxxxxx_logicaldev_input' (string)
  input.device = '/dev/input/event9' (string)
  input.originating_device = '/org/freedesktop/Hal/devices/bluetooth_acl_xxxxxxxxxxxx' (string)
  input.product = 'Apple Wireless Keyboard' (string)
  input.x11_driver = 'evdev' (string)
  input.xkb.layout = 'us,ru' (string)
  input.xkb.model = 'pc105' (string)
  input.xkb.options = 'grp:alt_shift_toggle,grp_led:scroll' (string)
  input.xkb.rules = 'evdev' (string)
  input.xkb.variant = ',' (string)
  linux.device_file = '/dev/input/event9' (string)
  linux.hotplug_type = 2 (0x2) (int)
  linux.subsystem = 'input' (string)
  linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1a.0/usb3/3-1/3-1:1.0/bluetooth/hci0/hci0:11/input9/event9' (string)
...

Revision history for this message
Daniel Buck (bifkit) wrote :

I've got the same problem in Karmic.

hidd reports my keyboard as [05ac:0239]

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

What modifications I added to kernel without success according to my model:

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

then I added this line into hid-core.c within the same directory as previous file into static const struct hid_device_id hid_blacklist[]:
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_MY) }

and the last modification I did was with hid-apple.c within the same dir 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 && make modules_install`. then reboot, then `modprobe hid-apple`
Am I missed something?

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

Daniel and Andrei, please see the new but I just opened: Bug #499013. As this is a new device, a new bug should be opened, specially if this bug is already marked as fix released.

Andrei, I changed exactly the same things as you and my new kernel is working great. I've now all the keys and functions of this keyboard.

I followed the alternate build method described at https://help.ubuntu.com/community/Kernel/Compile#AltBuildMethod. Additionally, I've changed /etc/modules so that the hid_apple module is loaded right at boot time. Loading it later did not work for me either. Maybe you also want to add the option "fnmode=2" if the key F1 to F12 should be the default.

Anyways, please follow up any issues regarding this new make of the Apple Wireless Keyboard at the bug mentioned above.

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

So here is the solution for the new keyboards with new ids which weren't listed in the kernel:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/499013/comments/2

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.