Skip to content

Commit da10bc2

Browse files
mmagnaudetJiri Kosina
authored andcommitted
HID: multitouch: Add quirk for VTL touch panels
VTL panels do not switch to the multitouch mode until the input mode feature is read by the host. This should normally be done by usbhid, but it looks like an other bug prevents usbhid to properly retrieve the feature state. As a workaround, we force the reading of the feature in mt_set_input_mode for such devices. Reviewed-by: Benjamin Tissoires <[email protected]> Signed-off-by: Mathieu Magnaudet <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 6b07974 commit da10bc2

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

drivers/hid/hid-ids.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,9 @@
931931
#define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004
932932
#define USB_DEVICE_ID_VERNIER_LCSPEC 0x0006
933933

934+
#define USB_VENDOR_ID_VTL 0x0306
935+
#define USB_DEVICE_ID_VTL_MULTITOUCH_FF3F 0xff3f
936+
934937
#define USB_VENDOR_ID_WACOM 0x056a
935938
#define USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH 0x81
936939
#define USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH 0x00BD

drivers/hid/hid-multitouch.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ MODULE_LICENSE("GPL");
6767
#define MT_QUIRK_IGNORE_DUPLICATES (1 << 10)
6868
#define MT_QUIRK_HOVERING (1 << 11)
6969
#define MT_QUIRK_CONTACT_CNT_ACCURATE (1 << 12)
70+
#define MT_QUIRK_FORCE_GET_FEATURE (1 << 13)
7071

7172
#define MT_INPUTMODE_TOUCHSCREEN 0x02
7273
#define MT_INPUTMODE_TOUCHPAD 0x03
@@ -150,6 +151,7 @@ static void mt_post_parse(struct mt_device *td);
150151
#define MT_CLS_FLATFROG 0x0107
151152
#define MT_CLS_GENERALTOUCH_TWOFINGERS 0x0108
152153
#define MT_CLS_GENERALTOUCH_PWT_TENFINGERS 0x0109
154+
#define MT_CLS_VTL 0x0110
153155

154156
#define MT_DEFAULT_MAXCONTACT 10
155157
#define MT_MAX_MAXCONTACT 250
@@ -255,6 +257,11 @@ static struct mt_class mt_classes[] = {
255257
.sn_move = 2048,
256258
.maxcontacts = 40,
257259
},
260+
{ .name = MT_CLS_VTL,
261+
.quirks = MT_QUIRK_ALWAYS_VALID |
262+
MT_QUIRK_CONTACT_CNT_ACCURATE |
263+
MT_QUIRK_FORCE_GET_FEATURE,
264+
},
258265
{ }
259266
};
260267

@@ -809,13 +816,28 @@ static void mt_set_input_mode(struct hid_device *hdev)
809816
struct mt_device *td = hid_get_drvdata(hdev);
810817
struct hid_report *r;
811818
struct hid_report_enum *re;
819+
struct mt_class *cls = &td->mtclass;
820+
char *buf;
821+
int report_len;
812822

813823
if (td->inputmode < 0)
814824
return;
815825

816826
re = &(hdev->report_enum[HID_FEATURE_REPORT]);
817827
r = re->report_id_hash[td->inputmode];
818828
if (r) {
829+
if (cls->quirks & MT_QUIRK_FORCE_GET_FEATURE) {
830+
report_len = ((r->size - 1) >> 3) + 1 + (r->id > 0);
831+
buf = hid_alloc_report_buf(r, GFP_KERNEL);
832+
if (!buf) {
833+
hid_err(hdev, "failed to allocate buffer for report\n");
834+
return;
835+
}
836+
hid_hw_raw_request(hdev, r->id, buf, report_len,
837+
HID_FEATURE_REPORT,
838+
HID_REQ_GET_REPORT);
839+
kfree(buf);
840+
}
819841
r->field[0]->value[td->inputmode_index] = td->inputmode_value;
820842
hid_hw_request(hdev, r, HID_REQ_SET_REPORT);
821843
}
@@ -1281,6 +1303,11 @@ static const struct hid_device_id mt_devices[] = {
12811303
MT_USB_DEVICE(USB_VENDOR_ID_UNITEC,
12821304
USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) },
12831305

1306+
/* VTL panels */
1307+
{ .driver_data = MT_CLS_VTL,
1308+
MT_USB_DEVICE(USB_VENDOR_ID_VTL,
1309+
USB_DEVICE_ID_VTL_MULTITOUCH_FF3F) },
1310+
12841311
/* Wistron panels */
12851312
{ .driver_data = MT_CLS_NSMU,
12861313
MT_USB_DEVICE(USB_VENDOR_ID_WISTRON,

0 commit comments

Comments
 (0)