Thomas Gleixner | 2874c5f | 2019-05-27 08:55:01 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 2 | /* |
| 3 | * USB HID quirks support for Linux |
| 4 | * |
| 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 |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 9 | * Copyright (c) 2008 Jiri Slaby <jirislaby@gmail.com> |
| 10 | */ |
| 11 | |
| 12 | /* |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 13 | */ |
| 14 | |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 15 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 16 | |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 17 | #include <linux/device.h> |
| 18 | #include <linux/hid.h> |
José Expósito | 6e14329 | 2021-11-18 08:29:55 +0100 | [diff] [blame] | 19 | #include <linux/jiffies.h> |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 20 | #include <linux/module.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 21 | #include <linux/slab.h> |
José Expósito | 6e14329 | 2021-11-18 08:29:55 +0100 | [diff] [blame] | 22 | #include <linux/timer.h> |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 23 | |
| 24 | #include "hid-ids.h" |
| 25 | |
José Expósito | 7f52ece | 2021-11-18 08:29:54 +0100 | [diff] [blame] | 26 | #define APPLE_RDESC_JIS BIT(0) |
| 27 | #define APPLE_IGNORE_MOUSE BIT(1) |
| 28 | #define APPLE_HAS_FN BIT(2) |
| 29 | /* BIT(3) reserved, was: APPLE_HIDDEV */ |
| 30 | #define APPLE_ISO_TILDE_QUIRK BIT(4) |
| 31 | #define APPLE_MIGHTYMOUSE BIT(5) |
| 32 | #define APPLE_INVERT_HWHEEL BIT(6) |
| 33 | /* BIT(7) reserved, was: APPLE_IGNORE_HIDINPUT */ |
| 34 | #define APPLE_NUMLOCK_EMULATION BIT(8) |
José Expósito | 6e14329 | 2021-11-18 08:29:55 +0100 | [diff] [blame] | 35 | #define APPLE_RDESC_BATTERY BIT(9) |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 36 | |
| 37 | #define APPLE_FLAG_FKEY 0x01 |
| 38 | |
Alex Henrie | bd77a0f | 2017-06-02 09:28:39 -0600 | [diff] [blame] | 39 | #define HID_COUNTRY_INTERNATIONAL_ISO 13 |
José Expósito | 6e14329 | 2021-11-18 08:29:55 +0100 | [diff] [blame] | 40 | #define APPLE_BATTERY_TIMEOUT_MS 60000 |
Alex Henrie | bd77a0f | 2017-06-02 09:28:39 -0600 | [diff] [blame] | 41 | |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 42 | static unsigned int fnmode = 1; |
| 43 | module_param(fnmode, uint, 0644); |
| 44 | MODULE_PARM_DESC(fnmode, "Mode of fn key on Apple keyboards (0 = disabled, " |
| 45 | "[1] = fkeyslast, 2 = fkeysfirst)"); |
| 46 | |
Alex Henrie | d58cf34 | 2021-10-19 01:12:32 -0600 | [diff] [blame] | 47 | static int iso_layout = -1; |
| 48 | module_param(iso_layout, int, 0644); |
| 49 | MODULE_PARM_DESC(iso_layout, "Swap the backtick/tilde and greater-than/less-than keys. " |
| 50 | "([-1] = auto, 0 = disabled, 1 = enabled)"); |
Stefan Glasenhardt | 54a6593 | 2010-01-05 23:30:30 +0100 | [diff] [blame] | 51 | |
Jiri Kosina | a94c79b | 2013-10-14 16:07:42 +0200 | [diff] [blame] | 52 | static unsigned int swap_opt_cmd; |
Nanno Langstraat | 43c8314 | 2013-10-14 16:07:15 +0200 | [diff] [blame] | 53 | module_param(swap_opt_cmd, uint, 0644); |
| 54 | MODULE_PARM_DESC(swap_opt_cmd, "Swap the Option (\"Alt\") and Command (\"Flag\") keys. " |
| 55 | "(For people who want to keep Windows PC keyboard muscle memory. " |
| 56 | "[0] = as-is, Mac layout. 1 = swapped, Windows layout.)"); |
| 57 | |
free5lot | 346338e | 2020-05-15 13:14:00 +0700 | [diff] [blame] | 58 | static unsigned int swap_fn_leftctrl; |
| 59 | module_param(swap_fn_leftctrl, uint, 0644); |
| 60 | MODULE_PARM_DESC(swap_fn_leftctrl, "Swap the Fn and left Control keys. " |
| 61 | "(For people who want to keep PC keyboard muscle memory. " |
| 62 | "[0] = as-is, Mac layout, 1 = swapped, PC layout)"); |
| 63 | |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 64 | struct apple_sc { |
José Expósito | 6e14329 | 2021-11-18 08:29:55 +0100 | [diff] [blame] | 65 | struct hid_device *hdev; |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 66 | unsigned long quirks; |
| 67 | unsigned int fn_on; |
Hans de Goede | a5d8164 | 2020-06-20 14:32:29 +0200 | [diff] [blame] | 68 | unsigned int fn_found; |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 69 | DECLARE_BITMAP(pressed_numlock, KEY_CNT); |
José Expósito | 6e14329 | 2021-11-18 08:29:55 +0100 | [diff] [blame] | 70 | struct timer_list battery_timer; |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 71 | }; |
| 72 | |
| 73 | struct apple_key_translation { |
| 74 | u16 from; |
| 75 | u16 to; |
| 76 | u8 flags; |
| 77 | }; |
| 78 | |
Edgar (gimli) Hucek | 99b9f75 | 2010-11-03 10:36:18 -0400 | [diff] [blame] | 79 | static const struct apple_key_translation macbookair_fn_keys[] = { |
| 80 | { KEY_BACKSPACE, KEY_DELETE }, |
| 81 | { KEY_ENTER, KEY_INSERT }, |
| 82 | { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY }, |
| 83 | { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY }, |
| 84 | { KEY_F3, KEY_SCALE, APPLE_FLAG_FKEY }, |
| 85 | { KEY_F4, KEY_DASHBOARD, APPLE_FLAG_FKEY }, |
| 86 | { KEY_F6, KEY_PREVIOUSSONG, APPLE_FLAG_FKEY }, |
| 87 | { KEY_F7, KEY_PLAYPAUSE, APPLE_FLAG_FKEY }, |
| 88 | { KEY_F8, KEY_NEXTSONG, APPLE_FLAG_FKEY }, |
| 89 | { KEY_F9, KEY_MUTE, APPLE_FLAG_FKEY }, |
| 90 | { KEY_F10, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY }, |
| 91 | { KEY_F11, KEY_VOLUMEUP, APPLE_FLAG_FKEY }, |
| 92 | { KEY_F12, KEY_EJECTCD, APPLE_FLAG_FKEY }, |
| 93 | { KEY_UP, KEY_PAGEUP }, |
| 94 | { KEY_DOWN, KEY_PAGEDOWN }, |
| 95 | { KEY_LEFT, KEY_HOME }, |
| 96 | { KEY_RIGHT, KEY_END }, |
| 97 | { } |
| 98 | }; |
| 99 | |
Paul Collins | b2ddd54 | 2009-03-07 17:07:15 +1300 | [diff] [blame] | 100 | static const struct apple_key_translation apple_fn_keys[] = { |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 101 | { KEY_BACKSPACE, KEY_DELETE }, |
Henrik Rydberg | 437184a | 2008-11-04 13:31:38 +0100 | [diff] [blame] | 102 | { KEY_ENTER, KEY_INSERT }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 103 | { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY }, |
| 104 | { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY }, |
Henrik Rydberg | 437184a | 2008-11-04 13:31:38 +0100 | [diff] [blame] | 105 | { KEY_F3, KEY_SCALE, APPLE_FLAG_FKEY }, |
| 106 | { KEY_F4, KEY_DASHBOARD, APPLE_FLAG_FKEY }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 107 | { KEY_F5, KEY_KBDILLUMDOWN, APPLE_FLAG_FKEY }, |
| 108 | { KEY_F6, KEY_KBDILLUMUP, APPLE_FLAG_FKEY }, |
| 109 | { KEY_F7, KEY_PREVIOUSSONG, APPLE_FLAG_FKEY }, |
| 110 | { KEY_F8, KEY_PLAYPAUSE, APPLE_FLAG_FKEY }, |
| 111 | { KEY_F9, KEY_NEXTSONG, APPLE_FLAG_FKEY }, |
| 112 | { KEY_F10, KEY_MUTE, APPLE_FLAG_FKEY }, |
| 113 | { KEY_F11, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY }, |
| 114 | { KEY_F12, KEY_VOLUMEUP, APPLE_FLAG_FKEY }, |
| 115 | { KEY_UP, KEY_PAGEUP }, |
| 116 | { KEY_DOWN, KEY_PAGEDOWN }, |
| 117 | { KEY_LEFT, KEY_HOME }, |
| 118 | { KEY_RIGHT, KEY_END }, |
| 119 | { } |
| 120 | }; |
| 121 | |
Paul Collins | b2ddd54 | 2009-03-07 17:07:15 +1300 | [diff] [blame] | 122 | static const struct apple_key_translation powerbook_fn_keys[] = { |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 123 | { KEY_BACKSPACE, KEY_DELETE }, |
| 124 | { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY }, |
| 125 | { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY }, |
| 126 | { KEY_F3, KEY_MUTE, APPLE_FLAG_FKEY }, |
| 127 | { KEY_F4, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY }, |
| 128 | { KEY_F5, KEY_VOLUMEUP, APPLE_FLAG_FKEY }, |
| 129 | { KEY_F6, KEY_NUMLOCK, APPLE_FLAG_FKEY }, |
| 130 | { KEY_F7, KEY_SWITCHVIDEOMODE, APPLE_FLAG_FKEY }, |
| 131 | { KEY_F8, KEY_KBDILLUMTOGGLE, APPLE_FLAG_FKEY }, |
| 132 | { KEY_F9, KEY_KBDILLUMDOWN, APPLE_FLAG_FKEY }, |
| 133 | { KEY_F10, KEY_KBDILLUMUP, APPLE_FLAG_FKEY }, |
| 134 | { KEY_UP, KEY_PAGEUP }, |
| 135 | { KEY_DOWN, KEY_PAGEDOWN }, |
| 136 | { KEY_LEFT, KEY_HOME }, |
| 137 | { KEY_RIGHT, KEY_END }, |
| 138 | { } |
| 139 | }; |
| 140 | |
Paul Collins | b2ddd54 | 2009-03-07 17:07:15 +1300 | [diff] [blame] | 141 | static const struct apple_key_translation powerbook_numlock_keys[] = { |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 142 | { KEY_J, KEY_KP1 }, |
| 143 | { KEY_K, KEY_KP2 }, |
| 144 | { KEY_L, KEY_KP3 }, |
| 145 | { KEY_U, KEY_KP4 }, |
| 146 | { KEY_I, KEY_KP5 }, |
| 147 | { KEY_O, KEY_KP6 }, |
| 148 | { KEY_7, KEY_KP7 }, |
| 149 | { KEY_8, KEY_KP8 }, |
| 150 | { KEY_9, KEY_KP9 }, |
| 151 | { KEY_M, KEY_KP0 }, |
| 152 | { KEY_DOT, KEY_KPDOT }, |
| 153 | { KEY_SLASH, KEY_KPPLUS }, |
| 154 | { KEY_SEMICOLON, KEY_KPMINUS }, |
| 155 | { KEY_P, KEY_KPASTERISK }, |
| 156 | { KEY_MINUS, KEY_KPEQUAL }, |
| 157 | { KEY_0, KEY_KPSLASH }, |
| 158 | { KEY_F6, KEY_NUMLOCK }, |
| 159 | { KEY_KPENTER, KEY_KPENTER }, |
| 160 | { KEY_BACKSPACE, KEY_BACKSPACE }, |
| 161 | { } |
| 162 | }; |
| 163 | |
Paul Collins | b2ddd54 | 2009-03-07 17:07:15 +1300 | [diff] [blame] | 164 | static const struct apple_key_translation apple_iso_keyboard[] = { |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 165 | { KEY_GRAVE, KEY_102ND }, |
| 166 | { KEY_102ND, KEY_GRAVE }, |
| 167 | { } |
| 168 | }; |
| 169 | |
Nanno Langstraat | 43c8314 | 2013-10-14 16:07:15 +0200 | [diff] [blame] | 170 | static const struct apple_key_translation swapped_option_cmd_keys[] = { |
| 171 | { KEY_LEFTALT, KEY_LEFTMETA }, |
| 172 | { KEY_LEFTMETA, KEY_LEFTALT }, |
| 173 | { KEY_RIGHTALT, KEY_RIGHTMETA }, |
| 174 | { KEY_RIGHTMETA,KEY_RIGHTALT }, |
| 175 | { } |
| 176 | }; |
| 177 | |
free5lot | 346338e | 2020-05-15 13:14:00 +0700 | [diff] [blame] | 178 | static const struct apple_key_translation swapped_fn_leftctrl_keys[] = { |
| 179 | { KEY_FN, KEY_LEFTCTRL }, |
| 180 | { } |
| 181 | }; |
| 182 | |
Paul Collins | b2ddd54 | 2009-03-07 17:07:15 +1300 | [diff] [blame] | 183 | static const struct apple_key_translation *apple_find_translation( |
| 184 | const struct apple_key_translation *table, u16 from) |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 185 | { |
Paul Collins | b2ddd54 | 2009-03-07 17:07:15 +1300 | [diff] [blame] | 186 | const struct apple_key_translation *trans; |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 187 | |
| 188 | /* Look for the translation */ |
| 189 | for (trans = table; trans->from; trans++) |
| 190 | if (trans->from == from) |
| 191 | return trans; |
| 192 | |
| 193 | return NULL; |
| 194 | } |
| 195 | |
Vincent Lefevre | 3b41fb4 | 2021-07-22 03:25:44 +0200 | [diff] [blame] | 196 | static void input_event_with_scancode(struct input_dev *input, |
| 197 | __u8 type, __u16 code, unsigned int hid, __s32 value) |
| 198 | { |
| 199 | if (type == EV_KEY && |
| 200 | (!test_bit(code, input->key)) == value) |
| 201 | input_event(input, EV_MSC, MSC_SCAN, hid); |
| 202 | input_event(input, type, code, value); |
| 203 | } |
| 204 | |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 205 | static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, |
| 206 | struct hid_usage *usage, __s32 value) |
| 207 | { |
| 208 | struct apple_sc *asc = hid_get_drvdata(hid); |
Jiri Kosina | a4bc692 | 2010-11-03 10:42:02 -0400 | [diff] [blame] | 209 | const struct apple_key_translation *trans, *table; |
Joao Moreno | aec256d | 2019-09-03 16:46:32 +0200 | [diff] [blame] | 210 | bool do_translate; |
| 211 | u16 code = 0; |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 212 | |
free5lot | 346338e | 2020-05-15 13:14:00 +0700 | [diff] [blame] | 213 | u16 fn_keycode = (swap_fn_leftctrl) ? (KEY_LEFTCTRL) : (KEY_FN); |
| 214 | |
| 215 | if (usage->code == fn_keycode) { |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 216 | asc->fn_on = !!value; |
Vincent Lefevre | 3b41fb4 | 2021-07-22 03:25:44 +0200 | [diff] [blame] | 217 | input_event_with_scancode(input, usage->type, KEY_FN, |
| 218 | usage->hid, value); |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 219 | return 1; |
| 220 | } |
| 221 | |
| 222 | if (fnmode) { |
Jiri Kosina | a4bc692 | 2010-11-03 10:42:02 -0400 | [diff] [blame] | 223 | if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI && |
| 224 | hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) |
| 225 | table = macbookair_fn_keys; |
| 226 | else if (hid->product < 0x21d || hid->product >= 0x300) |
| 227 | table = powerbook_fn_keys; |
| 228 | else |
| 229 | table = apple_fn_keys; |
| 230 | |
| 231 | trans = apple_find_translation (table, usage->code); |
Edgar (gimli) Hucek | 99b9f75 | 2010-11-03 10:36:18 -0400 | [diff] [blame] | 232 | |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 233 | if (trans) { |
Joao Moreno | aec256d | 2019-09-03 16:46:32 +0200 | [diff] [blame] | 234 | if (test_bit(trans->from, input->key)) |
| 235 | code = trans->from; |
| 236 | else if (test_bit(trans->to, input->key)) |
| 237 | code = trans->to; |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 238 | |
Joao Moreno | aec256d | 2019-09-03 16:46:32 +0200 | [diff] [blame] | 239 | if (!code) { |
| 240 | if (trans->flags & APPLE_FLAG_FKEY) { |
| 241 | switch (fnmode) { |
| 242 | case 1: |
| 243 | do_translate = !asc->fn_on; |
| 244 | break; |
| 245 | case 2: |
| 246 | do_translate = asc->fn_on; |
| 247 | break; |
| 248 | default: |
| 249 | /* should never happen */ |
| 250 | do_translate = false; |
| 251 | } |
| 252 | } else { |
| 253 | do_translate = asc->fn_on; |
| 254 | } |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 255 | |
Joao Moreno | aec256d | 2019-09-03 16:46:32 +0200 | [diff] [blame] | 256 | code = do_translate ? trans->to : trans->from; |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 257 | } |
Joao Moreno | aec256d | 2019-09-03 16:46:32 +0200 | [diff] [blame] | 258 | |
Vincent Lefevre | 3b41fb4 | 2021-07-22 03:25:44 +0200 | [diff] [blame] | 259 | input_event_with_scancode(input, usage->type, code, |
| 260 | usage->hid, value); |
Joao Moreno | aec256d | 2019-09-03 16:46:32 +0200 | [diff] [blame] | 261 | return 1; |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 262 | } |
| 263 | |
| 264 | if (asc->quirks & APPLE_NUMLOCK_EMULATION && |
| 265 | (test_bit(usage->code, asc->pressed_numlock) || |
| 266 | test_bit(LED_NUML, input->led))) { |
| 267 | trans = apple_find_translation(powerbook_numlock_keys, |
| 268 | usage->code); |
| 269 | |
| 270 | if (trans) { |
| 271 | if (value) |
| 272 | set_bit(usage->code, |
| 273 | asc->pressed_numlock); |
| 274 | else |
| 275 | clear_bit(usage->code, |
| 276 | asc->pressed_numlock); |
| 277 | |
Vincent Lefevre | 3b41fb4 | 2021-07-22 03:25:44 +0200 | [diff] [blame] | 278 | input_event_with_scancode(input, usage->type, |
| 279 | trans->to, usage->hid, value); |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 280 | } |
| 281 | |
| 282 | return 1; |
| 283 | } |
| 284 | } |
| 285 | |
Alex Henrie | d58cf34 | 2021-10-19 01:12:32 -0600 | [diff] [blame] | 286 | if (iso_layout > 0 || (iso_layout < 0 && (asc->quirks & APPLE_ISO_TILDE_QUIRK) && |
| 287 | hid->country == HID_COUNTRY_INTERNATIONAL_ISO)) { |
| 288 | trans = apple_find_translation(apple_iso_keyboard, usage->code); |
| 289 | if (trans) { |
| 290 | input_event_with_scancode(input, usage->type, |
| 291 | trans->to, usage->hid, value); |
| 292 | return 1; |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 293 | } |
| 294 | } |
| 295 | |
Nanno Langstraat | 43c8314 | 2013-10-14 16:07:15 +0200 | [diff] [blame] | 296 | if (swap_opt_cmd) { |
| 297 | trans = apple_find_translation(swapped_option_cmd_keys, usage->code); |
| 298 | if (trans) { |
Vincent Lefevre | 3b41fb4 | 2021-07-22 03:25:44 +0200 | [diff] [blame] | 299 | input_event_with_scancode(input, usage->type, |
| 300 | trans->to, usage->hid, value); |
Nanno Langstraat | 43c8314 | 2013-10-14 16:07:15 +0200 | [diff] [blame] | 301 | return 1; |
| 302 | } |
| 303 | } |
| 304 | |
free5lot | 346338e | 2020-05-15 13:14:00 +0700 | [diff] [blame] | 305 | if (swap_fn_leftctrl) { |
| 306 | trans = apple_find_translation(swapped_fn_leftctrl_keys, usage->code); |
| 307 | if (trans) { |
Vincent Lefevre | 3b41fb4 | 2021-07-22 03:25:44 +0200 | [diff] [blame] | 308 | input_event_with_scancode(input, usage->type, |
| 309 | trans->to, usage->hid, value); |
free5lot | 346338e | 2020-05-15 13:14:00 +0700 | [diff] [blame] | 310 | return 1; |
| 311 | } |
| 312 | } |
| 313 | |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 314 | return 0; |
| 315 | } |
| 316 | |
| 317 | static int apple_event(struct hid_device *hdev, struct hid_field *field, |
| 318 | struct hid_usage *usage, __s32 value) |
| 319 | { |
| 320 | struct apple_sc *asc = hid_get_drvdata(hdev); |
| 321 | |
| 322 | if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput || |
| 323 | !usage->type) |
| 324 | return 0; |
| 325 | |
| 326 | if ((asc->quirks & APPLE_INVERT_HWHEEL) && |
| 327 | usage->code == REL_HWHEEL) { |
Vincent Lefevre | 3b41fb4 | 2021-07-22 03:25:44 +0200 | [diff] [blame] | 328 | input_event_with_scancode(field->hidinput->input, usage->type, |
| 329 | usage->code, usage->hid, -value); |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 330 | return 1; |
| 331 | } |
| 332 | |
| 333 | if ((asc->quirks & APPLE_HAS_FN) && |
| 334 | hidinput_apple_event(hdev, field->hidinput->input, |
| 335 | usage, value)) |
| 336 | return 1; |
| 337 | |
| 338 | |
| 339 | return 0; |
| 340 | } |
| 341 | |
José Expósito | 6e14329 | 2021-11-18 08:29:55 +0100 | [diff] [blame] | 342 | static int apple_fetch_battery(struct hid_device *hdev) |
| 343 | { |
| 344 | #ifdef CONFIG_HID_BATTERY_STRENGTH |
| 345 | struct apple_sc *asc = hid_get_drvdata(hdev); |
| 346 | struct hid_report_enum *report_enum; |
| 347 | struct hid_report *report; |
| 348 | |
| 349 | if (!(asc->quirks & APPLE_RDESC_BATTERY) || !hdev->battery) |
| 350 | return -1; |
| 351 | |
| 352 | report_enum = &hdev->report_enum[hdev->battery_report_type]; |
| 353 | report = report_enum->report_id_hash[hdev->battery_report_id]; |
| 354 | |
| 355 | if (!report || report->maxfield < 1) |
| 356 | return -1; |
| 357 | |
| 358 | if (hdev->battery_capacity == hdev->battery_max) |
| 359 | return -1; |
| 360 | |
| 361 | hid_hw_request(hdev, report, HID_REQ_GET_REPORT); |
| 362 | return 0; |
| 363 | #else |
| 364 | return -1; |
| 365 | #endif |
| 366 | } |
| 367 | |
| 368 | static void apple_battery_timer_tick(struct timer_list *t) |
| 369 | { |
| 370 | struct apple_sc *asc = from_timer(asc, t, battery_timer); |
| 371 | struct hid_device *hdev = asc->hdev; |
| 372 | |
| 373 | if (apple_fetch_battery(hdev) == 0) { |
| 374 | mod_timer(&asc->battery_timer, |
| 375 | jiffies + msecs_to_jiffies(APPLE_BATTERY_TIMEOUT_MS)); |
| 376 | } |
| 377 | } |
| 378 | |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 379 | /* |
| 380 | * MacBook JIS keyboard has wrong logical maximum |
Mizuho Mori | 67fd71b | 2021-07-29 20:03:25 +0900 | [diff] [blame] | 381 | * Magic Keyboard JIS has wrong logical maximum |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 382 | */ |
Nikolai Kondrashov | 73e4008 | 2010-08-06 23:03:06 +0400 | [diff] [blame] | 383 | static __u8 *apple_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
| 384 | unsigned int *rsize) |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 385 | { |
| 386 | struct apple_sc *asc = hid_get_drvdata(hdev); |
| 387 | |
Mizuho Mori | 67fd71b | 2021-07-29 20:03:25 +0900 | [diff] [blame] | 388 | if(*rsize >=71 && rdesc[70] == 0x65 && rdesc[64] == 0x65) { |
| 389 | hid_info(hdev, |
| 390 | "fixing up Magic Keyboard JIS report descriptor\n"); |
| 391 | rdesc[64] = rdesc[70] = 0xe7; |
| 392 | } |
| 393 | |
Nikolai Kondrashov | 73e4008 | 2010-08-06 23:03:06 +0400 | [diff] [blame] | 394 | if ((asc->quirks & APPLE_RDESC_JIS) && *rsize >= 60 && |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 395 | rdesc[53] == 0x65 && rdesc[59] == 0x65) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 396 | hid_info(hdev, |
| 397 | "fixing up MacBook JIS keyboard report descriptor\n"); |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 398 | rdesc[53] = rdesc[59] = 0xe7; |
| 399 | } |
José Expósito | 6e14329 | 2021-11-18 08:29:55 +0100 | [diff] [blame] | 400 | |
| 401 | /* |
| 402 | * Change the usage from: |
| 403 | * 0x06, 0x00, 0xff, // Usage Page (Vendor Defined Page 1) 0 |
| 404 | * 0x09, 0x0b, // Usage (Vendor Usage 0x0b) 3 |
| 405 | * To: |
| 406 | * 0x05, 0x01, // Usage Page (Generic Desktop) 0 |
| 407 | * 0x09, 0x06, // Usage (Keyboard) 2 |
| 408 | */ |
| 409 | if ((asc->quirks & APPLE_RDESC_BATTERY) && *rsize == 83 && |
| 410 | rdesc[46] == 0x84 && rdesc[58] == 0x85) { |
| 411 | hid_info(hdev, |
| 412 | "fixing up Magic Keyboard battery report descriptor\n"); |
| 413 | *rsize = *rsize - 1; |
| 414 | rdesc = kmemdup(rdesc + 1, *rsize, GFP_KERNEL); |
| 415 | if (!rdesc) |
| 416 | return NULL; |
| 417 | |
| 418 | rdesc[0] = 0x05; |
| 419 | rdesc[1] = 0x01; |
| 420 | rdesc[2] = 0x09; |
| 421 | rdesc[3] = 0x06; |
| 422 | } |
| 423 | |
Nikolai Kondrashov | 73e4008 | 2010-08-06 23:03:06 +0400 | [diff] [blame] | 424 | return rdesc; |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 425 | } |
| 426 | |
| 427 | static void apple_setup_input(struct input_dev *input) |
| 428 | { |
Paul Collins | b2ddd54 | 2009-03-07 17:07:15 +1300 | [diff] [blame] | 429 | const struct apple_key_translation *trans; |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 430 | |
| 431 | set_bit(KEY_NUMLOCK, input->keybit); |
| 432 | |
| 433 | /* Enable all needed keys */ |
| 434 | for (trans = apple_fn_keys; trans->from; trans++) |
| 435 | set_bit(trans->to, input->keybit); |
| 436 | |
| 437 | for (trans = powerbook_fn_keys; trans->from; trans++) |
| 438 | set_bit(trans->to, input->keybit); |
| 439 | |
| 440 | for (trans = powerbook_numlock_keys; trans->from; trans++) |
| 441 | set_bit(trans->to, input->keybit); |
| 442 | |
| 443 | for (trans = apple_iso_keyboard; trans->from; trans++) |
| 444 | set_bit(trans->to, input->keybit); |
free5lot | 346338e | 2020-05-15 13:14:00 +0700 | [diff] [blame] | 445 | |
| 446 | if (swap_fn_leftctrl) { |
| 447 | for (trans = swapped_fn_leftctrl_keys; trans->from; trans++) |
| 448 | set_bit(trans->to, input->keybit); |
| 449 | } |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 450 | } |
| 451 | |
| 452 | static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi, |
| 453 | struct hid_field *field, struct hid_usage *usage, |
| 454 | unsigned long **bit, int *max) |
| 455 | { |
Hans de Goede | a5d8164 | 2020-06-20 14:32:29 +0200 | [diff] [blame] | 456 | struct apple_sc *asc = hid_get_drvdata(hdev); |
| 457 | |
Sean O'Brien | ee34549 | 2018-08-27 13:02:15 -0700 | [diff] [blame] | 458 | if (usage->hid == (HID_UP_CUSTOM | 0x0003) || |
Mansour Behabadi | e433be9 | 2020-01-29 17:26:31 +1100 | [diff] [blame] | 459 | usage->hid == (HID_UP_MSVENDOR | 0x0003) || |
| 460 | usage->hid == (HID_UP_HPVENDOR2 | 0x0003)) { |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 461 | /* The fn key on Apple USB keyboards */ |
| 462 | set_bit(EV_REP, hi->input->evbit); |
| 463 | hid_map_usage_clear(hi, usage, bit, max, EV_KEY, KEY_FN); |
Hans de Goede | a5d8164 | 2020-06-20 14:32:29 +0200 | [diff] [blame] | 464 | asc->fn_found = true; |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 465 | apple_setup_input(hi->input); |
| 466 | return 1; |
| 467 | } |
| 468 | |
| 469 | /* we want the hid layer to go through standard path (set and ignore) */ |
| 470 | return 0; |
| 471 | } |
| 472 | |
| 473 | static int apple_input_mapped(struct hid_device *hdev, struct hid_input *hi, |
| 474 | struct hid_field *field, struct hid_usage *usage, |
| 475 | unsigned long **bit, int *max) |
| 476 | { |
| 477 | struct apple_sc *asc = hid_get_drvdata(hdev); |
| 478 | |
| 479 | if (asc->quirks & APPLE_MIGHTYMOUSE) { |
| 480 | if (usage->hid == HID_GD_Z) |
| 481 | hid_map_usage(hi, usage, bit, max, EV_REL, REL_HWHEEL); |
| 482 | else if (usage->code == BTN_1) |
| 483 | hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_2); |
| 484 | else if (usage->code == BTN_2) |
| 485 | hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_1); |
| 486 | } |
| 487 | |
| 488 | return 0; |
| 489 | } |
| 490 | |
Hans de Goede | a5d8164 | 2020-06-20 14:32:29 +0200 | [diff] [blame] | 491 | static int apple_input_configured(struct hid_device *hdev, |
| 492 | struct hid_input *hidinput) |
| 493 | { |
| 494 | struct apple_sc *asc = hid_get_drvdata(hdev); |
| 495 | |
| 496 | if ((asc->quirks & APPLE_HAS_FN) && !asc->fn_found) { |
| 497 | hid_info(hdev, "Fn key not found (Apple Wireless Keyboard clone?), disabling Fn key handling\n"); |
José Expósito | a5fe786 | 2021-11-18 08:29:53 +0100 | [diff] [blame] | 498 | asc->quirks &= ~APPLE_HAS_FN; |
Hans de Goede | a5d8164 | 2020-06-20 14:32:29 +0200 | [diff] [blame] | 499 | } |
| 500 | |
| 501 | return 0; |
| 502 | } |
| 503 | |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 504 | static int apple_probe(struct hid_device *hdev, |
| 505 | const struct hid_device_id *id) |
| 506 | { |
| 507 | unsigned long quirks = id->driver_data; |
| 508 | struct apple_sc *asc; |
| 509 | int ret; |
| 510 | |
Benjamin Tissoires | abf832b | 2013-07-24 19:38:04 +0200 | [diff] [blame] | 511 | asc = devm_kzalloc(&hdev->dev, sizeof(*asc), GFP_KERNEL); |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 512 | if (asc == NULL) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 513 | hid_err(hdev, "can't alloc apple descriptor\n"); |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 514 | return -ENOMEM; |
| 515 | } |
| 516 | |
José Expósito | 6e14329 | 2021-11-18 08:29:55 +0100 | [diff] [blame] | 517 | asc->hdev = hdev; |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 518 | asc->quirks = quirks; |
| 519 | |
| 520 | hid_set_drvdata(hdev, asc); |
| 521 | |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 522 | ret = hid_parse(hdev); |
| 523 | if (ret) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 524 | hid_err(hdev, "parse failed\n"); |
Benjamin Tissoires | abf832b | 2013-07-24 19:38:04 +0200 | [diff] [blame] | 525 | return ret; |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 526 | } |
| 527 | |
Alexander F. Lent | cc84094 | 2021-09-16 15:38:40 -0400 | [diff] [blame] | 528 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 529 | if (ret) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 530 | hid_err(hdev, "hw start failed\n"); |
Benjamin Tissoires | abf832b | 2013-07-24 19:38:04 +0200 | [diff] [blame] | 531 | return ret; |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 532 | } |
| 533 | |
José Expósito | 6e14329 | 2021-11-18 08:29:55 +0100 | [diff] [blame] | 534 | timer_setup(&asc->battery_timer, apple_battery_timer_tick, 0); |
| 535 | mod_timer(&asc->battery_timer, |
| 536 | jiffies + msecs_to_jiffies(APPLE_BATTERY_TIMEOUT_MS)); |
| 537 | apple_fetch_battery(hdev); |
| 538 | |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 539 | return 0; |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 540 | } |
| 541 | |
José Expósito | 6e14329 | 2021-11-18 08:29:55 +0100 | [diff] [blame] | 542 | static void apple_remove(struct hid_device *hdev) |
| 543 | { |
| 544 | struct apple_sc *asc = hid_get_drvdata(hdev); |
| 545 | |
| 546 | del_timer_sync(&asc->battery_timer); |
| 547 | |
| 548 | hid_hw_stop(hdev); |
| 549 | } |
| 550 | |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 551 | static const struct hid_device_id apple_devices[] = { |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 552 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE), |
| 553 | .driver_data = APPLE_MIGHTYMOUSE | APPLE_INVERT_HWHEEL }, |
| 554 | |
| 555 | { 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] | 556 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 557 | { 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] | 558 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 559 | { 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] | 560 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 561 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO), |
Alex Henrie | bd77a0f | 2017-06-02 09:28:39 -0600 | [diff] [blame] | 562 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 563 | { 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] | 564 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 565 | { 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] | 566 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 567 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO), |
Alex Henrie | bd77a0f | 2017-06-02 09:28:39 -0600 | [diff] [blame] | 568 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 569 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS), |
| 570 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 571 | APPLE_RDESC_JIS }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 572 | { 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] | 573 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 574 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO), |
Alex Henrie | bd77a0f | 2017-06-02 09:28:39 -0600 | [diff] [blame] | 575 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 576 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS), |
| 577 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 578 | APPLE_RDESC_JIS }, |
Ryan Finnie | fef3f57 | 2009-03-05 10:18:01 +0100 | [diff] [blame] | 579 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ANSI), |
| 580 | .driver_data = APPLE_HAS_FN }, |
| 581 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ISO), |
Alex Henrie | bd77a0f | 2017-06-02 09:28:39 -0600 | [diff] [blame] | 582 | .driver_data = APPLE_HAS_FN }, |
Ryan Finnie | fef3f57 | 2009-03-05 10:18:01 +0100 | [diff] [blame] | 583 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_JIS), |
| 584 | .driver_data = APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 585 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI), |
| 586 | .driver_data = APPLE_HAS_FN }, |
| 587 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO), |
Alex Henrie | bd77a0f | 2017-06-02 09:28:39 -0600 | [diff] [blame] | 588 | .driver_data = APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 589 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS), |
| 590 | .driver_data = APPLE_HAS_FN }, |
| 591 | { 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] | 592 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 593 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO), |
Alex Henrie | bd77a0f | 2017-06-02 09:28:39 -0600 | [diff] [blame] | 594 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 595 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS), |
| 596 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
Jiri Slaby | b4d8e47 | 2008-10-22 14:47:18 +0200 | [diff] [blame] | 597 | APPLE_RDESC_JIS }, |
Dan Bastone | 4a4c879 | 2011-07-31 07:40:49 -0400 | [diff] [blame] | 598 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI), |
| 599 | .driver_data = APPLE_HAS_FN }, |
Haochen Tong | ebe0b42a | 2021-07-18 01:04:31 +0800 | [diff] [blame] | 600 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI), |
| 601 | .driver_data = APPLE_HAS_FN }, |
Dan Bastone | 4a4c879 | 2011-07-31 07:40:49 -0400 | [diff] [blame] | 602 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO), |
Alex Henrie | bd77a0f | 2017-06-02 09:28:39 -0600 | [diff] [blame] | 603 | .driver_data = APPLE_HAS_FN }, |
BALATON Zoltan | 4c94542 | 2020-07-20 22:53:46 +0200 | [diff] [blame] | 604 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO), |
| 605 | .driver_data = APPLE_HAS_FN }, |
Dan Bastone | 4a4c879 | 2011-07-31 07:40:49 -0400 | [diff] [blame] | 606 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_JIS), |
| 607 | .driver_data = APPLE_HAS_FN }, |
Jan Scholz | ee8a1a0 | 2008-11-26 15:33:45 +0100 | [diff] [blame] | 608 | { 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] | 609 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jan Scholz | ee8a1a0 | 2008-11-26 15:33:45 +0100 | [diff] [blame] | 610 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO), |
Alex Henrie | d58cf34 | 2021-10-19 01:12:32 -0600 | [diff] [blame] | 611 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
| 612 | APPLE_ISO_TILDE_QUIRK }, |
Andreas Krist | ad734bc | 2011-10-28 18:50:39 +0200 | [diff] [blame] | 613 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO), |
Alex Henrie | d58cf34 | 2021-10-19 01:12:32 -0600 | [diff] [blame] | 614 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
| 615 | APPLE_ISO_TILDE_QUIRK }, |
Alexey Kaminsky | 0a97e1e | 2012-04-23 18:02:18 +0200 | [diff] [blame] | 616 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, |
| 617 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI), |
| 618 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Huei-Horng Yo | bd4a7ce | 2014-02-06 17:40:34 +0800 | [diff] [blame] | 619 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, |
| 620 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS), |
| 621 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jan Scholz | ee8a1a0 | 2008-11-26 15:33:45 +0100 | [diff] [blame] | 622 | { 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] | 623 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Alex Henrie | 371a9dc | 2021-10-08 01:37:00 -0600 | [diff] [blame] | 624 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2015), |
José Expósito | 6e14329 | 2021-11-18 08:29:55 +0100 | [diff] [blame] | 625 | .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK | APPLE_RDESC_BATTERY }, |
Alex Henrie | 371a9dc | 2021-10-08 01:37:00 -0600 | [diff] [blame] | 626 | { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2015), |
Alex Henrie | d58cf34 | 2021-10-19 01:12:32 -0600 | [diff] [blame] | 627 | .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, |
Alex Henrie | 371a9dc | 2021-10-08 01:37:00 -0600 | [diff] [blame] | 628 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2015), |
José Expósito | 6e14329 | 2021-11-18 08:29:55 +0100 | [diff] [blame] | 629 | .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK | APPLE_RDESC_BATTERY }, |
Alex Henrie | 371a9dc | 2021-10-08 01:37:00 -0600 | [diff] [blame] | 630 | { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2015), |
Alex Henrie | d58cf34 | 2021-10-19 01:12:32 -0600 | [diff] [blame] | 631 | .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 632 | { 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] | 633 | .driver_data = APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 634 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO), |
Alex Henrie | bd77a0f | 2017-06-02 09:28:39 -0600 | [diff] [blame] | 635 | .driver_data = APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 636 | { 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] | 637 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 638 | { 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] | 639 | .driver_data = APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 640 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO), |
Alex Henrie | bd77a0f | 2017-06-02 09:28:39 -0600 | [diff] [blame] | 641 | .driver_data = APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 642 | { 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] | 643 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
Henrik Rydberg | a96d6ef | 2008-11-04 20:03:45 +0100 | [diff] [blame] | 644 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI), |
| 645 | .driver_data = APPLE_HAS_FN }, |
| 646 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO), |
Alex Henrie | bd77a0f | 2017-06-02 09:28:39 -0600 | [diff] [blame] | 647 | .driver_data = APPLE_HAS_FN }, |
Henrik Rydberg | a96d6ef | 2008-11-04 20:03:45 +0100 | [diff] [blame] | 648 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS), |
| 649 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
Edgar (gimli) Hucek | 99b9f75 | 2010-11-03 10:36:18 -0400 | [diff] [blame] | 650 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI), |
| 651 | .driver_data = APPLE_HAS_FN }, |
| 652 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO), |
Alex Henrie | bd77a0f | 2017-06-02 09:28:39 -0600 | [diff] [blame] | 653 | .driver_data = APPLE_HAS_FN }, |
Edgar (gimli) Hucek | 99b9f75 | 2010-11-03 10:36:18 -0400 | [diff] [blame] | 654 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS), |
| 655 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
| 656 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI), |
| 657 | .driver_data = APPLE_HAS_FN }, |
| 658 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO), |
Alex Henrie | bd77a0f | 2017-06-02 09:28:39 -0600 | [diff] [blame] | 659 | .driver_data = APPLE_HAS_FN }, |
Edgar (gimli) Hucek | 99b9f75 | 2010-11-03 10:36:18 -0400 | [diff] [blame] | 660 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS), |
| 661 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
Andy Botting | 47340bd | 2011-03-12 20:27:22 -0800 | [diff] [blame] | 662 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI), |
| 663 | .driver_data = APPLE_HAS_FN }, |
| 664 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO), |
Alex Henrie | bd77a0f | 2017-06-02 09:28:39 -0600 | [diff] [blame] | 665 | .driver_data = APPLE_HAS_FN }, |
Andy Botting | 47340bd | 2011-03-12 20:27:22 -0800 | [diff] [blame] | 666 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS), |
| 667 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
Joshua V. Dillon | 5d922ba | 2011-08-05 12:05:22 -0700 | [diff] [blame] | 668 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI), |
| 669 | .driver_data = APPLE_HAS_FN }, |
| 670 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO), |
Alex Henrie | bd77a0f | 2017-06-02 09:28:39 -0600 | [diff] [blame] | 671 | .driver_data = APPLE_HAS_FN }, |
Joshua V. Dillon | 5d922ba | 2011-08-05 12:05:22 -0700 | [diff] [blame] | 672 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS), |
| 673 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
Nobuhiro Iwamatsu | d762cc2 | 2011-10-01 15:54:53 +0900 | [diff] [blame] | 674 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI), |
| 675 | .driver_data = APPLE_HAS_FN }, |
| 676 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO), |
Alex Henrie | bd77a0f | 2017-06-02 09:28:39 -0600 | [diff] [blame] | 677 | .driver_data = APPLE_HAS_FN }, |
Nobuhiro Iwamatsu | d762cc2 | 2011-10-01 15:54:53 +0900 | [diff] [blame] | 678 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS), |
| 679 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
Gökçen Eraslan | 213f9da | 2011-10-22 22:39:06 +0300 | [diff] [blame] | 680 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI), |
| 681 | .driver_data = APPLE_HAS_FN }, |
| 682 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO), |
Alex Henrie | bd77a0f | 2017-06-02 09:28:39 -0600 | [diff] [blame] | 683 | .driver_data = APPLE_HAS_FN }, |
Gökçen Eraslan | 213f9da | 2011-10-22 22:39:06 +0300 | [diff] [blame] | 684 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS), |
| 685 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
Ryan Bourgeois | b2e6ad7 | 2012-07-10 09:43:33 -0700 | [diff] [blame] | 686 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI), |
| 687 | .driver_data = APPLE_HAS_FN }, |
| 688 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO), |
Alex Henrie | bd77a0f | 2017-06-02 09:28:39 -0600 | [diff] [blame] | 689 | .driver_data = APPLE_HAS_FN }, |
Ryan Bourgeois | b2e6ad7 | 2012-07-10 09:43:33 -0700 | [diff] [blame] | 690 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS), |
| 691 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
Dirk Hohndel | 8d80da9 | 2012-10-30 11:11:48 -0700 | [diff] [blame] | 692 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI), |
| 693 | .driver_data = APPLE_HAS_FN }, |
| 694 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO), |
Alex Henrie | bd77a0f | 2017-06-02 09:28:39 -0600 | [diff] [blame] | 695 | .driver_data = APPLE_HAS_FN }, |
Dirk Hohndel | 8d80da9 | 2012-10-30 11:11:48 -0700 | [diff] [blame] | 696 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS), |
| 697 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
Dmitry Torokhov | 9d9a04e | 2013-07-01 11:46:27 -0700 | [diff] [blame] | 698 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI), |
| 699 | .driver_data = APPLE_HAS_FN }, |
| 700 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO), |
Alex Henrie | bd77a0f | 2017-06-02 09:28:39 -0600 | [diff] [blame] | 701 | .driver_data = APPLE_HAS_FN }, |
Dmitry Torokhov | 9d9a04e | 2013-07-01 11:46:27 -0700 | [diff] [blame] | 702 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS), |
| 703 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
Henrik Rydberg | a4a2c54 | 2015-07-24 14:45:05 -0700 | [diff] [blame] | 704 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI), |
| 705 | .driver_data = APPLE_HAS_FN }, |
| 706 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ISO), |
Alex Henrie | bd77a0f | 2017-06-02 09:28:39 -0600 | [diff] [blame] | 707 | .driver_data = APPLE_HAS_FN }, |
Henrik Rydberg | a4a2c54 | 2015-07-24 14:45:05 -0700 | [diff] [blame] | 708 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_JIS), |
| 709 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
Christian Schuerer-Waldheim | 23aeb61 | 2010-01-06 14:49:57 +0100 | [diff] [blame] | 710 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), |
| 711 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
| 712 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), |
Alex Henrie | d58cf34 | 2021-10-19 01:12:32 -0600 | [diff] [blame] | 713 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
| 714 | APPLE_ISO_TILDE_QUIRK }, |
Christian Schuerer-Waldheim | 23aeb61 | 2010-01-06 14:49:57 +0100 | [diff] [blame] | 715 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS), |
| 716 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 717 | { 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] | 718 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 719 | { 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] | 720 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
Alex Henrie | 0cd3be5 | 2021-10-08 01:37:01 -0600 | [diff] [blame] | 721 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021), |
Alex Henrie | d58cf34 | 2021-10-19 01:12:32 -0600 | [diff] [blame] | 722 | .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, |
Alex Henrie | 0cd3be5 | 2021-10-08 01:37:01 -0600 | [diff] [blame] | 723 | { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021), |
Alex Henrie | d58cf34 | 2021-10-19 01:12:32 -0600 | [diff] [blame] | 724 | .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, |
Alex Henrie | 9f92d61 | 2021-12-01 23:16:50 -0700 | [diff] [blame^] | 725 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021), |
| 726 | .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, |
| 727 | { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021), |
| 728 | .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 729 | |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 730 | { } |
| 731 | }; |
| 732 | MODULE_DEVICE_TABLE(hid, apple_devices); |
| 733 | |
| 734 | static struct hid_driver apple_driver = { |
| 735 | .name = "apple", |
| 736 | .id_table = apple_devices, |
| 737 | .report_fixup = apple_report_fixup, |
| 738 | .probe = apple_probe, |
José Expósito | 6e14329 | 2021-11-18 08:29:55 +0100 | [diff] [blame] | 739 | .remove = apple_remove, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 740 | .event = apple_event, |
| 741 | .input_mapping = apple_input_mapping, |
| 742 | .input_mapped = apple_input_mapped, |
Hans de Goede | a5d8164 | 2020-06-20 14:32:29 +0200 | [diff] [blame] | 743 | .input_configured = apple_input_configured, |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 744 | }; |
H Hartley Sweeten | f425458 | 2012-12-17 15:28:26 -0700 | [diff] [blame] | 745 | module_hid_driver(apple_driver); |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 746 | |
Jiri Slaby | 8c19a51 | 2008-06-18 23:36:49 +0200 | [diff] [blame] | 747 | MODULE_LICENSE("GPL"); |