Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 1 | /* |
| 2 | * USB HID quirks support for Linux |
| 3 | * |
| 4 | * Copyright (c) 1999 Andreas Gal |
| 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> |
| 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc |
| 7 | * Copyright (c) 2006-2007 Jiri Kosina |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 8 | * Copyright (c) 2008 Jiri Slaby <jirislaby@gmail.com> |
| 9 | */ |
| 10 | |
| 11 | /* |
| 12 | * This program is free software; you can redistribute it and/or modify it |
| 13 | * under the terms of the GNU General Public License as published by the Free |
| 14 | * Software Foundation; either version 2 of the License, or (at your option) |
| 15 | * any later version. |
| 16 | */ |
| 17 | |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 18 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 19 | |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 20 | #include <linux/device.h> |
| 21 | #include <linux/hid.h> |
| 22 | #include <linux/module.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 23 | #include <linux/slab.h> |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 24 | #include <linux/usb.h> |
| 25 | |
| 26 | #include "hid-ids.h" |
| 27 | |
| 28 | #define APPLE_RDESC_JIS 0x0001 |
| 29 | #define APPLE_IGNORE_MOUSE 0x0002 |
| 30 | #define APPLE_HAS_FN 0x0004 |
| 31 | #define APPLE_HIDDEV 0x0008 |
| 32 | #define APPLE_ISO_KEYBOARD 0x0010 |
| 33 | #define APPLE_MIGHTYMOUSE 0x0020 |
| 34 | #define APPLE_INVERT_HWHEEL 0x0040 |
| 35 | #define APPLE_IGNORE_HIDINPUT 0x0080 |
| 36 | #define APPLE_NUMLOCK_EMULATION 0x0100 |
| 37 | |
| 38 | #define APPLE_FLAG_FKEY 0x01 |
| 39 | |
| 40 | static unsigned int fnmode = 1; |
| 41 | module_param(fnmode, uint, 0644); |
| 42 | MODULE_PARM_DESC(fnmode, "Mode of fn key on Apple keyboards (0 = disabled, " |
| 43 | "[1] = fkeyslast, 2 = fkeysfirst)"); |
| 44 | |
Stefan Glasenhardt | 54a6593 | 2010-01-05 23:30:30 +0100 | [diff] [blame] | 45 | static unsigned int iso_layout = 1; |
| 46 | module_param(iso_layout, uint, 0644); |
| 47 | MODULE_PARM_DESC(iso_layout, "Enable/Disable hardcoded ISO-layout of the keyboard. " |
| 48 | "(0 = disabled, [1] = enabled)"); |
| 49 | |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 50 | struct apple_sc { |
| 51 | unsigned long quirks; |
| 52 | unsigned int fn_on; |
| 53 | DECLARE_BITMAP(pressed_fn, KEY_CNT); |
| 54 | DECLARE_BITMAP(pressed_numlock, KEY_CNT); |
| 55 | }; |
| 56 | |
| 57 | struct apple_key_translation { |
| 58 | u16 from; |
| 59 | u16 to; |
| 60 | u8 flags; |
| 61 | }; |
| 62 | |
Edgar (gimli) Hucek | 99b9f75 | 2010-11-03 10:36:18 -0400 | [diff] [blame] | 63 | static const struct apple_key_translation macbookair_fn_keys[] = { |
| 64 | { KEY_BACKSPACE, KEY_DELETE }, |
| 65 | { KEY_ENTER, KEY_INSERT }, |
| 66 | { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY }, |
| 67 | { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY }, |
| 68 | { KEY_F3, KEY_SCALE, APPLE_FLAG_FKEY }, |
| 69 | { KEY_F4, KEY_DASHBOARD, APPLE_FLAG_FKEY }, |
| 70 | { KEY_F6, KEY_PREVIOUSSONG, APPLE_FLAG_FKEY }, |
| 71 | { KEY_F7, KEY_PLAYPAUSE, APPLE_FLAG_FKEY }, |
| 72 | { KEY_F8, KEY_NEXTSONG, APPLE_FLAG_FKEY }, |
| 73 | { KEY_F9, KEY_MUTE, APPLE_FLAG_FKEY }, |
| 74 | { KEY_F10, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY }, |
| 75 | { KEY_F11, KEY_VOLUMEUP, APPLE_FLAG_FKEY }, |
| 76 | { KEY_F12, KEY_EJECTCD, APPLE_FLAG_FKEY }, |
| 77 | { KEY_UP, KEY_PAGEUP }, |
| 78 | { KEY_DOWN, KEY_PAGEDOWN }, |
| 79 | { KEY_LEFT, KEY_HOME }, |
| 80 | { KEY_RIGHT, KEY_END }, |
| 81 | { } |
| 82 | }; |
| 83 | |
Paul Collins | b2ddd54 | 2009-03-07 17:07:15 +1300 | [diff] [blame] | 84 | static const struct apple_key_translation apple_fn_keys[] = { |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 85 | { KEY_BACKSPACE, KEY_DELETE }, |
Henrik Rydberg | 437184a | 2008-11-04 13:31:38 +0100 | [diff] [blame] | 86 | { KEY_ENTER, KEY_INSERT }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 87 | { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY }, |
| 88 | { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY }, |
Henrik Rydberg | 437184a | 2008-11-04 13:31:38 +0100 | [diff] [blame] | 89 | { KEY_F3, KEY_SCALE, APPLE_FLAG_FKEY }, |
| 90 | { KEY_F4, KEY_DASHBOARD, APPLE_FLAG_FKEY }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 91 | { KEY_F5, KEY_KBDILLUMDOWN, APPLE_FLAG_FKEY }, |
| 92 | { KEY_F6, KEY_KBDILLUMUP, APPLE_FLAG_FKEY }, |
| 93 | { KEY_F7, KEY_PREVIOUSSONG, APPLE_FLAG_FKEY }, |
| 94 | { KEY_F8, KEY_PLAYPAUSE, APPLE_FLAG_FKEY }, |
| 95 | { KEY_F9, KEY_NEXTSONG, APPLE_FLAG_FKEY }, |
| 96 | { KEY_F10, KEY_MUTE, APPLE_FLAG_FKEY }, |
| 97 | { KEY_F11, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY }, |
| 98 | { KEY_F12, KEY_VOLUMEUP, APPLE_FLAG_FKEY }, |
| 99 | { KEY_UP, KEY_PAGEUP }, |
| 100 | { KEY_DOWN, KEY_PAGEDOWN }, |
| 101 | { KEY_LEFT, KEY_HOME }, |
| 102 | { KEY_RIGHT, KEY_END }, |
| 103 | { } |
| 104 | }; |
| 105 | |
Paul Collins | b2ddd54 | 2009-03-07 17:07:15 +1300 | [diff] [blame] | 106 | static const struct apple_key_translation powerbook_fn_keys[] = { |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 107 | { KEY_BACKSPACE, KEY_DELETE }, |
| 108 | { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY }, |
| 109 | { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY }, |
| 110 | { KEY_F3, KEY_MUTE, APPLE_FLAG_FKEY }, |
| 111 | { KEY_F4, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY }, |
| 112 | { KEY_F5, KEY_VOLUMEUP, APPLE_FLAG_FKEY }, |
| 113 | { KEY_F6, KEY_NUMLOCK, APPLE_FLAG_FKEY }, |
| 114 | { KEY_F7, KEY_SWITCHVIDEOMODE, APPLE_FLAG_FKEY }, |
| 115 | { KEY_F8, KEY_KBDILLUMTOGGLE, APPLE_FLAG_FKEY }, |
| 116 | { KEY_F9, KEY_KBDILLUMDOWN, APPLE_FLAG_FKEY }, |
| 117 | { KEY_F10, KEY_KBDILLUMUP, APPLE_FLAG_FKEY }, |
| 118 | { KEY_UP, KEY_PAGEUP }, |
| 119 | { KEY_DOWN, KEY_PAGEDOWN }, |
| 120 | { KEY_LEFT, KEY_HOME }, |
| 121 | { KEY_RIGHT, KEY_END }, |
| 122 | { } |
| 123 | }; |
| 124 | |
Paul Collins | b2ddd54 | 2009-03-07 17:07:15 +1300 | [diff] [blame] | 125 | static const struct apple_key_translation powerbook_numlock_keys[] = { |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 126 | { KEY_J, KEY_KP1 }, |
| 127 | { KEY_K, KEY_KP2 }, |
| 128 | { KEY_L, KEY_KP3 }, |
| 129 | { KEY_U, KEY_KP4 }, |
| 130 | { KEY_I, KEY_KP5 }, |
| 131 | { KEY_O, KEY_KP6 }, |
| 132 | { KEY_7, KEY_KP7 }, |
| 133 | { KEY_8, KEY_KP8 }, |
| 134 | { KEY_9, KEY_KP9 }, |
| 135 | { KEY_M, KEY_KP0 }, |
| 136 | { KEY_DOT, KEY_KPDOT }, |
| 137 | { KEY_SLASH, KEY_KPPLUS }, |
| 138 | { KEY_SEMICOLON, KEY_KPMINUS }, |
| 139 | { KEY_P, KEY_KPASTERISK }, |
| 140 | { KEY_MINUS, KEY_KPEQUAL }, |
| 141 | { KEY_0, KEY_KPSLASH }, |
| 142 | { KEY_F6, KEY_NUMLOCK }, |
| 143 | { KEY_KPENTER, KEY_KPENTER }, |
| 144 | { KEY_BACKSPACE, KEY_BACKSPACE }, |
| 145 | { } |
| 146 | }; |
| 147 | |
Paul Collins | b2ddd54 | 2009-03-07 17:07:15 +1300 | [diff] [blame] | 148 | static const struct apple_key_translation apple_iso_keyboard[] = { |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 149 | { KEY_GRAVE, KEY_102ND }, |
| 150 | { KEY_102ND, KEY_GRAVE }, |
| 151 | { } |
| 152 | }; |
| 153 | |
Paul Collins | b2ddd54 | 2009-03-07 17:07:15 +1300 | [diff] [blame] | 154 | static const struct apple_key_translation *apple_find_translation( |
| 155 | const struct apple_key_translation *table, u16 from) |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 156 | { |
Paul Collins | b2ddd54 | 2009-03-07 17:07:15 +1300 | [diff] [blame] | 157 | const struct apple_key_translation *trans; |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 158 | |
| 159 | /* Look for the translation */ |
| 160 | for (trans = table; trans->from; trans++) |
| 161 | if (trans->from == from) |
| 162 | return trans; |
| 163 | |
| 164 | return NULL; |
| 165 | } |
| 166 | |
| 167 | static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, |
| 168 | struct hid_usage *usage, __s32 value) |
| 169 | { |
| 170 | struct apple_sc *asc = hid_get_drvdata(hid); |
Jiri Kosina | a4bc692 | 2010-11-03 10:42:02 -0400 | [diff] [blame] | 171 | const struct apple_key_translation *trans, *table; |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 172 | |
| 173 | if (usage->code == KEY_FN) { |
| 174 | asc->fn_on = !!value; |
| 175 | input_event(input, usage->type, usage->code, value); |
| 176 | return 1; |
| 177 | } |
| 178 | |
| 179 | if (fnmode) { |
| 180 | int do_translate; |
| 181 | |
Jiri Kosina | a4bc692 | 2010-11-03 10:42:02 -0400 | [diff] [blame] | 182 | if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI && |
| 183 | hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) |
| 184 | table = macbookair_fn_keys; |
| 185 | else if (hid->product < 0x21d || hid->product >= 0x300) |
| 186 | table = powerbook_fn_keys; |
| 187 | else |
| 188 | table = apple_fn_keys; |
| 189 | |
| 190 | trans = apple_find_translation (table, usage->code); |
Edgar (gimli) Hucek | 99b9f75 | 2010-11-03 10:36:18 -0400 | [diff] [blame] | 191 | |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 192 | if (trans) { |
| 193 | if (test_bit(usage->code, asc->pressed_fn)) |
| 194 | do_translate = 1; |
| 195 | else if (trans->flags & APPLE_FLAG_FKEY) |
| 196 | do_translate = (fnmode == 2 && asc->fn_on) || |
| 197 | (fnmode == 1 && !asc->fn_on); |
| 198 | else |
| 199 | do_translate = asc->fn_on; |
| 200 | |
| 201 | if (do_translate) { |
| 202 | if (value) |
| 203 | set_bit(usage->code, asc->pressed_fn); |
| 204 | else |
| 205 | clear_bit(usage->code, asc->pressed_fn); |
| 206 | |
| 207 | input_event(input, usage->type, trans->to, |
| 208 | value); |
| 209 | |
| 210 | return 1; |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | if (asc->quirks & APPLE_NUMLOCK_EMULATION && |
| 215 | (test_bit(usage->code, asc->pressed_numlock) || |
| 216 | test_bit(LED_NUML, input->led))) { |
| 217 | trans = apple_find_translation(powerbook_numlock_keys, |
| 218 | usage->code); |
| 219 | |
| 220 | if (trans) { |
| 221 | if (value) |
| 222 | set_bit(usage->code, |
| 223 | asc->pressed_numlock); |
| 224 | else |
| 225 | clear_bit(usage->code, |
| 226 | asc->pressed_numlock); |
| 227 | |
| 228 | input_event(input, usage->type, trans->to, |
| 229 | value); |
| 230 | } |
| 231 | |
| 232 | return 1; |
| 233 | } |
| 234 | } |
| 235 | |
Benedikt Bergenthal | 9f1f463 | 2012-04-18 12:22:40 +0200 | [diff] [blame] | 236 | if (iso_layout) { |
Stefan Glasenhardt | 54a6593 | 2010-01-05 23:30:30 +0100 | [diff] [blame] | 237 | if (asc->quirks & APPLE_ISO_KEYBOARD) { |
| 238 | trans = apple_find_translation(apple_iso_keyboard, usage->code); |
| 239 | if (trans) { |
| 240 | input_event(input, usage->type, trans->to, value); |
| 241 | return 1; |
| 242 | } |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 243 | } |
| 244 | } |
| 245 | |
| 246 | return 0; |
| 247 | } |
| 248 | |
| 249 | static int apple_event(struct hid_device *hdev, struct hid_field *field, |
| 250 | struct hid_usage *usage, __s32 value) |
| 251 | { |
| 252 | struct apple_sc *asc = hid_get_drvdata(hdev); |
| 253 | |
| 254 | if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput || |
| 255 | !usage->type) |
| 256 | return 0; |
| 257 | |
| 258 | if ((asc->quirks & APPLE_INVERT_HWHEEL) && |
| 259 | usage->code == REL_HWHEEL) { |
| 260 | input_event(field->hidinput->input, usage->type, usage->code, |
| 261 | -value); |
| 262 | return 1; |
| 263 | } |
| 264 | |
| 265 | if ((asc->quirks & APPLE_HAS_FN) && |
| 266 | hidinput_apple_event(hdev, field->hidinput->input, |
| 267 | usage, value)) |
| 268 | return 1; |
| 269 | |
| 270 | |
| 271 | return 0; |
| 272 | } |
| 273 | |
| 274 | /* |
| 275 | * MacBook JIS keyboard has wrong logical maximum |
| 276 | */ |
Nikolai Kondrashov | 73e4008 | 2010-08-06 23:03:06 +0400 | [diff] [blame] | 277 | static __u8 *apple_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
| 278 | unsigned int *rsize) |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 279 | { |
| 280 | struct apple_sc *asc = hid_get_drvdata(hdev); |
| 281 | |
Nikolai Kondrashov | 73e4008 | 2010-08-06 23:03:06 +0400 | [diff] [blame] | 282 | if ((asc->quirks & APPLE_RDESC_JIS) && *rsize >= 60 && |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 283 | rdesc[53] == 0x65 && rdesc[59] == 0x65) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 284 | hid_info(hdev, |
| 285 | "fixing up MacBook JIS keyboard report descriptor\n"); |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 286 | rdesc[53] = rdesc[59] = 0xe7; |
| 287 | } |
Nikolai Kondrashov | 73e4008 | 2010-08-06 23:03:06 +0400 | [diff] [blame] | 288 | return rdesc; |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 289 | } |
| 290 | |
| 291 | static void apple_setup_input(struct input_dev *input) |
| 292 | { |
Paul Collins | b2ddd54 | 2009-03-07 17:07:15 +1300 | [diff] [blame] | 293 | const struct apple_key_translation *trans; |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 294 | |
| 295 | set_bit(KEY_NUMLOCK, input->keybit); |
| 296 | |
| 297 | /* Enable all needed keys */ |
| 298 | for (trans = apple_fn_keys; trans->from; trans++) |
| 299 | set_bit(trans->to, input->keybit); |
| 300 | |
| 301 | for (trans = powerbook_fn_keys; trans->from; trans++) |
| 302 | set_bit(trans->to, input->keybit); |
| 303 | |
| 304 | for (trans = powerbook_numlock_keys; trans->from; trans++) |
| 305 | set_bit(trans->to, input->keybit); |
| 306 | |
| 307 | for (trans = apple_iso_keyboard; trans->from; trans++) |
| 308 | set_bit(trans->to, input->keybit); |
| 309 | } |
| 310 | |
| 311 | static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi, |
| 312 | struct hid_field *field, struct hid_usage *usage, |
| 313 | unsigned long **bit, int *max) |
| 314 | { |
| 315 | if (usage->hid == (HID_UP_CUSTOM | 0x0003)) { |
| 316 | /* The fn key on Apple USB keyboards */ |
| 317 | set_bit(EV_REP, hi->input->evbit); |
| 318 | hid_map_usage_clear(hi, usage, bit, max, EV_KEY, KEY_FN); |
| 319 | apple_setup_input(hi->input); |
| 320 | return 1; |
| 321 | } |
| 322 | |
| 323 | /* we want the hid layer to go through standard path (set and ignore) */ |
| 324 | return 0; |
| 325 | } |
| 326 | |
| 327 | static int apple_input_mapped(struct hid_device *hdev, struct hid_input *hi, |
| 328 | struct hid_field *field, struct hid_usage *usage, |
| 329 | unsigned long **bit, int *max) |
| 330 | { |
| 331 | struct apple_sc *asc = hid_get_drvdata(hdev); |
| 332 | |
| 333 | if (asc->quirks & APPLE_MIGHTYMOUSE) { |
| 334 | if (usage->hid == HID_GD_Z) |
| 335 | hid_map_usage(hi, usage, bit, max, EV_REL, REL_HWHEEL); |
| 336 | else if (usage->code == BTN_1) |
| 337 | hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_2); |
| 338 | else if (usage->code == BTN_2) |
| 339 | hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_1); |
| 340 | } |
| 341 | |
| 342 | return 0; |
| 343 | } |
| 344 | |
| 345 | static int apple_probe(struct hid_device *hdev, |
| 346 | const struct hid_device_id *id) |
| 347 | { |
| 348 | unsigned long quirks = id->driver_data; |
| 349 | struct apple_sc *asc; |
Jiri Slaby | 93c1013 | 2008-06-27 00:04:24 +0200 | [diff] [blame] | 350 | unsigned int connect_mask = HID_CONNECT_DEFAULT; |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 351 | int ret; |
| 352 | |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 353 | asc = kzalloc(sizeof(*asc), GFP_KERNEL); |
| 354 | if (asc == NULL) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 355 | hid_err(hdev, "can't alloc apple descriptor\n"); |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 356 | return -ENOMEM; |
| 357 | } |
| 358 | |
| 359 | asc->quirks = quirks; |
| 360 | |
| 361 | hid_set_drvdata(hdev, asc); |
| 362 | |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 363 | ret = hid_parse(hdev); |
| 364 | if (ret) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 365 | hid_err(hdev, "parse failed\n"); |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 366 | goto err_free; |
| 367 | } |
| 368 | |
Jiri Slaby | 93c1013 | 2008-06-27 00:04:24 +0200 | [diff] [blame] | 369 | if (quirks & APPLE_HIDDEV) |
| 370 | connect_mask |= HID_CONNECT_HIDDEV_FORCE; |
| 371 | if (quirks & APPLE_IGNORE_HIDINPUT) |
| 372 | connect_mask &= ~HID_CONNECT_HIDINPUT; |
| 373 | |
| 374 | ret = hid_hw_start(hdev, connect_mask); |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 375 | if (ret) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 376 | hid_err(hdev, "hw start failed\n"); |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 377 | goto err_free; |
| 378 | } |
| 379 | |
| 380 | return 0; |
| 381 | err_free: |
| 382 | kfree(asc); |
| 383 | return ret; |
| 384 | } |
| 385 | |
| 386 | static void apple_remove(struct hid_device *hdev) |
| 387 | { |
| 388 | hid_hw_stop(hdev); |
| 389 | kfree(hid_get_drvdata(hdev)); |
| 390 | } |
| 391 | |
| 392 | static const struct hid_device_id apple_devices[] = { |
Peter Korsgaard | 0f492f2 | 2008-10-06 11:15:34 +0200 | [diff] [blame] | 393 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL), |
| 394 | .driver_data = APPLE_HIDDEV | APPLE_IGNORE_HIDINPUT }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 395 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4), |
| 396 | .driver_data = APPLE_HIDDEV | APPLE_IGNORE_HIDINPUT }, |
| 397 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE), |
| 398 | .driver_data = APPLE_MIGHTYMOUSE | APPLE_INVERT_HWHEEL }, |
| 399 | |
| 400 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI), |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 401 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 402 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO), |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 403 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 404 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI), |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 405 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 406 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO), |
| 407 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 408 | APPLE_ISO_KEYBOARD }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 409 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS), |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 410 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 411 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI), |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 412 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 413 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO), |
| 414 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 415 | APPLE_ISO_KEYBOARD }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 416 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS), |
| 417 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 418 | APPLE_RDESC_JIS }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 419 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI), |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 420 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 421 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO), |
| 422 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 423 | APPLE_ISO_KEYBOARD }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 424 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS), |
| 425 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 426 | APPLE_RDESC_JIS }, |
Ryan Finnie | fef3f57 | 2009-03-05 10:18:01 +0100 | [diff] [blame] | 427 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ANSI), |
| 428 | .driver_data = APPLE_HAS_FN }, |
| 429 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ISO), |
| 430 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
| 431 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_JIS), |
| 432 | .driver_data = APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 433 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI), |
| 434 | .driver_data = APPLE_HAS_FN }, |
| 435 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO), |
| 436 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
| 437 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS), |
| 438 | .driver_data = APPLE_HAS_FN }, |
| 439 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI), |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 440 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 441 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO), |
Johannes Thumshirn | 537b664 | 2012-11-03 10:43:31 +0100 | [diff] [blame] | 442 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
| 443 | APPLE_ISO_KEYBOARD }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 444 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS), |
| 445 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 446 | APPLE_RDESC_JIS }, |
Dan Bastone | 4a4c879 | 2011-07-31 07:40:49 -0400 | [diff] [blame] | 447 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI), |
| 448 | .driver_data = APPLE_HAS_FN }, |
| 449 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO), |
| 450 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
| 451 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_JIS), |
| 452 | .driver_data = APPLE_HAS_FN }, |
Jan Scholz | ee8a1a0 | 2008-11-26 15:33:45 +0100 | [diff] [blame] | 453 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI), |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 454 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jan Scholz | ee8a1a0 | 2008-11-26 15:33:45 +0100 | [diff] [blame] | 455 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO), |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 456 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
| 457 | APPLE_ISO_KEYBOARD }, |
Andreas Krist | ad734bc | 2011-10-28 18:50:39 +0200 | [diff] [blame] | 458 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO), |
| 459 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
| 460 | APPLE_ISO_KEYBOARD }, |
Alexey Kaminsky | 0a97e1e | 2012-04-23 18:02:18 +0200 | [diff] [blame] | 461 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, |
| 462 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI), |
| 463 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jan Scholz | ee8a1a0 | 2008-11-26 15:33:45 +0100 | [diff] [blame] | 464 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS), |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 465 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
| 466 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI), |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 467 | .driver_data = APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 468 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO), |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 469 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 470 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS), |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 471 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 472 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI), |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 473 | .driver_data = APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 474 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO), |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 475 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 476 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS), |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 477 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
Henrik Rydberg | a96d6ef | 2008-11-04 20:03:45 +0100 | [diff] [blame] | 478 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI), |
| 479 | .driver_data = APPLE_HAS_FN }, |
| 480 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO), |
| 481 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
| 482 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS), |
| 483 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
Edgar (gimli) Hucek | 99b9f75 | 2010-11-03 10:36:18 -0400 | [diff] [blame] | 484 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI), |
| 485 | .driver_data = APPLE_HAS_FN }, |
| 486 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO), |
| 487 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
| 488 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS), |
| 489 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
| 490 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI), |
| 491 | .driver_data = APPLE_HAS_FN }, |
| 492 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO), |
| 493 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
| 494 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS), |
| 495 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
Andy Botting | 47340bd | 2011-03-12 20:27:22 -0800 | [diff] [blame] | 496 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI), |
| 497 | .driver_data = APPLE_HAS_FN }, |
| 498 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO), |
| 499 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
| 500 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS), |
| 501 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
Joshua V. Dillon | 5d922ba | 2011-08-05 12:05:22 -0700 | [diff] [blame] | 502 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI), |
| 503 | .driver_data = APPLE_HAS_FN }, |
| 504 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO), |
| 505 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
| 506 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS), |
| 507 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
Nobuhiro Iwamatsu | d762cc2 | 2011-10-01 15:54:53 +0900 | [diff] [blame] | 508 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI), |
| 509 | .driver_data = APPLE_HAS_FN }, |
| 510 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO), |
| 511 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
| 512 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS), |
| 513 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
Gökçen Eraslan | 213f9da | 2011-10-22 22:39:06 +0300 | [diff] [blame] | 514 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI), |
| 515 | .driver_data = APPLE_HAS_FN }, |
| 516 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO), |
| 517 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
| 518 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS), |
| 519 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
Ryan Bourgeois | b2e6ad7 | 2012-07-10 09:43:33 -0700 | [diff] [blame] | 520 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI), |
| 521 | .driver_data = APPLE_HAS_FN }, |
| 522 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO), |
| 523 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
| 524 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS), |
| 525 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
Dirk Hohndel | 8d80da9 | 2012-10-30 11:11:48 -0700 | [diff] [blame] | 526 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI), |
| 527 | .driver_data = APPLE_HAS_FN }, |
| 528 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO), |
| 529 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
| 530 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS), |
| 531 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
Christian Schuerer-Waldheim | 23aeb61 | 2010-01-06 14:49:57 +0100 | [diff] [blame] | 532 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), |
| 533 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
| 534 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), |
| 535 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
| 536 | APPLE_ISO_KEYBOARD }, |
| 537 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS), |
| 538 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 539 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY), |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 540 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 541 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY), |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 542 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 543 | |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 544 | { } |
| 545 | }; |
| 546 | MODULE_DEVICE_TABLE(hid, apple_devices); |
| 547 | |
| 548 | static struct hid_driver apple_driver = { |
| 549 | .name = "apple", |
| 550 | .id_table = apple_devices, |
| 551 | .report_fixup = apple_report_fixup, |
| 552 | .probe = apple_probe, |
| 553 | .remove = apple_remove, |
| 554 | .event = apple_event, |
| 555 | .input_mapping = apple_input_mapping, |
| 556 | .input_mapped = apple_input_mapped, |
| 557 | }; |
H Hartley Sweeten | f425458 | 2012-12-17 15:28:26 -0700 | [diff] [blame] | 558 | module_hid_driver(apple_driver); |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 559 | |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 560 | MODULE_LICENSE("GPL"); |