1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * USB HID quirks support for Linux
5 * Copyright (c) 1999 Andreas Gal
6 * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
7 * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
8 * Copyright (c) 2006-2007 Jiri Kosina
9 * Copyright (c) 2008 Jiri Slaby <jirislaby@gmail.com>
15 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
17 #include <linux/device.h>
18 #include <linux/hid.h>
19 #include <linux/module.h>
20 #include <linux/slab.h>
24 #define APPLE_RDESC_JIS 0x0001
25 #define APPLE_IGNORE_MOUSE 0x0002
26 #define APPLE_HAS_FN 0x0004
27 #define APPLE_HIDDEV 0x0008
28 /* 0x0010 reserved, was: APPLE_ISO_KEYBOARD */
29 #define APPLE_MIGHTYMOUSE 0x0020
30 #define APPLE_INVERT_HWHEEL 0x0040
31 #define APPLE_IGNORE_HIDINPUT 0x0080
32 #define APPLE_NUMLOCK_EMULATION 0x0100
34 #define APPLE_FLAG_FKEY 0x01
36 #define HID_COUNTRY_INTERNATIONAL_ISO 13
38 static unsigned int fnmode
= 1;
39 module_param(fnmode
, uint
, 0644);
40 MODULE_PARM_DESC(fnmode
, "Mode of fn key on Apple keyboards (0 = disabled, "
41 "[1] = fkeyslast, 2 = fkeysfirst)");
43 static unsigned int iso_layout
= 1;
44 module_param(iso_layout
, uint
, 0644);
45 MODULE_PARM_DESC(iso_layout
, "Enable/Disable hardcoded ISO-layout of the keyboard. "
46 "(0 = disabled, [1] = enabled)");
48 static unsigned int swap_opt_cmd
;
49 module_param(swap_opt_cmd
, uint
, 0644);
50 MODULE_PARM_DESC(swap_opt_cmd
, "Swap the Option (\"Alt\") and Command (\"Flag\") keys. "
51 "(For people who want to keep Windows PC keyboard muscle memory. "
52 "[0] = as-is, Mac layout. 1 = swapped, Windows layout.)");
57 unsigned int fn_found
;
58 DECLARE_BITMAP(pressed_numlock
, KEY_CNT
);
61 struct apple_key_translation
{
67 static const struct apple_key_translation macbookair_fn_keys
[] = {
68 { KEY_BACKSPACE
, KEY_DELETE
},
69 { KEY_ENTER
, KEY_INSERT
},
70 { KEY_F1
, KEY_BRIGHTNESSDOWN
, APPLE_FLAG_FKEY
},
71 { KEY_F2
, KEY_BRIGHTNESSUP
, APPLE_FLAG_FKEY
},
72 { KEY_F3
, KEY_SCALE
, APPLE_FLAG_FKEY
},
73 { KEY_F4
, KEY_DASHBOARD
, APPLE_FLAG_FKEY
},
74 { KEY_F6
, KEY_PREVIOUSSONG
, APPLE_FLAG_FKEY
},
75 { KEY_F7
, KEY_PLAYPAUSE
, APPLE_FLAG_FKEY
},
76 { KEY_F8
, KEY_NEXTSONG
, APPLE_FLAG_FKEY
},
77 { KEY_F9
, KEY_MUTE
, APPLE_FLAG_FKEY
},
78 { KEY_F10
, KEY_VOLUMEDOWN
, APPLE_FLAG_FKEY
},
79 { KEY_F11
, KEY_VOLUMEUP
, APPLE_FLAG_FKEY
},
80 { KEY_F12
, KEY_EJECTCD
, APPLE_FLAG_FKEY
},
81 { KEY_UP
, KEY_PAGEUP
},
82 { KEY_DOWN
, KEY_PAGEDOWN
},
83 { KEY_LEFT
, KEY_HOME
},
84 { KEY_RIGHT
, KEY_END
},
88 static const struct apple_key_translation apple_fn_keys
[] = {
89 { KEY_BACKSPACE
, KEY_DELETE
},
90 { KEY_ENTER
, KEY_INSERT
},
91 { KEY_F1
, KEY_BRIGHTNESSDOWN
, APPLE_FLAG_FKEY
},
92 { KEY_F2
, KEY_BRIGHTNESSUP
, APPLE_FLAG_FKEY
},
93 { KEY_F3
, KEY_SCALE
, APPLE_FLAG_FKEY
},
94 { KEY_F4
, KEY_DASHBOARD
, APPLE_FLAG_FKEY
},
95 { KEY_F5
, KEY_KBDILLUMDOWN
, APPLE_FLAG_FKEY
},
96 { KEY_F6
, KEY_KBDILLUMUP
, APPLE_FLAG_FKEY
},
97 { KEY_F7
, KEY_PREVIOUSSONG
, APPLE_FLAG_FKEY
},
98 { KEY_F8
, KEY_PLAYPAUSE
, APPLE_FLAG_FKEY
},
99 { KEY_F9
, KEY_NEXTSONG
, APPLE_FLAG_FKEY
},
100 { KEY_F10
, KEY_MUTE
, APPLE_FLAG_FKEY
},
101 { KEY_F11
, KEY_VOLUMEDOWN
, APPLE_FLAG_FKEY
},
102 { KEY_F12
, KEY_VOLUMEUP
, APPLE_FLAG_FKEY
},
103 { KEY_UP
, KEY_PAGEUP
},
104 { KEY_DOWN
, KEY_PAGEDOWN
},
105 { KEY_LEFT
, KEY_HOME
},
106 { KEY_RIGHT
, KEY_END
},
110 static const struct apple_key_translation powerbook_fn_keys
[] = {
111 { KEY_BACKSPACE
, KEY_DELETE
},
112 { KEY_F1
, KEY_BRIGHTNESSDOWN
, APPLE_FLAG_FKEY
},
113 { KEY_F2
, KEY_BRIGHTNESSUP
, APPLE_FLAG_FKEY
},
114 { KEY_F3
, KEY_MUTE
, APPLE_FLAG_FKEY
},
115 { KEY_F4
, KEY_VOLUMEDOWN
, APPLE_FLAG_FKEY
},
116 { KEY_F5
, KEY_VOLUMEUP
, APPLE_FLAG_FKEY
},
117 { KEY_F6
, KEY_NUMLOCK
, APPLE_FLAG_FKEY
},
118 { KEY_F7
, KEY_SWITCHVIDEOMODE
, APPLE_FLAG_FKEY
},
119 { KEY_F8
, KEY_KBDILLUMTOGGLE
, APPLE_FLAG_FKEY
},
120 { KEY_F9
, KEY_KBDILLUMDOWN
, APPLE_FLAG_FKEY
},
121 { KEY_F10
, KEY_KBDILLUMUP
, APPLE_FLAG_FKEY
},
122 { KEY_UP
, KEY_PAGEUP
},
123 { KEY_DOWN
, KEY_PAGEDOWN
},
124 { KEY_LEFT
, KEY_HOME
},
125 { KEY_RIGHT
, KEY_END
},
129 static const struct apple_key_translation powerbook_numlock_keys
[] = {
140 { KEY_DOT
, KEY_KPDOT
},
141 { KEY_SLASH
, KEY_KPPLUS
},
142 { KEY_SEMICOLON
, KEY_KPMINUS
},
143 { KEY_P
, KEY_KPASTERISK
},
144 { KEY_MINUS
, KEY_KPEQUAL
},
145 { KEY_0
, KEY_KPSLASH
},
146 { KEY_F6
, KEY_NUMLOCK
},
147 { KEY_KPENTER
, KEY_KPENTER
},
148 { KEY_BACKSPACE
, KEY_BACKSPACE
},
152 static const struct apple_key_translation apple_iso_keyboard
[] = {
153 { KEY_GRAVE
, KEY_102ND
},
154 { KEY_102ND
, KEY_GRAVE
},
158 static const struct apple_key_translation swapped_option_cmd_keys
[] = {
159 { KEY_LEFTALT
, KEY_LEFTMETA
},
160 { KEY_LEFTMETA
, KEY_LEFTALT
},
161 { KEY_RIGHTALT
, KEY_RIGHTMETA
},
162 { KEY_RIGHTMETA
,KEY_RIGHTALT
},
166 static const struct apple_key_translation
*apple_find_translation(
167 const struct apple_key_translation
*table
, u16 from
)
169 const struct apple_key_translation
*trans
;
171 /* Look for the translation */
172 for (trans
= table
; trans
->from
; trans
++)
173 if (trans
->from
== from
)
179 static int hidinput_apple_event(struct hid_device
*hid
, struct input_dev
*input
,
180 struct hid_usage
*usage
, __s32 value
)
182 struct apple_sc
*asc
= hid_get_drvdata(hid
);
183 const struct apple_key_translation
*trans
, *table
;
187 if (usage
->code
== KEY_FN
) {
188 asc
->fn_on
= !!value
;
189 input_event(input
, usage
->type
, usage
->code
, value
);
194 if (hid
->product
>= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI
&&
195 hid
->product
<= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS
)
196 table
= macbookair_fn_keys
;
197 else if (hid
->product
< 0x21d || hid
->product
>= 0x300)
198 table
= powerbook_fn_keys
;
200 table
= apple_fn_keys
;
202 trans
= apple_find_translation (table
, usage
->code
);
205 if (test_bit(trans
->from
, input
->key
))
207 else if (test_bit(trans
->to
, input
->key
))
211 if (trans
->flags
& APPLE_FLAG_FKEY
) {
214 do_translate
= !asc
->fn_on
;
217 do_translate
= asc
->fn_on
;
220 /* should never happen */
221 do_translate
= false;
224 do_translate
= asc
->fn_on
;
227 code
= do_translate
? trans
->to
: trans
->from
;
230 input_event(input
, usage
->type
, code
, value
);
234 if (asc
->quirks
& APPLE_NUMLOCK_EMULATION
&&
235 (test_bit(usage
->code
, asc
->pressed_numlock
) ||
236 test_bit(LED_NUML
, input
->led
))) {
237 trans
= apple_find_translation(powerbook_numlock_keys
,
243 asc
->pressed_numlock
);
245 clear_bit(usage
->code
,
246 asc
->pressed_numlock
);
248 input_event(input
, usage
->type
, trans
->to
,
257 if (hid
->country
== HID_COUNTRY_INTERNATIONAL_ISO
) {
258 trans
= apple_find_translation(apple_iso_keyboard
, usage
->code
);
260 input_event(input
, usage
->type
, trans
->to
, value
);
267 trans
= apple_find_translation(swapped_option_cmd_keys
, usage
->code
);
269 input_event(input
, usage
->type
, trans
->to
, value
);
277 static int apple_event(struct hid_device
*hdev
, struct hid_field
*field
,
278 struct hid_usage
*usage
, __s32 value
)
280 struct apple_sc
*asc
= hid_get_drvdata(hdev
);
282 if (!(hdev
->claimed
& HID_CLAIMED_INPUT
) || !field
->hidinput
||
286 if ((asc
->quirks
& APPLE_INVERT_HWHEEL
) &&
287 usage
->code
== REL_HWHEEL
) {
288 input_event(field
->hidinput
->input
, usage
->type
, usage
->code
,
293 if ((asc
->quirks
& APPLE_HAS_FN
) &&
294 hidinput_apple_event(hdev
, field
->hidinput
->input
,
303 * MacBook JIS keyboard has wrong logical maximum
305 static __u8
*apple_report_fixup(struct hid_device
*hdev
, __u8
*rdesc
,
308 struct apple_sc
*asc
= hid_get_drvdata(hdev
);
310 if ((asc
->quirks
& APPLE_RDESC_JIS
) && *rsize
>= 60 &&
311 rdesc
[53] == 0x65 && rdesc
[59] == 0x65) {
313 "fixing up MacBook JIS keyboard report descriptor\n");
314 rdesc
[53] = rdesc
[59] = 0xe7;
319 static void apple_setup_input(struct input_dev
*input
)
321 const struct apple_key_translation
*trans
;
323 set_bit(KEY_NUMLOCK
, input
->keybit
);
325 /* Enable all needed keys */
326 for (trans
= apple_fn_keys
; trans
->from
; trans
++)
327 set_bit(trans
->to
, input
->keybit
);
329 for (trans
= powerbook_fn_keys
; trans
->from
; trans
++)
330 set_bit(trans
->to
, input
->keybit
);
332 for (trans
= powerbook_numlock_keys
; trans
->from
; trans
++)
333 set_bit(trans
->to
, input
->keybit
);
335 for (trans
= apple_iso_keyboard
; trans
->from
; trans
++)
336 set_bit(trans
->to
, input
->keybit
);
339 static int apple_input_mapping(struct hid_device
*hdev
, struct hid_input
*hi
,
340 struct hid_field
*field
, struct hid_usage
*usage
,
341 unsigned long **bit
, int *max
)
343 struct apple_sc
*asc
= hid_get_drvdata(hdev
);
345 if (usage
->hid
== (HID_UP_CUSTOM
| 0x0003) ||
346 usage
->hid
== (HID_UP_MSVENDOR
| 0x0003) ||
347 usage
->hid
== (HID_UP_HPVENDOR2
| 0x0003)) {
348 /* The fn key on Apple USB keyboards */
349 set_bit(EV_REP
, hi
->input
->evbit
);
350 hid_map_usage_clear(hi
, usage
, bit
, max
, EV_KEY
, KEY_FN
);
351 asc
->fn_found
= true;
352 apple_setup_input(hi
->input
);
356 /* we want the hid layer to go through standard path (set and ignore) */
360 static int apple_input_mapped(struct hid_device
*hdev
, struct hid_input
*hi
,
361 struct hid_field
*field
, struct hid_usage
*usage
,
362 unsigned long **bit
, int *max
)
364 struct apple_sc
*asc
= hid_get_drvdata(hdev
);
366 if (asc
->quirks
& APPLE_MIGHTYMOUSE
) {
367 if (usage
->hid
== HID_GD_Z
)
368 hid_map_usage(hi
, usage
, bit
, max
, EV_REL
, REL_HWHEEL
);
369 else if (usage
->code
== BTN_1
)
370 hid_map_usage(hi
, usage
, bit
, max
, EV_KEY
, BTN_2
);
371 else if (usage
->code
== BTN_2
)
372 hid_map_usage(hi
, usage
, bit
, max
, EV_KEY
, BTN_1
);
378 static int apple_input_configured(struct hid_device
*hdev
,
379 struct hid_input
*hidinput
)
381 struct apple_sc
*asc
= hid_get_drvdata(hdev
);
383 if ((asc
->quirks
& APPLE_HAS_FN
) && !asc
->fn_found
) {
384 hid_info(hdev
, "Fn key not found (Apple Wireless Keyboard clone?), disabling Fn key handling\n");
391 static int apple_probe(struct hid_device
*hdev
,
392 const struct hid_device_id
*id
)
394 unsigned long quirks
= id
->driver_data
;
395 struct apple_sc
*asc
;
396 unsigned int connect_mask
= HID_CONNECT_DEFAULT
;
399 asc
= devm_kzalloc(&hdev
->dev
, sizeof(*asc
), GFP_KERNEL
);
401 hid_err(hdev
, "can't alloc apple descriptor\n");
405 asc
->quirks
= quirks
;
407 hid_set_drvdata(hdev
, asc
);
409 ret
= hid_parse(hdev
);
411 hid_err(hdev
, "parse failed\n");
415 if (quirks
& APPLE_HIDDEV
)
416 connect_mask
|= HID_CONNECT_HIDDEV_FORCE
;
417 if (quirks
& APPLE_IGNORE_HIDINPUT
)
418 connect_mask
&= ~HID_CONNECT_HIDINPUT
;
420 ret
= hid_hw_start(hdev
, connect_mask
);
422 hid_err(hdev
, "hw start failed\n");
429 static const struct hid_device_id apple_devices
[] = {
430 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_MIGHTYMOUSE
),
431 .driver_data
= APPLE_MIGHTYMOUSE
| APPLE_INVERT_HWHEEL
},
433 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI
),
434 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
},
435 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO
),
436 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
},
437 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER_ANSI
),
438 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
},
439 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER_ISO
),
440 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
},
441 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER_JIS
),
442 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
},
443 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER3_ANSI
),
444 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
},
445 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER3_ISO
),
446 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
},
447 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER3_JIS
),
448 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
|
450 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_ANSI
),
451 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
},
452 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_ISO
),
453 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
},
454 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_JIS
),
455 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
|
457 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_MINI_ANSI
),
458 .driver_data
= APPLE_HAS_FN
},
459 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_MINI_ISO
),
460 .driver_data
= APPLE_HAS_FN
},
461 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_MINI_JIS
),
462 .driver_data
= APPLE_HAS_FN
},
463 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_ANSI
),
464 .driver_data
= APPLE_HAS_FN
},
465 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_ISO
),
466 .driver_data
= APPLE_HAS_FN
},
467 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_JIS
),
468 .driver_data
= APPLE_HAS_FN
},
469 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI
),
470 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
},
471 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO
),
472 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
},
473 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS
),
474 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
|
476 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI
),
477 .driver_data
= APPLE_HAS_FN
},
478 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_REVB_ISO
),
479 .driver_data
= APPLE_HAS_FN
},
480 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_REVB_JIS
),
481 .driver_data
= APPLE_HAS_FN
},
482 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI
),
483 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
},
484 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO
),
485 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
},
486 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO
),
487 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
},
488 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE
,
489 USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI
),
490 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
},
491 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE
,
492 USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS
),
493 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
},
494 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS
),
495 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
},
496 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI
),
497 .driver_data
= APPLE_HAS_FN
},
498 { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI
),
499 .driver_data
= APPLE_HAS_FN
},
500 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_ANSI
),
501 .driver_data
= APPLE_HAS_FN
},
502 { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_ANSI
),
503 .driver_data
= APPLE_HAS_FN
},
504 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI
),
505 .driver_data
= APPLE_HAS_FN
},
506 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING_ISO
),
507 .driver_data
= APPLE_HAS_FN
},
508 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING_JIS
),
509 .driver_data
= APPLE_HAS_FN
| APPLE_RDESC_JIS
},
510 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI
),
511 .driver_data
= APPLE_HAS_FN
},
512 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO
),
513 .driver_data
= APPLE_HAS_FN
},
514 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS
),
515 .driver_data
= APPLE_HAS_FN
| APPLE_RDESC_JIS
},
516 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI
),
517 .driver_data
= APPLE_HAS_FN
},
518 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO
),
519 .driver_data
= APPLE_HAS_FN
},
520 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS
),
521 .driver_data
= APPLE_HAS_FN
| APPLE_RDESC_JIS
},
522 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI
),
523 .driver_data
= APPLE_HAS_FN
},
524 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO
),
525 .driver_data
= APPLE_HAS_FN
},
526 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS
),
527 .driver_data
= APPLE_HAS_FN
| APPLE_RDESC_JIS
},
528 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI
),
529 .driver_data
= APPLE_HAS_FN
},
530 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO
),
531 .driver_data
= APPLE_HAS_FN
},
532 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS
),
533 .driver_data
= APPLE_HAS_FN
| APPLE_RDESC_JIS
},
534 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI
),
535 .driver_data
= APPLE_HAS_FN
},
536 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO
),
537 .driver_data
= APPLE_HAS_FN
},
538 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS
),
539 .driver_data
= APPLE_HAS_FN
| APPLE_RDESC_JIS
},
540 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI
),
541 .driver_data
= APPLE_HAS_FN
},
542 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO
),
543 .driver_data
= APPLE_HAS_FN
},
544 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS
),
545 .driver_data
= APPLE_HAS_FN
| APPLE_RDESC_JIS
},
546 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI
),
547 .driver_data
= APPLE_HAS_FN
},
548 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO
),
549 .driver_data
= APPLE_HAS_FN
},
550 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS
),
551 .driver_data
= APPLE_HAS_FN
| APPLE_RDESC_JIS
},
552 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI
),
553 .driver_data
= APPLE_HAS_FN
},
554 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO
),
555 .driver_data
= APPLE_HAS_FN
},
556 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS
),
557 .driver_data
= APPLE_HAS_FN
| APPLE_RDESC_JIS
},
558 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI
),
559 .driver_data
= APPLE_HAS_FN
},
560 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO
),
561 .driver_data
= APPLE_HAS_FN
},
562 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS
),
563 .driver_data
= APPLE_HAS_FN
| APPLE_RDESC_JIS
},
564 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI
),
565 .driver_data
= APPLE_HAS_FN
},
566 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO
),
567 .driver_data
= APPLE_HAS_FN
},
568 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS
),
569 .driver_data
= APPLE_HAS_FN
| APPLE_RDESC_JIS
},
570 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI
),
571 .driver_data
= APPLE_HAS_FN
},
572 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO
),
573 .driver_data
= APPLE_HAS_FN
},
574 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS
),
575 .driver_data
= APPLE_HAS_FN
| APPLE_RDESC_JIS
},
576 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI
),
577 .driver_data
= APPLE_HAS_FN
},
578 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING9_ISO
),
579 .driver_data
= APPLE_HAS_FN
},
580 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_WELLSPRING9_JIS
),
581 .driver_data
= APPLE_HAS_FN
| APPLE_RDESC_JIS
},
582 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI
),
583 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
},
584 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO
),
585 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
},
586 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS
),
587 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
},
588 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY
),
589 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
},
590 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE
, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY
),
591 .driver_data
= APPLE_NUMLOCK_EMULATION
| APPLE_HAS_FN
},
595 MODULE_DEVICE_TABLE(hid
, apple_devices
);
597 static struct hid_driver apple_driver
= {
599 .id_table
= apple_devices
,
600 .report_fixup
= apple_report_fixup
,
601 .probe
= apple_probe
,
602 .event
= apple_event
,
603 .input_mapping
= apple_input_mapping
,
604 .input_mapped
= apple_input_mapped
,
605 .input_configured
= apple_input_configured
,
607 module_hid_driver(apple_driver
);
609 MODULE_LICENSE("GPL");