diff options
author | Michel Daenzer <michel@tungstengraphics.com> | 2007-10-24 10:30:37 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2008-01-28 08:51:19 -0500 |
commit | a45d82d19a6c2a717bcc33cff243199b77fa0082 (patch) | |
tree | c0a9a9e4010ae1e09bc3a7dec4c8a890e2949f96 /drivers/hid | |
parent | 81e1a875505f2963f4d22f7e7ade39d764755f9b (diff) |
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>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-input.c | 24 | ||||
-rw-r--r-- | drivers/hid/usbhid/Kconfig | 5 | ||||
-rw-r--r-- | drivers/hid/usbhid/hid-quirks.c | 6 |
3 files changed, 32 insertions, 3 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 85803f183fcc..8c4c908177fa 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
@@ -101,6 +101,22 @@ struct hidinput_key_translation { | |||
101 | 101 | ||
102 | #define APPLE_FLAG_FKEY 0x01 | 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 | static struct hidinput_key_translation powerbook_fn_keys[] = { | 120 | static struct hidinput_key_translation powerbook_fn_keys[] = { |
105 | { KEY_BACKSPACE, KEY_DELETE }, | 121 | { KEY_BACKSPACE, KEY_DELETE }, |
106 | { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY }, | 122 | { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY }, |
@@ -178,7 +194,10 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, | |||
178 | if (hid_apple_fnmode) { | 194 | if (hid_apple_fnmode) { |
179 | int do_translate; | 195 | int do_translate; |
180 | 196 | ||
181 | trans = find_translation(powerbook_fn_keys, usage->code); | 197 | trans = find_translation((hid->product < 0x220 || |
198 | hid->product >= 0x300) ? | ||
199 | powerbook_fn_keys : apple_fn_keys, | ||
200 | usage->code); | ||
182 | if (trans) { | 201 | if (trans) { |
183 | if (test_bit(usage->code, hid->apple_pressed_fn)) | 202 | if (test_bit(usage->code, hid->apple_pressed_fn)) |
184 | do_translate = 1; | 203 | do_translate = 1; |
@@ -236,6 +255,9 @@ static void hidinput_apple_setup(struct input_dev *input) | |||
236 | set_bit(KEY_NUMLOCK, input->keybit); | 255 | set_bit(KEY_NUMLOCK, input->keybit); |
237 | 256 | ||
238 | /* Enable all needed keys */ | 257 | /* Enable all needed keys */ |
258 | for (trans = apple_fn_keys; trans->from; trans++) | ||
259 | set_bit(trans->to, input->keybit); | ||
260 | |||
239 | for (trans = powerbook_fn_keys; trans->from; trans++) | 261 | for (trans = powerbook_fn_keys; trans->from; trans++) |
240 | set_bit(trans->to, input->keybit); | 262 | set_bit(trans->to, input->keybit); |
241 | 263 | ||
diff --git a/drivers/hid/usbhid/Kconfig b/drivers/hid/usbhid/Kconfig index c557d7040a69..7160fa65d79b 100644 --- a/drivers/hid/usbhid/Kconfig +++ b/drivers/hid/usbhid/Kconfig | |||
@@ -25,12 +25,13 @@ comment "Input core support is needed for USB HID input layer or HIDBP support" | |||
25 | depends on USB_HID && INPUT=n | 25 | depends on USB_HID && INPUT=n |
26 | 26 | ||
27 | config USB_HIDINPUT_POWERBOOK | 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 | default n | 29 | default n |
30 | depends on USB_HID | 30 | depends on USB_HID |
31 | help | 31 | help |
32 | Say Y here if you want support for the special keys (Fn, Numlock) on | 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 | If unsure, say N. | 36 | If unsure, say N. |
36 | 37 | ||
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 127f24a93b09..3304b0ab39f7 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -59,6 +59,9 @@ | |||
59 | #define USB_DEVICE_ID_APPLE_GEYSER4_ANSI 0x021a | 59 | #define USB_DEVICE_ID_APPLE_GEYSER4_ANSI 0x021a |
60 | #define USB_DEVICE_ID_APPLE_GEYSER4_ISO 0x021b | 60 | #define USB_DEVICE_ID_APPLE_GEYSER4_ISO 0x021b |
61 | #define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021c | 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 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a | 65 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a |
63 | #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b | 66 | #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b |
64 | #define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242 | 67 | #define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242 |
@@ -551,6 +554,9 @@ static const struct hid_blacklist { | |||
551 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 554 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
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}, | 555 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, |
553 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 556 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
557 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI, HID_QUIRK_APPLE_HAS_FN }, | ||
558 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, | ||
559 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS, HID_QUIRK_APPLE_HAS_FN }, | ||
554 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 560 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
555 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 561 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
556 | 562 | ||