2019-05-27 06:55:01 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2008-06-18 21:36:49 +00:00
|
|
|
/*
|
|
|
|
* USB HID quirks support for Linux
|
|
|
|
*
|
|
|
|
* Copyright (c) 1999 Andreas Gal
|
|
|
|
* Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
|
|
|
|
* Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
|
|
|
|
* Copyright (c) 2006-2007 Jiri Kosina
|
|
|
|
* Copyright (c) 2008 Jiri Slaby <jirislaby@gmail.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
*/
|
|
|
|
|
2010-12-10 03:29:03 +00:00
|
|
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
|
|
|
|
2008-06-18 21:36:49 +00:00
|
|
|
#include <linux/device.h>
|
|
|
|
#include <linux/hid.h>
|
|
|
|
#include <linux/module.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 08:04:11 +00:00
|
|
|
#include <linux/slab.h>
|
2008-06-18 21:36:49 +00:00
|
|
|
|
|
|
|
#include "hid-ids.h"
|
|
|
|
|
|
|
|
#define APPLE_RDESC_JIS 0x0001
|
|
|
|
#define APPLE_IGNORE_MOUSE 0x0002
|
|
|
|
#define APPLE_HAS_FN 0x0004
|
2021-09-16 19:38:40 +00:00
|
|
|
/* 0x0008 reserved, was: APPLE_HIDDEV */
|
2017-06-02 15:28:39 +00:00
|
|
|
/* 0x0010 reserved, was: APPLE_ISO_KEYBOARD */
|
2008-06-18 21:36:49 +00:00
|
|
|
#define APPLE_MIGHTYMOUSE 0x0020
|
|
|
|
#define APPLE_INVERT_HWHEEL 0x0040
|
2021-09-16 19:38:40 +00:00
|
|
|
/* 0x0080 reserved, was: APPLE_IGNORE_HIDINPUT */
|
2008-06-18 21:36:49 +00:00
|
|
|
#define APPLE_NUMLOCK_EMULATION 0x0100
|
|
|
|
|
|
|
|
#define APPLE_FLAG_FKEY 0x01
|
|
|
|
|
2017-06-02 15:28:39 +00:00
|
|
|
#define HID_COUNTRY_INTERNATIONAL_ISO 13
|
|
|
|
|
2008-06-18 21:36:49 +00:00
|
|
|
static unsigned int fnmode = 1;
|
|
|
|
module_param(fnmode, uint, 0644);
|
|
|
|
MODULE_PARM_DESC(fnmode, "Mode of fn key on Apple keyboards (0 = disabled, "
|
|
|
|
"[1] = fkeyslast, 2 = fkeysfirst)");
|
|
|
|
|
2010-01-05 22:30:30 +00:00
|
|
|
static unsigned int iso_layout = 1;
|
|
|
|
module_param(iso_layout, uint, 0644);
|
|
|
|
MODULE_PARM_DESC(iso_layout, "Enable/Disable hardcoded ISO-layout of the keyboard. "
|
|
|
|
"(0 = disabled, [1] = enabled)");
|
|
|
|
|
2013-10-14 14:07:42 +00:00
|
|
|
static unsigned int swap_opt_cmd;
|
2013-10-14 14:07:15 +00:00
|
|
|
module_param(swap_opt_cmd, uint, 0644);
|
|
|
|
MODULE_PARM_DESC(swap_opt_cmd, "Swap the Option (\"Alt\") and Command (\"Flag\") keys. "
|
|
|
|
"(For people who want to keep Windows PC keyboard muscle memory. "
|
|
|
|
"[0] = as-is, Mac layout. 1 = swapped, Windows layout.)");
|
|
|
|
|
2020-05-15 06:14:00 +00:00
|
|
|
static unsigned int swap_fn_leftctrl;
|
|
|
|
module_param(swap_fn_leftctrl, uint, 0644);
|
|
|
|
MODULE_PARM_DESC(swap_fn_leftctrl, "Swap the Fn and left Control keys. "
|
|
|
|
"(For people who want to keep PC keyboard muscle memory. "
|
|
|
|
"[0] = as-is, Mac layout, 1 = swapped, PC layout)");
|
|
|
|
|
2008-06-18 21:36:49 +00:00
|
|
|
struct apple_sc {
|
|
|
|
unsigned long quirks;
|
|
|
|
unsigned int fn_on;
|
2020-06-20 12:32:29 +00:00
|
|
|
unsigned int fn_found;
|
2008-06-18 21:36:49 +00:00
|
|
|
DECLARE_BITMAP(pressed_numlock, KEY_CNT);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct apple_key_translation {
|
|
|
|
u16 from;
|
|
|
|
u16 to;
|
|
|
|
u8 flags;
|
|
|
|
};
|
|
|
|
|
2010-11-03 14:36:18 +00:00
|
|
|
static const struct apple_key_translation macbookair_fn_keys[] = {
|
|
|
|
{ KEY_BACKSPACE, KEY_DELETE },
|
|
|
|
{ KEY_ENTER, KEY_INSERT },
|
|
|
|
{ KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F3, KEY_SCALE, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F4, KEY_DASHBOARD, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F6, KEY_PREVIOUSSONG, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F7, KEY_PLAYPAUSE, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F8, KEY_NEXTSONG, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F9, KEY_MUTE, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F10, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F11, KEY_VOLUMEUP, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F12, KEY_EJECTCD, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_UP, KEY_PAGEUP },
|
|
|
|
{ KEY_DOWN, KEY_PAGEDOWN },
|
|
|
|
{ KEY_LEFT, KEY_HOME },
|
|
|
|
{ KEY_RIGHT, KEY_END },
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2009-03-07 04:07:15 +00:00
|
|
|
static const struct apple_key_translation apple_fn_keys[] = {
|
2008-06-18 21:36:49 +00:00
|
|
|
{ KEY_BACKSPACE, KEY_DELETE },
|
2008-11-04 12:31:38 +00:00
|
|
|
{ KEY_ENTER, KEY_INSERT },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY },
|
2008-11-04 12:31:38 +00:00
|
|
|
{ KEY_F3, KEY_SCALE, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F4, KEY_DASHBOARD, APPLE_FLAG_FKEY },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ KEY_F5, KEY_KBDILLUMDOWN, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F6, KEY_KBDILLUMUP, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F7, KEY_PREVIOUSSONG, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F8, KEY_PLAYPAUSE, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F9, KEY_NEXTSONG, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F10, KEY_MUTE, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F11, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F12, KEY_VOLUMEUP, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_UP, KEY_PAGEUP },
|
|
|
|
{ KEY_DOWN, KEY_PAGEDOWN },
|
|
|
|
{ KEY_LEFT, KEY_HOME },
|
|
|
|
{ KEY_RIGHT, KEY_END },
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2009-03-07 04:07:15 +00:00
|
|
|
static const struct apple_key_translation powerbook_fn_keys[] = {
|
2008-06-18 21:36:49 +00:00
|
|
|
{ KEY_BACKSPACE, KEY_DELETE },
|
|
|
|
{ KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F3, KEY_MUTE, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F4, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F5, KEY_VOLUMEUP, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F6, KEY_NUMLOCK, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F7, KEY_SWITCHVIDEOMODE, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F8, KEY_KBDILLUMTOGGLE, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F9, KEY_KBDILLUMDOWN, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_F10, KEY_KBDILLUMUP, APPLE_FLAG_FKEY },
|
|
|
|
{ KEY_UP, KEY_PAGEUP },
|
|
|
|
{ KEY_DOWN, KEY_PAGEDOWN },
|
|
|
|
{ KEY_LEFT, KEY_HOME },
|
|
|
|
{ KEY_RIGHT, KEY_END },
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2009-03-07 04:07:15 +00:00
|
|
|
static const struct apple_key_translation powerbook_numlock_keys[] = {
|
2008-06-18 21:36:49 +00:00
|
|
|
{ KEY_J, KEY_KP1 },
|
|
|
|
{ KEY_K, KEY_KP2 },
|
|
|
|
{ KEY_L, KEY_KP3 },
|
|
|
|
{ KEY_U, KEY_KP4 },
|
|
|
|
{ KEY_I, KEY_KP5 },
|
|
|
|
{ KEY_O, KEY_KP6 },
|
|
|
|
{ KEY_7, KEY_KP7 },
|
|
|
|
{ KEY_8, KEY_KP8 },
|
|
|
|
{ KEY_9, KEY_KP9 },
|
|
|
|
{ KEY_M, KEY_KP0 },
|
|
|
|
{ KEY_DOT, KEY_KPDOT },
|
|
|
|
{ KEY_SLASH, KEY_KPPLUS },
|
|
|
|
{ KEY_SEMICOLON, KEY_KPMINUS },
|
|
|
|
{ KEY_P, KEY_KPASTERISK },
|
|
|
|
{ KEY_MINUS, KEY_KPEQUAL },
|
|
|
|
{ KEY_0, KEY_KPSLASH },
|
|
|
|
{ KEY_F6, KEY_NUMLOCK },
|
|
|
|
{ KEY_KPENTER, KEY_KPENTER },
|
|
|
|
{ KEY_BACKSPACE, KEY_BACKSPACE },
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2009-03-07 04:07:15 +00:00
|
|
|
static const struct apple_key_translation apple_iso_keyboard[] = {
|
2008-06-18 21:36:49 +00:00
|
|
|
{ KEY_GRAVE, KEY_102ND },
|
|
|
|
{ KEY_102ND, KEY_GRAVE },
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2013-10-14 14:07:15 +00:00
|
|
|
static const struct apple_key_translation swapped_option_cmd_keys[] = {
|
|
|
|
{ KEY_LEFTALT, KEY_LEFTMETA },
|
|
|
|
{ KEY_LEFTMETA, KEY_LEFTALT },
|
|
|
|
{ KEY_RIGHTALT, KEY_RIGHTMETA },
|
|
|
|
{ KEY_RIGHTMETA,KEY_RIGHTALT },
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2020-05-15 06:14:00 +00:00
|
|
|
static const struct apple_key_translation swapped_fn_leftctrl_keys[] = {
|
|
|
|
{ KEY_FN, KEY_LEFTCTRL },
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2009-03-07 04:07:15 +00:00
|
|
|
static const struct apple_key_translation *apple_find_translation(
|
|
|
|
const struct apple_key_translation *table, u16 from)
|
2008-06-18 21:36:49 +00:00
|
|
|
{
|
2009-03-07 04:07:15 +00:00
|
|
|
const struct apple_key_translation *trans;
|
2008-06-18 21:36:49 +00:00
|
|
|
|
|
|
|
/* Look for the translation */
|
|
|
|
for (trans = table; trans->from; trans++)
|
|
|
|
if (trans->from == from)
|
|
|
|
return trans;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2021-07-22 01:25:44 +00:00
|
|
|
static void input_event_with_scancode(struct input_dev *input,
|
|
|
|
__u8 type, __u16 code, unsigned int hid, __s32 value)
|
|
|
|
{
|
|
|
|
if (type == EV_KEY &&
|
|
|
|
(!test_bit(code, input->key)) == value)
|
|
|
|
input_event(input, EV_MSC, MSC_SCAN, hid);
|
|
|
|
input_event(input, type, code, value);
|
|
|
|
}
|
|
|
|
|
2008-06-18 21:36:49 +00:00
|
|
|
static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
|
|
|
|
struct hid_usage *usage, __s32 value)
|
|
|
|
{
|
|
|
|
struct apple_sc *asc = hid_get_drvdata(hid);
|
2010-11-03 14:42:02 +00:00
|
|
|
const struct apple_key_translation *trans, *table;
|
2019-09-03 14:46:32 +00:00
|
|
|
bool do_translate;
|
|
|
|
u16 code = 0;
|
2008-06-18 21:36:49 +00:00
|
|
|
|
2020-05-15 06:14:00 +00:00
|
|
|
u16 fn_keycode = (swap_fn_leftctrl) ? (KEY_LEFTCTRL) : (KEY_FN);
|
|
|
|
|
|
|
|
if (usage->code == fn_keycode) {
|
2008-06-18 21:36:49 +00:00
|
|
|
asc->fn_on = !!value;
|
2021-07-22 01:25:44 +00:00
|
|
|
input_event_with_scancode(input, usage->type, KEY_FN,
|
|
|
|
usage->hid, value);
|
2008-06-18 21:36:49 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fnmode) {
|
2010-11-03 14:42:02 +00:00
|
|
|
if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
|
|
|
|
hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS)
|
|
|
|
table = macbookair_fn_keys;
|
|
|
|
else if (hid->product < 0x21d || hid->product >= 0x300)
|
|
|
|
table = powerbook_fn_keys;
|
|
|
|
else
|
|
|
|
table = apple_fn_keys;
|
|
|
|
|
|
|
|
trans = apple_find_translation (table, usage->code);
|
2010-11-03 14:36:18 +00:00
|
|
|
|
2008-06-18 21:36:49 +00:00
|
|
|
if (trans) {
|
2019-09-03 14:46:32 +00:00
|
|
|
if (test_bit(trans->from, input->key))
|
|
|
|
code = trans->from;
|
|
|
|
else if (test_bit(trans->to, input->key))
|
|
|
|
code = trans->to;
|
|
|
|
|
|
|
|
if (!code) {
|
|
|
|
if (trans->flags & APPLE_FLAG_FKEY) {
|
|
|
|
switch (fnmode) {
|
|
|
|
case 1:
|
|
|
|
do_translate = !asc->fn_on;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
do_translate = asc->fn_on;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* should never happen */
|
|
|
|
do_translate = false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
do_translate = asc->fn_on;
|
|
|
|
}
|
|
|
|
|
|
|
|
code = do_translate ? trans->to : trans->from;
|
2008-06-18 21:36:49 +00:00
|
|
|
}
|
2019-09-03 14:46:32 +00:00
|
|
|
|
2021-07-22 01:25:44 +00:00
|
|
|
input_event_with_scancode(input, usage->type, code,
|
|
|
|
usage->hid, value);
|
2019-09-03 14:46:32 +00:00
|
|
|
return 1;
|
2008-06-18 21:36:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (asc->quirks & APPLE_NUMLOCK_EMULATION &&
|
|
|
|
(test_bit(usage->code, asc->pressed_numlock) ||
|
|
|
|
test_bit(LED_NUML, input->led))) {
|
|
|
|
trans = apple_find_translation(powerbook_numlock_keys,
|
|
|
|
usage->code);
|
|
|
|
|
|
|
|
if (trans) {
|
|
|
|
if (value)
|
|
|
|
set_bit(usage->code,
|
|
|
|
asc->pressed_numlock);
|
|
|
|
else
|
|
|
|
clear_bit(usage->code,
|
|
|
|
asc->pressed_numlock);
|
|
|
|
|
2021-07-22 01:25:44 +00:00
|
|
|
input_event_with_scancode(input, usage->type,
|
|
|
|
trans->to, usage->hid, value);
|
2008-06-18 21:36:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-18 10:22:40 +00:00
|
|
|
if (iso_layout) {
|
2017-06-02 15:28:39 +00:00
|
|
|
if (hid->country == HID_COUNTRY_INTERNATIONAL_ISO) {
|
2010-01-05 22:30:30 +00:00
|
|
|
trans = apple_find_translation(apple_iso_keyboard, usage->code);
|
|
|
|
if (trans) {
|
2021-07-22 01:25:44 +00:00
|
|
|
input_event_with_scancode(input, usage->type,
|
|
|
|
trans->to, usage->hid, value);
|
2010-01-05 22:30:30 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2008-06-18 21:36:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-14 14:07:15 +00:00
|
|
|
if (swap_opt_cmd) {
|
|
|
|
trans = apple_find_translation(swapped_option_cmd_keys, usage->code);
|
|
|
|
if (trans) {
|
2021-07-22 01:25:44 +00:00
|
|
|
input_event_with_scancode(input, usage->type,
|
|
|
|
trans->to, usage->hid, value);
|
2013-10-14 14:07:15 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 06:14:00 +00:00
|
|
|
if (swap_fn_leftctrl) {
|
|
|
|
trans = apple_find_translation(swapped_fn_leftctrl_keys, usage->code);
|
|
|
|
if (trans) {
|
2021-07-22 01:25:44 +00:00
|
|
|
input_event_with_scancode(input, usage->type,
|
|
|
|
trans->to, usage->hid, value);
|
2020-05-15 06:14:00 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-06-18 21:36:49 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int apple_event(struct hid_device *hdev, struct hid_field *field,
|
|
|
|
struct hid_usage *usage, __s32 value)
|
|
|
|
{
|
|
|
|
struct apple_sc *asc = hid_get_drvdata(hdev);
|
|
|
|
|
|
|
|
if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput ||
|
|
|
|
!usage->type)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if ((asc->quirks & APPLE_INVERT_HWHEEL) &&
|
|
|
|
usage->code == REL_HWHEEL) {
|
2021-07-22 01:25:44 +00:00
|
|
|
input_event_with_scancode(field->hidinput->input, usage->type,
|
|
|
|
usage->code, usage->hid, -value);
|
2008-06-18 21:36:49 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((asc->quirks & APPLE_HAS_FN) &&
|
|
|
|
hidinput_apple_event(hdev, field->hidinput->input,
|
|
|
|
usage, value))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MacBook JIS keyboard has wrong logical maximum
|
|
|
|
*/
|
2010-08-06 19:03:06 +00:00
|
|
|
static __u8 *apple_report_fixup(struct hid_device *hdev, __u8 *rdesc,
|
|
|
|
unsigned int *rsize)
|
2008-06-18 21:36:49 +00:00
|
|
|
{
|
|
|
|
struct apple_sc *asc = hid_get_drvdata(hdev);
|
|
|
|
|
2010-08-06 19:03:06 +00:00
|
|
|
if ((asc->quirks & APPLE_RDESC_JIS) && *rsize >= 60 &&
|
2008-06-18 21:36:49 +00:00
|
|
|
rdesc[53] == 0x65 && rdesc[59] == 0x65) {
|
2010-12-10 03:29:03 +00:00
|
|
|
hid_info(hdev,
|
|
|
|
"fixing up MacBook JIS keyboard report descriptor\n");
|
2008-06-18 21:36:49 +00:00
|
|
|
rdesc[53] = rdesc[59] = 0xe7;
|
|
|
|
}
|
2010-08-06 19:03:06 +00:00
|
|
|
return rdesc;
|
2008-06-18 21:36:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void apple_setup_input(struct input_dev *input)
|
|
|
|
{
|
2009-03-07 04:07:15 +00:00
|
|
|
const struct apple_key_translation *trans;
|
2008-06-18 21:36:49 +00:00
|
|
|
|
|
|
|
set_bit(KEY_NUMLOCK, input->keybit);
|
|
|
|
|
|
|
|
/* Enable all needed keys */
|
|
|
|
for (trans = apple_fn_keys; trans->from; trans++)
|
|
|
|
set_bit(trans->to, input->keybit);
|
|
|
|
|
|
|
|
for (trans = powerbook_fn_keys; trans->from; trans++)
|
|
|
|
set_bit(trans->to, input->keybit);
|
|
|
|
|
|
|
|
for (trans = powerbook_numlock_keys; trans->from; trans++)
|
|
|
|
set_bit(trans->to, input->keybit);
|
|
|
|
|
|
|
|
for (trans = apple_iso_keyboard; trans->from; trans++)
|
|
|
|
set_bit(trans->to, input->keybit);
|
2020-05-15 06:14:00 +00:00
|
|
|
|
|
|
|
if (swap_fn_leftctrl) {
|
|
|
|
for (trans = swapped_fn_leftctrl_keys; trans->from; trans++)
|
|
|
|
set_bit(trans->to, input->keybit);
|
|
|
|
}
|
2008-06-18 21:36:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi,
|
|
|
|
struct hid_field *field, struct hid_usage *usage,
|
|
|
|
unsigned long **bit, int *max)
|
|
|
|
{
|
2020-06-20 12:32:29 +00:00
|
|
|
struct apple_sc *asc = hid_get_drvdata(hdev);
|
|
|
|
|
2018-08-27 20:02:15 +00:00
|
|
|
if (usage->hid == (HID_UP_CUSTOM | 0x0003) ||
|
2020-01-29 06:26:31 +00:00
|
|
|
usage->hid == (HID_UP_MSVENDOR | 0x0003) ||
|
|
|
|
usage->hid == (HID_UP_HPVENDOR2 | 0x0003)) {
|
2008-06-18 21:36:49 +00:00
|
|
|
/* The fn key on Apple USB keyboards */
|
|
|
|
set_bit(EV_REP, hi->input->evbit);
|
|
|
|
hid_map_usage_clear(hi, usage, bit, max, EV_KEY, KEY_FN);
|
2020-06-20 12:32:29 +00:00
|
|
|
asc->fn_found = true;
|
2008-06-18 21:36:49 +00:00
|
|
|
apple_setup_input(hi->input);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* we want the hid layer to go through standard path (set and ignore) */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int apple_input_mapped(struct hid_device *hdev, struct hid_input *hi,
|
|
|
|
struct hid_field *field, struct hid_usage *usage,
|
|
|
|
unsigned long **bit, int *max)
|
|
|
|
{
|
|
|
|
struct apple_sc *asc = hid_get_drvdata(hdev);
|
|
|
|
|
|
|
|
if (asc->quirks & APPLE_MIGHTYMOUSE) {
|
|
|
|
if (usage->hid == HID_GD_Z)
|
|
|
|
hid_map_usage(hi, usage, bit, max, EV_REL, REL_HWHEEL);
|
|
|
|
else if (usage->code == BTN_1)
|
|
|
|
hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_2);
|
|
|
|
else if (usage->code == BTN_2)
|
|
|
|
hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_1);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-06-20 12:32:29 +00:00
|
|
|
static int apple_input_configured(struct hid_device *hdev,
|
|
|
|
struct hid_input *hidinput)
|
|
|
|
{
|
|
|
|
struct apple_sc *asc = hid_get_drvdata(hdev);
|
|
|
|
|
|
|
|
if ((asc->quirks & APPLE_HAS_FN) && !asc->fn_found) {
|
|
|
|
hid_info(hdev, "Fn key not found (Apple Wireless Keyboard clone?), disabling Fn key handling\n");
|
|
|
|
asc->quirks = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-06-18 21:36:49 +00:00
|
|
|
static int apple_probe(struct hid_device *hdev,
|
|
|
|
const struct hid_device_id *id)
|
|
|
|
{
|
|
|
|
unsigned long quirks = id->driver_data;
|
|
|
|
struct apple_sc *asc;
|
|
|
|
int ret;
|
|
|
|
|
2013-07-24 17:38:04 +00:00
|
|
|
asc = devm_kzalloc(&hdev->dev, sizeof(*asc), GFP_KERNEL);
|
2008-06-18 21:36:49 +00:00
|
|
|
if (asc == NULL) {
|
2010-12-10 03:29:03 +00:00
|
|
|
hid_err(hdev, "can't alloc apple descriptor\n");
|
2008-06-18 21:36:49 +00:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
asc->quirks = quirks;
|
|
|
|
|
|
|
|
hid_set_drvdata(hdev, asc);
|
|
|
|
|
|
|
|
ret = hid_parse(hdev);
|
|
|
|
if (ret) {
|
2010-12-10 03:29:03 +00:00
|
|
|
hid_err(hdev, "parse failed\n");
|
2013-07-24 17:38:04 +00:00
|
|
|
return ret;
|
2008-06-18 21:36:49 +00:00
|
|
|
}
|
|
|
|
|
2021-09-16 19:38:40 +00:00
|
|
|
ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
|
2008-06-18 21:36:49 +00:00
|
|
|
if (ret) {
|
2010-12-10 03:29:03 +00:00
|
|
|
hid_err(hdev, "hw start failed\n");
|
2013-07-24 17:38:04 +00:00
|
|
|
return ret;
|
2008-06-18 21:36:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct hid_device_id apple_devices[] = {
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE),
|
|
|
|
.driver_data = APPLE_MIGHTYMOUSE | APPLE_INVERT_HWHEEL },
|
|
|
|
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI),
|
2008-10-22 12:47:18 +00:00
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO),
|
2008-10-22 12:47:18 +00:00
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI),
|
2008-10-22 12:47:18 +00:00
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO),
|
2017-06-02 15:28:39 +00:00
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS),
|
2008-10-22 12:47:18 +00:00
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI),
|
2008-10-22 12:47:18 +00:00
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO),
|
2017-06-02 15:28:39 +00:00
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS),
|
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
|
2008-10-22 12:47:18 +00:00
|
|
|
APPLE_RDESC_JIS },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI),
|
2008-10-22 12:47:18 +00:00
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO),
|
2017-06-02 15:28:39 +00:00
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS),
|
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
|
2008-10-22 12:47:18 +00:00
|
|
|
APPLE_RDESC_JIS },
|
2009-03-05 09:18:01 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ANSI),
|
|
|
|
.driver_data = APPLE_HAS_FN },
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ISO),
|
2017-06-02 15:28:39 +00:00
|
|
|
.driver_data = APPLE_HAS_FN },
|
2009-03-05 09:18:01 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_JIS),
|
|
|
|
.driver_data = APPLE_HAS_FN },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI),
|
|
|
|
.driver_data = APPLE_HAS_FN },
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO),
|
2017-06-02 15:28:39 +00:00
|
|
|
.driver_data = APPLE_HAS_FN },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS),
|
|
|
|
.driver_data = APPLE_HAS_FN },
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI),
|
2008-10-22 12:47:18 +00:00
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO),
|
2017-06-02 15:28:39 +00:00
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS),
|
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
|
2008-10-22 12:47:18 +00:00
|
|
|
APPLE_RDESC_JIS },
|
2011-07-31 11:40:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI),
|
|
|
|
.driver_data = APPLE_HAS_FN },
|
2021-07-17 17:04:31 +00:00
|
|
|
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI),
|
|
|
|
.driver_data = APPLE_HAS_FN },
|
2011-07-31 11:40:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO),
|
2017-06-02 15:28:39 +00:00
|
|
|
.driver_data = APPLE_HAS_FN },
|
2020-07-20 20:53:46 +00:00
|
|
|
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO),
|
|
|
|
.driver_data = APPLE_HAS_FN },
|
2011-07-31 11:40:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_JIS),
|
|
|
|
.driver_data = APPLE_HAS_FN },
|
2008-11-26 14:33:45 +00:00
|
|
|
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI),
|
2008-06-18 21:36:49 +00:00
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
|
2008-11-26 14:33:45 +00:00
|
|
|
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO),
|
2017-06-02 15:28:39 +00:00
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
|
2011-10-28 16:50:39 +00:00
|
|
|
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO),
|
2017-06-02 15:28:39 +00:00
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
|
2012-04-23 16:02:18 +00:00
|
|
|
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
|
|
|
|
USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI),
|
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
|
2014-02-06 09:40:34 +00:00
|
|
|
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
|
|
|
|
USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS),
|
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
|
2008-11-26 14:33:45 +00:00
|
|
|
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS),
|
2008-06-18 21:36:49 +00:00
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
|
2021-10-08 07:37:00 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2015),
|
2016-07-11 15:41:26 +00:00
|
|
|
.driver_data = APPLE_HAS_FN },
|
2021-10-08 07:37:00 +00:00
|
|
|
{ HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2015),
|
2018-08-27 20:02:15 +00:00
|
|
|
.driver_data = APPLE_HAS_FN },
|
2021-10-08 07:37:00 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2015),
|
2018-08-27 20:02:15 +00:00
|
|
|
.driver_data = APPLE_HAS_FN },
|
2021-10-08 07:37:00 +00:00
|
|
|
{ HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2015),
|
2018-08-27 20:02:15 +00:00
|
|
|
.driver_data = APPLE_HAS_FN },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI),
|
2008-10-22 12:47:18 +00:00
|
|
|
.driver_data = APPLE_HAS_FN },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO),
|
2017-06-02 15:28:39 +00:00
|
|
|
.driver_data = APPLE_HAS_FN },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS),
|
2008-10-22 12:47:18 +00:00
|
|
|
.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI),
|
2008-10-22 12:47:18 +00:00
|
|
|
.driver_data = APPLE_HAS_FN },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO),
|
2017-06-02 15:28:39 +00:00
|
|
|
.driver_data = APPLE_HAS_FN },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS),
|
2008-10-22 12:47:18 +00:00
|
|
|
.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
|
2008-11-04 19:03:45 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI),
|
|
|
|
.driver_data = APPLE_HAS_FN },
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO),
|
2017-06-02 15:28:39 +00:00
|
|
|
.driver_data = APPLE_HAS_FN },
|
2008-11-04 19:03:45 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS),
|
|
|
|
.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
|
2010-11-03 14:36:18 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI),
|
|
|
|
.driver_data = APPLE_HAS_FN },
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO),
|
2017-06-02 15:28:39 +00:00
|
|
|
.driver_data = APPLE_HAS_FN },
|
2010-11-03 14:36:18 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS),
|
|
|
|
.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI),
|
|
|
|
.driver_data = APPLE_HAS_FN },
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO),
|
2017-06-02 15:28:39 +00:00
|
|
|
.driver_data = APPLE_HAS_FN },
|
2010-11-03 14:36:18 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS),
|
|
|
|
.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
|
2011-03-13 04:27:22 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI),
|
|
|
|
.driver_data = APPLE_HAS_FN },
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO),
|
2017-06-02 15:28:39 +00:00
|
|
|
.driver_data = APPLE_HAS_FN },
|
2011-03-13 04:27:22 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS),
|
|
|
|
.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
|
2011-08-05 19:05:22 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI),
|
|
|
|
.driver_data = APPLE_HAS_FN },
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO),
|
2017-06-02 15:28:39 +00:00
|
|
|
.driver_data = APPLE_HAS_FN },
|
2011-08-05 19:05:22 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS),
|
|
|
|
.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
|
2011-10-01 06:54:53 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI),
|
|
|
|
.driver_data = APPLE_HAS_FN },
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO),
|
2017-06-02 15:28:39 +00:00
|
|
|
.driver_data = APPLE_HAS_FN },
|
2011-10-01 06:54:53 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS),
|
|
|
|
.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
|
2011-10-22 19:39:06 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI),
|
|
|
|
.driver_data = APPLE_HAS_FN },
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO),
|
2017-06-02 15:28:39 +00:00
|
|
|
.driver_data = APPLE_HAS_FN },
|
2011-10-22 19:39:06 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS),
|
|
|
|
.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
|
2012-07-10 16:43:33 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI),
|
|
|
|
.driver_data = APPLE_HAS_FN },
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO),
|
2017-06-02 15:28:39 +00:00
|
|
|
.driver_data = APPLE_HAS_FN },
|
2012-07-10 16:43:33 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS),
|
|
|
|
.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
|
2012-10-30 18:11:48 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI),
|
|
|
|
.driver_data = APPLE_HAS_FN },
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO),
|
2017-06-02 15:28:39 +00:00
|
|
|
.driver_data = APPLE_HAS_FN },
|
2012-10-30 18:11:48 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS),
|
|
|
|
.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
|
2013-07-01 18:46:27 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI),
|
|
|
|
.driver_data = APPLE_HAS_FN },
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO),
|
2017-06-02 15:28:39 +00:00
|
|
|
.driver_data = APPLE_HAS_FN },
|
2013-07-01 18:46:27 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS),
|
|
|
|
.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
|
2015-07-24 21:45:05 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI),
|
|
|
|
.driver_data = APPLE_HAS_FN },
|
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ISO),
|
2017-06-02 15:28:39 +00:00
|
|
|
.driver_data = APPLE_HAS_FN },
|
2015-07-24 21:45:05 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_JIS),
|
|
|
|
.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
|
2010-01-06 13:49:57 +00:00
|
|
|
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
|
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
|
|
|
|
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
|
2017-06-02 15:28:39 +00:00
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
|
2010-01-06 13:49:57 +00:00
|
|
|
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS),
|
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY),
|
2008-10-22 12:47:18 +00:00
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
|
2008-06-18 21:36:49 +00:00
|
|
|
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY),
|
2008-10-22 12:47:18 +00:00
|
|
|
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
|
2008-06-18 21:36:49 +00:00
|
|
|
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(hid, apple_devices);
|
|
|
|
|
|
|
|
static struct hid_driver apple_driver = {
|
|
|
|
.name = "apple",
|
|
|
|
.id_table = apple_devices,
|
|
|
|
.report_fixup = apple_report_fixup,
|
|
|
|
.probe = apple_probe,
|
|
|
|
.event = apple_event,
|
|
|
|
.input_mapping = apple_input_mapping,
|
|
|
|
.input_mapped = apple_input_mapped,
|
2020-06-20 12:32:29 +00:00
|
|
|
.input_configured = apple_input_configured,
|
2008-06-18 21:36:49 +00:00
|
|
|
};
|
2012-12-17 22:28:26 +00:00
|
|
|
module_hid_driver(apple_driver);
|
2008-06-18 21:36:49 +00:00
|
|
|
|
|
|
|
MODULE_LICENSE("GPL");
|