Skip to content

Commit 38e50c9

Browse files
author
Jiri Kosina
committed
Merge branch 'for-4.14/multitouch' into for-linus
- support for media keys on Asus T304UA from João Paulo Rechi Vita - support for Microsoft Win8 Wireless Radio Controls extensions from João Paulo Rechi Vita Conflicts: drivers/hid/hid-ids.h Signed-off-by: Jiri Kosina <[email protected]>
2 parents d29ed11 + 39bbf40 commit 38e50c9

File tree

3 files changed

+50
-1
lines changed

3 files changed

+50
-1
lines changed

drivers/hid/hid-ids.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@
177177
#define USB_DEVICE_ID_ASUSTEK_LCM2 0x175b
178178
#define USB_DEVICE_ID_ASUSTEK_T100_KEYBOARD 0x17e0
179179
#define USB_DEVICE_ID_ASUSTEK_T100CHI_KEYBOARD 0x8502
180+
#define USB_DEVICE_ID_ASUSTEK_T304_KEYBOARD 0x184a
180181
#define USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD 0x8585
181182
#define USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD 0x0101
182183
#define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1 0x1854

drivers/hid/hid-multitouch.c

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ MODULE_LICENSE("GPL");
7272
#define MT_QUIRK_FIX_CONST_CONTACT_ID BIT(14)
7373
#define MT_QUIRK_TOUCH_SIZE_SCALING BIT(15)
7474
#define MT_QUIRK_STICKY_FINGERS BIT(16)
75+
#define MT_QUIRK_ASUS_CUSTOM_UP BIT(17)
7576

7677
#define MT_INPUTMODE_TOUCHSCREEN 0x02
7778
#define MT_INPUTMODE_TOUCHPAD 0x03
@@ -169,6 +170,7 @@ static void mt_post_parse(struct mt_device *td);
169170
#define MT_CLS_GENERALTOUCH_TWOFINGERS 0x0108
170171
#define MT_CLS_GENERALTOUCH_PWT_TENFINGERS 0x0109
171172
#define MT_CLS_LG 0x010a
173+
#define MT_CLS_ASUS 0x010b
172174
#define MT_CLS_VTL 0x0110
173175
#define MT_CLS_GOOGLE 0x0111
174176

@@ -290,6 +292,10 @@ static struct mt_class mt_classes[] = {
290292
MT_QUIRK_IGNORE_DUPLICATES |
291293
MT_QUIRK_HOVERING |
292294
MT_QUIRK_CONTACT_CNT_ACCURATE },
295+
{ .name = MT_CLS_ASUS,
296+
.quirks = MT_QUIRK_ALWAYS_VALID |
297+
MT_QUIRK_CONTACT_CNT_ACCURATE |
298+
MT_QUIRK_ASUS_CUSTOM_UP },
293299
{ .name = MT_CLS_VTL,
294300
.quirks = MT_QUIRK_ALWAYS_VALID |
295301
MT_QUIRK_CONTACT_CNT_ACCURATE |
@@ -905,6 +911,8 @@ static int mt_touch_input_configured(struct hid_device *hdev,
905911
return 0;
906912
}
907913

914+
#define mt_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, \
915+
max, EV_KEY, (c))
908916
static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
909917
struct hid_field *field, struct hid_usage *usage,
910918
unsigned long **bit, int *max)
@@ -922,9 +930,35 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
922930
field->application != HID_DG_PEN &&
923931
field->application != HID_DG_TOUCHPAD &&
924932
field->application != HID_GD_KEYBOARD &&
925-
field->application != HID_CP_CONSUMER_CONTROL)
933+
field->application != HID_CP_CONSUMER_CONTROL &&
934+
field->application != HID_GD_WIRELESS_RADIO_CTLS &&
935+
!(field->application == HID_VD_ASUS_CUSTOM_MEDIA_KEYS &&
936+
td->mtclass.quirks & MT_QUIRK_ASUS_CUSTOM_UP))
926937
return -1;
927938

939+
/*
940+
* Some Asus keyboard+touchpad devices have the hotkeys defined in the
941+
* touchpad report descriptor. We need to treat these as an array to
942+
* map usages to input keys.
943+
*/
944+
if (field->application == HID_VD_ASUS_CUSTOM_MEDIA_KEYS &&
945+
td->mtclass.quirks & MT_QUIRK_ASUS_CUSTOM_UP &&
946+
(usage->hid & HID_USAGE_PAGE) == HID_UP_CUSTOM) {
947+
set_bit(EV_REP, hi->input->evbit);
948+
if (field->flags & HID_MAIN_ITEM_VARIABLE)
949+
field->flags &= ~HID_MAIN_ITEM_VARIABLE;
950+
switch (usage->hid & HID_USAGE) {
951+
case 0x10: mt_map_key_clear(KEY_BRIGHTNESSDOWN); break;
952+
case 0x20: mt_map_key_clear(KEY_BRIGHTNESSUP); break;
953+
case 0x35: mt_map_key_clear(KEY_DISPLAY_OFF); break;
954+
case 0x6b: mt_map_key_clear(KEY_F21); break;
955+
case 0x6c: mt_map_key_clear(KEY_SLEEP); break;
956+
default:
957+
return -1;
958+
}
959+
return 1;
960+
}
961+
928962
/*
929963
* some egalax touchscreens have "application == HID_DG_TOUCHSCREEN"
930964
* for the stylus.
@@ -1133,6 +1167,12 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
11331167
case HID_CP_CONSUMER_CONTROL:
11341168
suffix = "Consumer Control";
11351169
break;
1170+
case HID_GD_WIRELESS_RADIO_CTLS:
1171+
suffix = "Wireless Radio Control";
1172+
break;
1173+
case HID_VD_ASUS_CUSTOM_MEDIA_KEYS:
1174+
suffix = "Custom Media Keys";
1175+
break;
11361176
default:
11371177
suffix = "UNKNOWN";
11381178
break;
@@ -1384,6 +1424,12 @@ static const struct hid_device_id mt_devices[] = {
13841424
MT_USB_DEVICE(USB_VENDOR_ID_ANTON,
13851425
USB_DEVICE_ID_ANTON_TOUCH_PAD) },
13861426

1427+
/* Asus T304UA */
1428+
{ .driver_data = MT_CLS_ASUS,
1429+
HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH_WIN_8,
1430+
USB_VENDOR_ID_ASUSTEK,
1431+
USB_DEVICE_ID_ASUSTEK_T304_KEYBOARD) },
1432+
13871433
/* Atmel panels */
13881434
{ .driver_data = MT_CLS_SERIAL,
13891435
MT_USB_DEVICE(USB_VENDOR_ID_ATMEL,

include/linux/hid.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ struct hid_item {
173173
#define HID_UP_LOGIVENDOR3 0xff430000
174174
#define HID_UP_LNVENDOR 0xffa00000
175175
#define HID_UP_SENSOR 0x00200000
176+
#define HID_UP_ASUSVENDOR 0xff310000
176177

177178
#define HID_USAGE 0x0000ffff
178179

@@ -292,6 +293,7 @@ struct hid_item {
292293
#define HID_DG_BARRELSWITCH2 0x000d005a
293294
#define HID_DG_TOOLSERIALNUMBER 0x000d005b
294295

296+
#define HID_VD_ASUS_CUSTOM_MEDIA_KEYS 0xff310076
295297
/*
296298
* HID report types --- Ouch! HID spec says 1 2 3!
297299
*/

0 commit comments

Comments
 (0)