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