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
fcd89e77
Commit
fcd89e77
authored
Feb 23, 2021
by
Jiri Kosina
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'for-5.12/chicony' into for-linus
- KEY_RFKILL support for Chicony devices from Jian-Hong Pan
parents
760f7e7b
859b510b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
0 deletions
+56
-0
drivers/hid/hid-chicony.c
drivers/hid/hid-chicony.c
+55
-0
drivers/hid/hid-ids.h
drivers/hid/hid-ids.h
+1
-0
No files found.
drivers/hid/hid-chicony.c
View file @
fcd89e77
...
...
@@ -21,6 +21,39 @@
#include "hid-ids.h"
#define CH_WIRELESS_CTL_REPORT_ID 0x11
static
int
ch_report_wireless
(
struct
hid_report
*
report
,
u8
*
data
,
int
size
)
{
struct
hid_device
*
hdev
=
report
->
device
;
struct
input_dev
*
input
;
if
(
report
->
id
!=
CH_WIRELESS_CTL_REPORT_ID
||
report
->
maxfield
!=
1
)
return
0
;
input
=
report
->
field
[
0
]
->
hidinput
->
input
;
if
(
!
input
)
{
hid_warn
(
hdev
,
"can't find wireless radio control's input"
);
return
0
;
}
input_report_key
(
input
,
KEY_RFKILL
,
1
);
input_sync
(
input
);
input_report_key
(
input
,
KEY_RFKILL
,
0
);
input_sync
(
input
);
return
1
;
}
static
int
ch_raw_event
(
struct
hid_device
*
hdev
,
struct
hid_report
*
report
,
u8
*
data
,
int
size
)
{
if
(
report
->
application
==
HID_GD_WIRELESS_RADIO_CTLS
)
return
ch_report_wireless
(
report
,
data
,
size
);
return
0
;
}
#define ch_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
EV_KEY, (c))
static
int
ch_input_mapping
(
struct
hid_device
*
hdev
,
struct
hid_input
*
hi
,
...
...
@@ -77,10 +110,30 @@ static __u8 *ch_switch12_report_fixup(struct hid_device *hdev, __u8 *rdesc,
return
rdesc
;
}
static
int
ch_probe
(
struct
hid_device
*
hdev
,
const
struct
hid_device_id
*
id
)
{
int
ret
;
hdev
->
quirks
|=
HID_QUIRK_INPUT_PER_APP
;
ret
=
hid_parse
(
hdev
);
if
(
ret
)
{
hid_err
(
hdev
,
"Chicony hid parse failed: %d
\n
"
,
ret
);
return
ret
;
}
ret
=
hid_hw_start
(
hdev
,
HID_CONNECT_DEFAULT
);
if
(
ret
)
{
hid_err
(
hdev
,
"Chicony hw start failed: %d
\n
"
,
ret
);
return
ret
;
}
return
0
;
}
static
const
struct
hid_device_id
ch_devices
[]
=
{
{
HID_USB_DEVICE
(
USB_VENDOR_ID_CHICONY
,
USB_DEVICE_ID_CHICONY_TACTICAL_PAD
)
},
{
HID_USB_DEVICE
(
USB_VENDOR_ID_CHICONY
,
USB_DEVICE_ID_CHICONY_WIRELESS2
)
},
{
HID_USB_DEVICE
(
USB_VENDOR_ID_CHICONY
,
USB_DEVICE_ID_CHICONY_WIRELESS3
)
},
{
HID_USB_DEVICE
(
USB_VENDOR_ID_CHICONY
,
USB_DEVICE_ID_CHICONY_ACER_SWITCH12
)
},
{
}
};
...
...
@@ -91,6 +144,8 @@ static struct hid_driver ch_driver = {
.
id_table
=
ch_devices
,
.
report_fixup
=
ch_switch12_report_fixup
,
.
input_mapping
=
ch_input_mapping
,
.
probe
=
ch_probe
,
.
raw_event
=
ch_raw_event
,
};
module_hid_driver
(
ch_driver
);
...
...
drivers/hid/hid-ids.h
View file @
fcd89e77
...
...
@@ -270,6 +270,7 @@
#define USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE 0x1053
#define USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE2 0x0939
#define USB_DEVICE_ID_CHICONY_WIRELESS2 0x1123
#define USB_DEVICE_ID_CHICONY_WIRELESS3 0x1236
#define USB_DEVICE_ID_ASUS_AK1D 0x1125
#define USB_DEVICE_ID_CHICONY_TOSHIBA_WT10A 0x1408
#define USB_DEVICE_ID_CHICONY_ACER_SWITCH12 0x1421
...
...
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