Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
144c71f7
Commit
144c71f7
authored
Aug 02, 2022
by
Jiri Kosina
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'for-5.20/apple' into for-linus
parents
c5567175
20afcc46
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
5 deletions
+30
-5
drivers/hid/hid-apple.c
drivers/hid/hid-apple.c
+30
-5
No files found.
drivers/hid/hid-apple.c
View file @
144c71f7
...
...
@@ -36,7 +36,7 @@
#define APPLE_NUMLOCK_EMULATION BIT(8)
#define APPLE_RDESC_BATTERY BIT(9)
#define APPLE_BACKLIGHT_CTL BIT(10)
#define APPLE_IS_
KEYCHRON
BIT(11)
#define APPLE_IS_
NON_APPLE
BIT(11)
#define APPLE_FLAG_FKEY 0x01
...
...
@@ -65,6 +65,10 @@ 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)"
);
struct
apple_non_apple_keyboard
{
char
*
name
;
};
struct
apple_sc_backlight
{
struct
led_classdev
cdev
;
struct
hid_device
*
hdev
;
...
...
@@ -313,6 +317,27 @@ static const struct apple_key_translation swapped_fn_leftctrl_keys[] = {
{
}
};
static
const
struct
apple_non_apple_keyboard
non_apple_keyboards
[]
=
{
{
"SONiX USB DEVICE"
},
{
"Keychron"
},
{
"AONE"
},
{
"GANSS"
}
};
static
bool
apple_is_non_apple_keyboard
(
struct
hid_device
*
hdev
)
{
int
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
non_apple_keyboards
);
i
++
)
{
char
*
non_apple
=
non_apple_keyboards
[
i
].
name
;
if
(
strncmp
(
hdev
->
name
,
non_apple
,
strlen
(
non_apple
))
==
0
)
return
true
;
}
return
false
;
}
static
inline
void
apple_setup_key_translation
(
struct
input_dev
*
input
,
const
struct
apple_key_translation
*
table
)
{
...
...
@@ -363,7 +388,7 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
}
if
(
fnmode
==
3
)
{
real_fnmode
=
(
asc
->
quirks
&
APPLE_IS_
KEYCHRON
)
?
2
:
1
;
real_fnmode
=
(
asc
->
quirks
&
APPLE_IS_
NON_APPLE
)
?
2
:
1
;
}
else
{
real_fnmode
=
fnmode
;
}
...
...
@@ -669,9 +694,9 @@ static int apple_input_configured(struct hid_device *hdev,
asc
->
quirks
&=
~
APPLE_HAS_FN
;
}
if
(
strncmp
(
hdev
->
name
,
"Keychron"
,
8
)
==
0
)
{
hid_info
(
hdev
,
"
Keychron
keyboard detected; function keys will default to fnmode=2 behavior
\n
"
);
asc
->
quirks
|=
APPLE_IS_
KEYCHRON
;
if
(
apple_is_non_apple_keyboard
(
hdev
)
)
{
hid_info
(
hdev
,
"
Non-apple
keyboard detected; function keys will default to fnmode=2 behavior
\n
"
);
asc
->
quirks
|=
APPLE_IS_
NON_APPLE
;
}
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment