]> err.no Git - linux-2.6/commitdiff
HID: Add support for Apple aluminum USB keyboards.
authorMichel Daenzer <michel@tungstengraphics.com>
Wed, 24 Oct 2007 14:30:37 +0000 (16:30 +0200)
committerJiri Kosina <jkosina@suse.cz>
Mon, 28 Jan 2008 13:51:19 +0000 (14:51 +0100)
Reuse the existing quirks for Apple laptop USB keyboards.

Signed-off-by: Michel Daenzer <michel@tungstengraphics.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-input.c
drivers/hid/usbhid/Kconfig
drivers/hid/usbhid/hid-quirks.c

index 85803f183fcc08d216a1ba71f6d25af5038e7b52..8c4c908177fa6dfdccebc52d17d213fe11f60490 100644 (file)
@@ -101,6 +101,22 @@ struct hidinput_key_translation {
 
 #define APPLE_FLAG_FKEY 0x01
 
+static struct hidinput_key_translation apple_fn_keys[] = {
+       { 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 },
+       { }
+};
+
 static struct hidinput_key_translation powerbook_fn_keys[] = {
        { KEY_BACKSPACE, KEY_DELETE },
        { KEY_F1,       KEY_BRIGHTNESSDOWN,     APPLE_FLAG_FKEY },
@@ -178,7 +194,10 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
        if (hid_apple_fnmode) {
                int do_translate;
 
-               trans = find_translation(powerbook_fn_keys, usage->code);
+               trans = find_translation((hid->product < 0x220 ||
+                                         hid->product >= 0x300) ?
+                                        powerbook_fn_keys : apple_fn_keys,
+                                        usage->code);
                if (trans) {
                        if (test_bit(usage->code, hid->apple_pressed_fn))
                                do_translate = 1;
@@ -236,6 +255,9 @@ static void hidinput_apple_setup(struct input_dev *input)
        set_bit(KEY_NUMLOCK, input->keybit);
 
        /* Enable all needed keys */
+       for (trans = apple_fn_keys; trans->from; trans++)
+               set_bit(trans->to, input->keybit);
+
        for (trans = powerbook_fn_keys; trans->from; trans++)
                set_bit(trans->to, input->keybit);
 
index c557d7040a69a946ea91458ef8724dab85247c2a..7160fa65d79bd2f2dea4730e138bc59f96d81ce9 100644 (file)
@@ -25,12 +25,13 @@ comment "Input core support is needed for USB HID input layer or HIDBP support"
        depends on USB_HID && INPUT=n
 
 config USB_HIDINPUT_POWERBOOK
-       bool "Enable support for iBook/PowerBook/MacBook/MacBookPro special keys"
+       bool "Enable support for Apple laptop/aluminum USB special keys"
        default n
        depends on USB_HID
        help
          Say Y here if you want support for the special keys (Fn, Numlock) on
-         Apple iBooks, PowerBooks, MacBooks and MacBook Pros.
+         Apple iBooks, PowerBooks, MacBooks, MacBook Pros and aluminum USB
+         keyboards.
 
          If unsure, say N.
 
index 127f24a93b098e8bce57fecd845837701afdf685..3304b0ab39f7547c550a7ba2a4388d9275884374 100644 (file)
@@ -59,6 +59,9 @@
 #define USB_DEVICE_ID_APPLE_GEYSER4_ANSI       0x021a
 #define USB_DEVICE_ID_APPLE_GEYSER4_ISO        0x021b
 #define USB_DEVICE_ID_APPLE_GEYSER4_JIS        0x021c
+#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_FOUNTAIN_TP_ONLY   0x030a
 #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY    0x030b
 #define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242
@@ -551,6 +554,9 @@ static const struct hid_blacklist {
        { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
        { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD},
        { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
+       { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI, HID_QUIRK_APPLE_HAS_FN },
+       { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD },
+       { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS, HID_QUIRK_APPLE_HAS_FN },
        { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
        { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },