Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

HID: Add support for Apple aluminum USB keyboards.

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>

authored by

Michel Daenzer and committed by
Jiri Kosina
a45d82d1 81e1a875

+32 -3
+23 -1
drivers/hid/hid-input.c
··· 101 101 102 102 #define APPLE_FLAG_FKEY 0x01 103 103 104 + static struct hidinput_key_translation apple_fn_keys[] = { 105 + { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY }, 106 + { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY }, 107 + { KEY_F3, KEY_CYCLEWINDOWS, APPLE_FLAG_FKEY }, /* Exposé */ 108 + { KEY_F4, KEY_FN_F4, APPLE_FLAG_FKEY }, /* Dashboard */ 109 + { KEY_F5, KEY_FN_F5 }, 110 + { KEY_F6, KEY_FN_F6 }, 111 + { KEY_F7, KEY_BACK, APPLE_FLAG_FKEY }, 112 + { KEY_F8, KEY_PLAYPAUSE, APPLE_FLAG_FKEY }, 113 + { KEY_F9, KEY_FORWARD, APPLE_FLAG_FKEY }, 114 + { KEY_F10, KEY_MUTE, APPLE_FLAG_FKEY }, 115 + { KEY_F11, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY }, 116 + { KEY_F12, KEY_VOLUMEUP, APPLE_FLAG_FKEY }, 117 + { } 118 + }; 119 + 104 120 static struct hidinput_key_translation powerbook_fn_keys[] = { 105 121 { KEY_BACKSPACE, KEY_DELETE }, 106 122 { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY }, ··· 194 178 if (hid_apple_fnmode) { 195 179 int do_translate; 196 180 197 - trans = find_translation(powerbook_fn_keys, usage->code); 181 + trans = find_translation((hid->product < 0x220 || 182 + hid->product >= 0x300) ? 183 + powerbook_fn_keys : apple_fn_keys, 184 + usage->code); 198 185 if (trans) { 199 186 if (test_bit(usage->code, hid->apple_pressed_fn)) 200 187 do_translate = 1; ··· 255 236 set_bit(KEY_NUMLOCK, input->keybit); 256 237 257 238 /* Enable all needed keys */ 239 + for (trans = apple_fn_keys; trans->from; trans++) 240 + set_bit(trans->to, input->keybit); 241 + 258 242 for (trans = powerbook_fn_keys; trans->from; trans++) 259 243 set_bit(trans->to, input->keybit); 260 244
+3 -2
drivers/hid/usbhid/Kconfig
··· 25 25 depends on USB_HID && INPUT=n 26 26 27 27 config USB_HIDINPUT_POWERBOOK 28 - bool "Enable support for iBook/PowerBook/MacBook/MacBookPro special keys" 28 + bool "Enable support for Apple laptop/aluminum USB special keys" 29 29 default n 30 30 depends on USB_HID 31 31 help 32 32 Say Y here if you want support for the special keys (Fn, Numlock) on 33 - Apple iBooks, PowerBooks, MacBooks and MacBook Pros. 33 + Apple iBooks, PowerBooks, MacBooks, MacBook Pros and aluminum USB 34 + keyboards. 34 35 35 36 If unsure, say N. 36 37
+6
drivers/hid/usbhid/hid-quirks.c
··· 59 59 #define USB_DEVICE_ID_APPLE_GEYSER4_ANSI 0x021a 60 60 #define USB_DEVICE_ID_APPLE_GEYSER4_ISO 0x021b 61 61 #define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021c 62 + #define USB_DEVICE_ID_APPLE_ALU_ANSI 0x0220 63 + #define USB_DEVICE_ID_APPLE_ALU_ISO 0x0221 64 + #define USB_DEVICE_ID_APPLE_ALU_JIS 0x0222 62 65 #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a 63 66 #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b 64 67 #define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242 ··· 554 551 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, 555 552 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, 556 553 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, 554 + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI, HID_QUIRK_APPLE_HAS_FN }, 555 + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, 556 + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS, HID_QUIRK_APPLE_HAS_FN }, 557 557 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, 558 558 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, 559 559