Skip to content

Commit 7908449

Browse files
author
Jiri Kosina
committed
Merge branches 'for-4.16/hid-quirks-cleanup/asus', 'for-4.16/hid-quirks-cleanup/elecom', 'for-4.16/hid-quirks-cleanup/ish', 'for-4.16/hid-quirks-cleanup/multitouch', 'for-4.16/hid-quirks-cleanup/pixart', 'for-4.16/hid-quirks-cleanup/rmi', 'for-4.16/hid-quirks-cleanup/sony' and 'for-4.16/hid-quirks-cleanup/toshiba' into for-linus
Pull assorted device driver fixes (ASUS, Elecom, Intel-ISH, Multitouch, PixArt, RMI, Sony and Toshiba) based on top the hid-quirks revamp.
9 parents a7acb31 + 33edee4 + ac58eec + 7103f6b + 0072027 + 01cffe9 + c529340 + 169f15a + edfc372 commit 7908449

File tree

12 files changed

+314
-63
lines changed

12 files changed

+314
-63
lines changed

Documentation/input/multi-touch-protocol.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,11 @@ ABS_MT_ORIENTATION
269269
The orientation of the touching ellipse. The value should describe a signed
270270
quarter of a revolution clockwise around the touch center. The signed value
271271
range is arbitrary, but zero should be returned for an ellipse aligned with
272-
the Y axis of the surface, a negative value when the ellipse is turned to
273-
the left, and a positive value when the ellipse is turned to the
274-
right. When completely aligned with the X axis, the range max should be
275-
returned.
272+
the Y axis (north) of the surface, a negative value when the ellipse is
273+
turned to the left, and a positive value when the ellipse is turned to the
274+
right. When aligned with the X axis in the positive direction, the range
275+
max should be returned; when aligned with the X axis in the negative
276+
direction, the range -max should be returned.
276277

277278
Touch ellipsis are symmetrical by default. For devices capable of true 360
278279
degree orientation, the reported orientation must exceed the range max to

drivers/hid/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ config HID_ELECOM
280280
---help---
281281
Support for ELECOM devices:
282282
- BM084 Bluetooth Mouse
283+
- EX-G Trackball (Wired and wireless)
283284
- DEFT Trackball (Wired and wireless)
284285
- HUGE Trackball (Wired and wireless)
285286

drivers/hid/hid-asus.c

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
* any later version.
2727
*/
2828

29+
#include <linux/dmi.h>
2930
#include <linux/hid.h>
3031
#include <linux/module.h>
3132
#include <linux/input/mt.h>
@@ -119,6 +120,24 @@ static const struct asus_touchpad_info asus_t100ta_tp = {
119120
.max_contacts = 5,
120121
};
121122

123+
static const struct asus_touchpad_info asus_t100ha_tp = {
124+
.max_x = 2640,
125+
.max_y = 1320,
126+
.res_x = 30, /* units/mm */
127+
.res_y = 29, /* units/mm */
128+
.contact_size = 5,
129+
.max_contacts = 5,
130+
};
131+
132+
static const struct asus_touchpad_info asus_t200ta_tp = {
133+
.max_x = 3120,
134+
.max_y = 1716,
135+
.res_x = 30, /* units/mm */
136+
.res_y = 28, /* units/mm */
137+
.contact_size = 5,
138+
.max_contacts = 5,
139+
};
140+
122141
static const struct asus_touchpad_info asus_t100chi_tp = {
123142
.max_x = 2640,
124143
.max_y = 1320,
@@ -606,7 +625,17 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
606625

607626
if (intf->altsetting->desc.bInterfaceNumber == T100_TPAD_INTF) {
608627
drvdata->quirks = QUIRK_SKIP_INPUT_MAPPING;
609-
drvdata->tp = &asus_t100ta_tp;
628+
/*
629+
* The T100HA uses the same USB-ids as the T100TAF and
630+
* the T200TA uses the same USB-ids as the T100TA, while
631+
* both have different max x/y values as the T100TA[F].
632+
*/
633+
if (dmi_match(DMI_PRODUCT_NAME, "T100HAN"))
634+
drvdata->tp = &asus_t100ha_tp;
635+
else if (dmi_match(DMI_PRODUCT_NAME, "T200TA"))
636+
drvdata->tp = &asus_t200ta_tp;
637+
else
638+
drvdata->tp = &asus_t100ta_tp;
610639
}
611640
}
612641

@@ -686,9 +715,10 @@ static __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc,
686715
hid_info(hdev, "Fixing up Asus notebook report descriptor\n");
687716
rdesc[55] = 0xdd;
688717
}
689-
/* For the T100TA keyboard dock */
718+
/* For the T100TA/T200TA keyboard dock */
690719
if (drvdata->quirks & QUIRK_T100_KEYBOARD &&
691-
*rsize == 76 && rdesc[73] == 0x81 && rdesc[74] == 0x01) {
720+
(*rsize == 76 || *rsize == 101) &&
721+
rdesc[73] == 0x81 && rdesc[74] == 0x01) {
692722
hid_info(hdev, "Fixing up Asus T100 keyb report descriptor\n");
693723
rdesc[74] &= ~HID_MAIN_ITEM_CONSTANT;
694724
}
@@ -751,7 +781,10 @@ static const struct hid_device_id asus_devices[] = {
751781
{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
752782
USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD3), QUIRK_G752_KEYBOARD },
753783
{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
754-
USB_DEVICE_ID_ASUSTEK_T100_KEYBOARD),
784+
USB_DEVICE_ID_ASUSTEK_T100TA_KEYBOARD),
785+
QUIRK_T100_KEYBOARD | QUIRK_NO_CONSUMER_USAGES },
786+
{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
787+
USB_DEVICE_ID_ASUSTEK_T100TAF_KEYBOARD),
755788
QUIRK_T100_KEYBOARD | QUIRK_NO_CONSUMER_USAGES },
756789
{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_ASUS_AK1D) },
757790
{ HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_ASUS_MD_5110) },

drivers/hid/hid-elecom.c

Lines changed: 42 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
/*
2-
* HID driver for ELECOM devices.
2+
* HID driver for ELECOM devices:
3+
* - BM084 Bluetooth Mouse
4+
* - EX-G Trackball (Wired and wireless)
5+
* - DEFT Trackball (Wired and wireless)
6+
* - HUGE Trackball (Wired and wireless)
7+
*
38
* Copyright (c) 2010 Richard Nauber <[email protected]>
49
* Copyright (c) 2016 Yuxuan Shui <[email protected]>
510
* Copyright (c) 2017 Diego Elio Pettenò <[email protected]>
611
* Copyright (c) 2017 Alex Manoussakis <[email protected]>
12+
* Copyright (c) 2017 Tomasz Kramkowski <[email protected]>
713
*/
814

915
/*
@@ -19,6 +25,34 @@
1925

2026
#include "hid-ids.h"
2127

28+
/*
29+
* Certain ELECOM mice misreport their button count meaning that they only work
30+
* correctly with the ELECOM mouse assistant software which is unavailable for
31+
* Linux. A four extra INPUT reports and a FEATURE report are described by the
32+
* report descriptor but it does not appear that these enable software to
33+
* control what the extra buttons map to. The only simple and straightforward
34+
* solution seems to involve fixing up the report descriptor.
35+
*
36+
* Report descriptor format:
37+
* Positions 13, 15, 21 and 31 store the button bit count, button usage minimum,
38+
* button usage maximum and padding bit count respectively.
39+
*/
40+
#define MOUSE_BUTTONS_MAX 8
41+
static void mouse_button_fixup(struct hid_device *hdev,
42+
__u8 *rdesc, unsigned int rsize,
43+
int nbuttons)
44+
{
45+
if (rsize < 32 || rdesc[12] != 0x95 ||
46+
rdesc[14] != 0x75 || rdesc[15] != 0x01 ||
47+
rdesc[20] != 0x29 || rdesc[30] != 0x75)
48+
return;
49+
hid_info(hdev, "Fixing up Elecom mouse button count\n");
50+
nbuttons = clamp(nbuttons, 0, MOUSE_BUTTONS_MAX);
51+
rdesc[13] = nbuttons;
52+
rdesc[21] = nbuttons;
53+
rdesc[31] = MOUSE_BUTTONS_MAX - nbuttons;
54+
}
55+
2256
static __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc,
2357
unsigned int *rsize)
2458
{
@@ -31,52 +65,24 @@ static __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc,
3165
rdesc[47] = 0x00;
3266
}
3367
break;
68+
case USB_DEVICE_ID_ELECOM_EX_G_WIRED:
69+
case USB_DEVICE_ID_ELECOM_EX_G_WIRELESS:
70+
mouse_button_fixup(hdev, rdesc, *rsize, 6);
71+
break;
3472
case USB_DEVICE_ID_ELECOM_DEFT_WIRED:
3573
case USB_DEVICE_ID_ELECOM_DEFT_WIRELESS:
3674
case USB_DEVICE_ID_ELECOM_HUGE_WIRED:
3775
case USB_DEVICE_ID_ELECOM_HUGE_WIRELESS:
38-
/* The DEFT/HUGE trackball has eight buttons, but its descriptor
39-
* only reports five, disabling the three Fn buttons on the top
40-
* of the mouse.
41-
*
42-
* Apply the following diff to the descriptor:
43-
*
44-
* Collection (Physical), Collection (Physical),
45-
* Report ID (1), Report ID (1),
46-
* Report Count (5), -> Report Count (8),
47-
* Report Size (1), Report Size (1),
48-
* Usage Page (Button), Usage Page (Button),
49-
* Usage Minimum (01h), Usage Minimum (01h),
50-
* Usage Maximum (05h), -> Usage Maximum (08h),
51-
* Logical Minimum (0), Logical Minimum (0),
52-
* Logical Maximum (1), Logical Maximum (1),
53-
* Input (Variable), Input (Variable),
54-
* Report Count (1), -> Report Count (0),
55-
* Report Size (3), Report Size (3),
56-
* Input (Constant), Input (Constant),
57-
* Report Size (16), Report Size (16),
58-
* Report Count (2), Report Count (2),
59-
* Usage Page (Desktop), Usage Page (Desktop),
60-
* Usage (X), Usage (X),
61-
* Usage (Y), Usage (Y),
62-
* Logical Minimum (-32768), Logical Minimum (-32768),
63-
* Logical Maximum (32767), Logical Maximum (32767),
64-
* Input (Variable, Relative), Input (Variable, Relative),
65-
* End Collection, End Collection,
66-
*/
67-
if (*rsize == 213 && rdesc[13] == 5 && rdesc[21] == 5) {
68-
hid_info(hdev, "Fixing up Elecom DEFT/HUGE Fn buttons\n");
69-
rdesc[13] = 8; /* Button/Variable Report Count */
70-
rdesc[21] = 8; /* Button/Variable Usage Maximum */
71-
rdesc[29] = 0; /* Button/Constant Report Count */
72-
}
76+
mouse_button_fixup(hdev, rdesc, *rsize, 8);
7377
break;
7478
}
7579
return rdesc;
7680
}
7781

7882
static const struct hid_device_id elecom_devices[] = {
7983
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) },
84+
{ HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_EX_G_WIRED) },
85+
{ HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_EX_G_WIRELESS) },
8086
{ HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_DEFT_WIRED) },
8187
{ HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_DEFT_WIRELESS) },
8288
{ HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_HUGE_WIRED) },

drivers/hid/hid-ids.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@
178178
#define USB_VENDOR_ID_ASUSTEK 0x0b05
179179
#define USB_DEVICE_ID_ASUSTEK_LCM 0x1726
180180
#define USB_DEVICE_ID_ASUSTEK_LCM2 0x175b
181-
#define USB_DEVICE_ID_ASUSTEK_T100_KEYBOARD 0x17e0
181+
#define USB_DEVICE_ID_ASUSTEK_T100TA_KEYBOARD 0x17e0
182+
#define USB_DEVICE_ID_ASUSTEK_T100TAF_KEYBOARD 0x1807
182183
#define USB_DEVICE_ID_ASUSTEK_T100CHI_KEYBOARD 0x8502
183184
#define USB_DEVICE_ID_ASUSTEK_T304_KEYBOARD 0x184a
184185
#define USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD 0x8585
@@ -370,6 +371,8 @@
370371

371372
#define USB_VENDOR_ID_ELECOM 0x056e
372373
#define USB_DEVICE_ID_ELECOM_BM084 0x0061
374+
#define USB_DEVICE_ID_ELECOM_EX_G_WIRED 0x00fb
375+
#define USB_DEVICE_ID_ELECOM_EX_G_WIRELESS 0x00fc
373376
#define USB_DEVICE_ID_ELECOM_DEFT_WIRED 0x00fe
374377
#define USB_DEVICE_ID_ELECOM_DEFT_WIRELESS 0x00ff
375378
#define USB_DEVICE_ID_ELECOM_HUGE_WIRED 0x010c
@@ -535,6 +538,7 @@
535538
#define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0A4A 0x0a4a
536539
#define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A 0x0b4a
537540
#define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE 0x134a
541+
#define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_094A 0x094a
538542

539543
#define USB_VENDOR_ID_HUION 0x256c
540544
#define USB_DEVICE_ID_HUION_TABLET 0x006e
@@ -1156,6 +1160,7 @@
11561160
#define USB_VENDOR_ID_PRIMAX 0x0461
11571161
#define USB_DEVICE_ID_PRIMAX_MOUSE_4D22 0x4d22
11581162
#define USB_DEVICE_ID_PRIMAX_KEYBOARD 0x4e05
1163+
#define USB_DEVICE_ID_PRIMAX_REZEL 0x4e72
11591164

11601165

11611166
#define USB_VENDOR_ID_RISO_KAGAKU 0x1294 /* Riso Kagaku Corp. */

0 commit comments

Comments
 (0)