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