Support of Nexio 42" and new default class for hid-multitouch
cover Support of Nexio 42" and new default class for hid-multitouch
Hi guys,
finally, I managed to send a new bunch of patches. Sorry for the delay from the previous version, but meanwhile, I implemented an automatic regressions tests for hid device [1].
So this series seems pretty big, but it does not break any known devices (I ran 40 successful tests for this series)[2].
To sum up:
- Nexio devices were problematic in the sense they use out of range values for some of the fields, and consider that the driver won't treat the extra touches based on the reported contact count.
- fortunately, this behavior (relying on contact count) is compatible with all the devices I know, which leads to think that this is how the Windows 7/8 driver manage to handle such a different bunch of devices.
- thanks to the automatic testing, I was able to fix broken devices (Sharp LC-20FE1-W screen 04dd:9681, Sitronix 1403:5001 and Cando 2087:0a02) and optimize many others. In order to allow a bisection to be done, I split the patches in many different ones, one per device type.
- finally, I changed the default class in order to handle the new devices in a better way.
Cheers,
Benjamin
[1] https://github.com/bentiss/hid-test
[2] https://github.com/bentiss/hid-devices
Benjamin Tissoires (25):
HID: break out hid_extract_field
HID: multitouch: add support for Nexio 42" panel
HID: multitouch: fix Win8 protocol for Sharp like devices
HID: multitouch: ensure that serial devices make no use of contact count
HID: multitouch: fix protocol for Sitronix 1403:5001
HID: multitouch: optimize FlatFrog panels
HID: multitouch: optimize 3M panels
HID: multitouch: optimize Cypress panels
HID: multitouch: optimize eGalax panels
HID: multitouch: optimize Stantum panels
HID: multitouch: optimize Quanta panels
HID: multitouch: optimize Lumio panels
HID: multitouch: optimize MosArt panels
HID: multitouch: optimize Elo panels
HID: multitouch: optimize Hanvon panels
HID: multitouch: optimize IRTouch panels
HID: multitouch: fix protocol for Cando 2087:0a02
HID: multitouch: optimize Cando panels
HID: multitouch: optimize ActionStar panels
HID: multitouch: optimize Atmel panels
HID: multitouch: optimize Ideacom panels
HID: multitouch: optimize LG panels
HID: multitouch: optimize Nexio panels
HID: multitouch: remove useless DUAL_NSMU_CONTACTID class
HID: multitouch: make MT_CLS_ALWAYS_TRUE the new default class
drivers/hid/hid-core.c | 60 +++++++++---- drivers/hid/hid-ids.h | 3 + drivers/hid/hid-multitouch.c | 206 ++++++++++++++++++++++++++++++------------- include/linux/hid.h | 1 + 4 files changed, 189 insertions(+), 81 deletions(-)
Signature · 1 line
1.8.1
PATCH 1/25 HID: break out hid_extract_field
Breaking out this function allows third parties hid drivers to retrieve the data fields of a hid report in the raw_event callback.
No functional changes, only exports the function.
--- drivers/hid/hid-core.c | 60 ++++++++++++++++++++++++++++++++++---------------- include/linux/hid.h | 1 + 2 files changed, 42 insertions(+), 19 deletions(-)
drivers/hid/hid-core.c +41 -19
@@ -962,6 +962,45 @@ static void implement(const struct hid_device *hid, __u8 *report, }/* +* Extract and allocate a data field from a little endian report (bit array). +*/ + +s32 *hid_extract_field (const struct hid_device *hid,struct hid_field *field, +__u8 *data) +{ +unsigned n; +unsigned count = field->report_count; +unsigned offset = field->report_offset; +unsigned size = field->report_size; +__s32 min = field->logical_minimum; +__s32 max = field->logical_maximum; +__s32 *value; + + value =kmalloc (sizeof (__s32) * count,GFP_ATOMIC ); +if (!value) +return value; + +for (n =0 ; n < count; n++) { + + value[n] = min <0 ? +snto32 (extract (hid, data, offset + n * size, size), + size) : +extract (hid, data, offset + n * size, size); + +/* Ignore report if ErrorRollOver */ +if (!(field->flags &HID_MAIN_ITEM_VARIABLE ) && + value[n] >= min && value[n] <= max && + field->usage[value[n] - min].hid ==HID_UP_KEYBOARD +1 ) { +kfree (value); +return NULL ; + } + } + +return value; +} +EXPORT_SYMBOL_GPL (hid_extract_field); + +/* * Search an array for a value. */
@@ -1059,32 +1098,15 @@ static void hid_input_field(struct hid_device *hid, struct hid_field *field, {unsigned n;unsigned count = field->report_count; -unsigned offset = field->report_offset; -unsigned size = field->report_size;__s32 min = field->logical_minimum;__s32 max = field->logical_maximum; -__s32 *value; +__s32 *value =hid_extract_field (hid, field, data); - value =kmalloc (sizeof (__s32) * count,GFP_ATOMIC );if (!value)return ;for (n =0 ; n < count; n++) { - value[n] = min <0 ? -snto32 (extract (hid, data, offset + n * size, size), - size) : -extract (hid, data, offset + n * size, size); - -/* Ignore report if ErrorRollOver */ -if (!(field->flags &HID_MAIN_ITEM_VARIABLE ) && - value[n] >= min && value[n] <= max && - field->usage[value[n] - min].hid ==HID_UP_KEYBOARD +1 ) - goto exit; - } - -for (n =0 ; n < count; n++) { -if (HID_MAIN_ITEM_VARIABLE & field->flags) {hid_process_event (hid, field, &field->usage[n], value[n], interrupt);continue ;
@@ -1102,7 +1124,7 @@ static void hid_input_field(struct hid_device *hid, struct hid_field *field, }memcpy (field->value, value, count *sizeof (__s32)); -exit: +kfree (value); }
include/linux/hid.h +1 -0
@@ -718,6 +718,7 @@ extern int hidinput_connect(struct hid_device *hid, unsigned int force);extern void hidinput_disconnect (struct hid_device *);int hid_set_field (struct hid_field *,unsigned ,__s32 ); +s32 *hid_extract_field (const struct hid_device *,struct hid_field *,__u8 *);int hid_input_report (struct hid_device *,int type,u8 *,int ,int );int hidinput_find_field (struct hid_device *hid,unsigned int type,unsigned int code,struct hid_field **field);struct hid_field *hidinput_get_led_field (struct hid_device *hid);
Signature · 1 line
1.8.1
Re: [PATCH 01/25] HID: break out hid_extract_field
Hi Benjamin,
Quoted 47 lines
Breaking out this function allows third parties hid drivers to retrieve the data fields of a hid report in the
raw_eventcallback.No functional changes, only exports the function.
Signed-off-by Benjamin Tissoires <[email protected]>--- drivers/hid/hid-core.c | 60 ++++++++++++++++++++++++++++++++++---------------- include/linux/hid.h | 1 + 2 files changed, 42 insertions(+), 19 deletions(-)drivers/hid/hid-core.c +28
-0@@ -962,6 +962,45 @@ static void implement(const struct hid_device *hid, __u8 *report, }/* +* Extract and allocate a data field from a little endian report (bit array). +*/ + +s32 *hid_extract_field (const struct hid_device *hid,struct hid_field *field, +__u8 *data) +{ +unsigned n; +unsigned count = field->report_count; +unsigned offset = field->report_offset; +unsigned size = field->report_size; +__s32 min = field->logical_minimum; +__s32 max = field->logical_maximum; +__s32 *value; + + value =kmalloc (sizeof (__s32) * count,GFP_ATOMIC ); +if (!value) +return value; + +for (n =0 ; n < count; n++) { + + value[n] = min <0 ? +snto32 (extract (hid, data, offset + n * size, size), + size) : +extract (hid, data, offset + n * size, size); + +/* Ignore report if ErrorRollOver */ + if (!(field->flags & HID_MAIN_ITEM_VARIABLE) && + value[n] >= min && value[n] <= max &&
drivers/hid/hid-core.c static void implement(const struct hid_device *hid, __u8 *report, · line 1002
Quoted 10 lines
drivers/hid/hid-core.c +10
-0+ field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1) { +kfree (value); +return NULL ; + } + } + +return value; +} +EXPORT_SYMBOL_GPL (hid_extract_field); +
I would rather see the extensive use of malloc go away than extend its usage to drivers.
Thanks,
Henrik
PATCH 2/25 HID: multitouch: add support for Nexio 42" panel
In reply to Benjamin TissoiresThis device is the worst device I saw. It keeps TipSwitch and InRange at 1 for fingers that are not touching the panel.
The solution is to rely on the field ContactCount, which is accurate as the correct information are packed at the begining of the frame.
Unfortunately, CountactCount is most of the time at the end of the report. The solution is to pick it when we have the whole report in raw_event.
--- drivers/hid/hid-ids.h | 3 ++ drivers/hid/hid-multitouch.c | 91 ++++++++++++++++++++++++++++++++++++-------- 2 files changed, 78 insertions(+), 16 deletions(-)
drivers/hid/hid-ids.h +3 -0
@@ -597,6 +597,9 @@#define USB_VENDOR_ID_NEC 0x073e#define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301 +#define USB_VENDOR_ID_NEXIO 0x1870 +#define USB_DEVICE_ID_NEXIO_MULTITOUCH_420 0x010d +#define USB_VENDOR_ID_NEXTWINDOW 0x1926#define USB_DEVICE_ID_NEXTWINDOW_TOUCHSCREEN 0x0003
drivers/hid/hid-multitouch.c +75 -16
188 lines not on this page · raw message
Signature · 1 line
1.8.1
Re: [PATCH 02/25] HID: multitouch: add support for Nexio 42" panel
Hi Benjamin,
Quoted 5 lines
This device is the worst device I saw. It keeps TipSwitch and InRange at 1 for fingers that are not touching the panel.
The solution is to rely on the field ContactCount, which is accurate as the correct information are packed at the begining of the frame.
Quoted 8 lines
Unfortunately, CountactCount is most of the time at the end of the report. The solution is to pick it when we have the whole report in
raw_event.Signed-off-by Benjamin Tissoires <[email protected]>--- drivers/hid/hid-ids.h | 3 ++ drivers/hid/hid-multitouch.c | 91 ++++++++++++++++++++++++++++++++++++-------- 2 files changed, 78 insertions(+), 16 deletions(-)
I think it would make more sense to introduce a method where the driver sees all report values at once. We have had reasonable cause to add it in the past, but never did.
Quoted 171 lines
drivers/hid/hid-ids.h +3
-0@@ -597,6 +597,9 @@#define USB_VENDOR_ID_NEC 0x073e#define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301 +#define USB_VENDOR_ID_NEXIO 0x1870 +#define USB_DEVICE_ID_NEXIO_MULTITOUCH_420 0x010d +#define USB_VENDOR_ID_NEXTWINDOW 0x1926#define USB_DEVICE_ID_NEXTWINDOW_TOUCHSCREEN 0x0003drivers/hid/hid-multitouch.c +54
-16@@ -32,6 +32,8 @@#include <linux/slab.h> #include <linux/usb.h> #include <linux/input/mt.h> +#include <asm/unaligned.h> +#include <asm/byteorder.h> #include "usbhid/usbhid.h" @@ -54,6 +56,7 @@ MODULE_LICENSE("GPL");#define MT_QUIRK_NO_AREA (1 << 9)#define MT_QUIRK_IGNORE_DUPLICATES (1 << 10)#define MT_QUIRK_HOVERING (1 << 11) +#define MT_QUIRK_CONTACT_CNT_ACCURATE (1 << 12)struct mt_slot {__s32 x, y, cx, cy, p, w, h;@@ -83,6 +86,10 @@ struct mt_device {struct mt_class mtclass;/* our mt device class */ struct mt_fields *fields;/* temporary placeholder for storing the multitouch fields */ +struct hid_field *contactcount;/* the hid_field contact count that +will be picked in mt_raw_event */ +__s8 contactcount_index;/* the index of the usage contact count +in its hid_field. */ unsigned last_field_index;/* last field index of the report */ unsigned last_slot_field;/* the last field of a slot */ __s8 inputmode;/* InputMode HID feature, -1 if non-existent */ @@ -111,6 +118,7 @@ struct mt_device {#define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 0x0007#define MT_CLS_DUAL_NSMU_CONTACTID 0x0008#define MT_CLS_INRANGE_CONTACTNUMBER 0x0009 +#define MT_CLS_ALWAYS_TRUE 0x000a/* vendor specific classes */ #define MT_CLS_3M 0x0101@@ -170,6 +178,9 @@ static struct mt_class mt_classes[] = { { .name = MT_CLS_INRANGE_CONTACTNUMBER, .quirks =MT_QUIRK_VALID_IS_INRANGE | MT_QUIRK_SLOT_IS_CONTACTNUMBER }, + { .name = MT_CLS_ALWAYS_TRUE, + .quirks =MT_QUIRK_ALWAYS_VALID | + MT_QUIRK_CONTACT_CNT_ACCURATE },/* * vendor specific classes @@ -250,6 +261,9 @@ static ssize_t mt_set_quirks(struct device *dev, td->mtclass.quirks = val; +if (!td->contactcount) + td->mtclass.quirks &= ~MT_QUIRK_CONTACT_CNT_ACCURATE ; +return count; }@@ -264,24 +278,26 @@ static struct attribute_group mt_attribute_group = { .attrs = sysfs_attrs }; +static int mt_find_usage_index (struct hid_field *field,struct hid_usage *usage) +{ +int i; +for (i =0 ; i < field->maxusage; i++) { +if (field->usage[i].hid == usage->hid) +return i; + } +return -1 ; +} +static void mt_feature_mapping (struct hid_device *hdev,struct hid_field *field,struct hid_usage *usage) {struct mt_device *td =hid_get_drvdata (hdev); -int i;switch (usage->hid) {case HID_DG_INPUTMODE : td->inputmode = field->report->id; - td->inputmode_index =0 ;/* has to be updated below */ - -for (i=0 ; i < field->maxusage; i++) { -if (field->usage[i].hid == usage->hid) { - td->inputmode_index = i; -break ; - } - } - + td->inputmode_index =mt_find_usage_index (field, usage); +/* inputmode_index can't be set at -1 */ break ;case HID_DG_CONTACTMAX : td->maxcontact_report_id = field->report->id;@@ -459,6 +475,10 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, td->last_field_index = field->index;return 1 ;case HID_DG_CONTACTCOUNT : + td->contactcount = field; + td->contactcount_index =mt_find_usage_index (field, + usage); +/* contactcount_index can't be set at -1 */ td->last_field_index = field->index;return 1 ;case HID_DG_CONTACTMAX :@@ -523,6 +543,10 @@ static int mt_compute_slot(struct mt_device *td, struct input_dev *input)*/ static void mt_complete_slot (struct mt_device *td,struct input_dev *input) { +if ((td->mtclass.quirks &MT_QUIRK_CONTACT_CNT_ACCURATE ) && + td->num_received >= td->num_expected) +return ; +if (td->curvalid || (td->mtclass.quirks &MT_QUIRK_ALWAYS_VALID )) {int slotnum =mt_compute_slot (td, input);struct mt_slot *s = &td->curdata;@@ -623,12 +647,6 @@ static int mt_event(struct hid_device *hid, struct hid_field *field, td->curdata.h = value;break ;case HID_DG_CONTACTCOUNT : -/* -* Includes multi-packet support where subsequent -* packets are sent with zero contactcount. -*/ -if (value) - td->num_expected = value;break ;case HID_DG_TOUCH :/* do nothing */ @@ -658,6 +676,37 @@ static int mt_event(struct hid_device *hid, struct hid_field *field,return 1 ; } +static int mt_raw_event (struct hid_device *hid,struct hid_report *report, +u8 *data,int size) +{ +struct mt_device *td =hid_get_drvdata (hid); +struct hid_field *field = td->contactcount; +s32 *value; + +if (field && report->id == field->report->id) { +/* +* Pick in advance the field HID_DG_CONTACTCOUNT as it is +* often placed at the end of the report. +*/ +if (report->id) + data++; + + value =hid_extract_field (hid, field, data); +if (!value) +return 0 ; + +/*
drivers/hid/hid-multitouch.c static int mt_event(struct hid_device *hid, struct hid_field *field, · line 708
Quoted 10 lines
drivers/hid/hid-multitouch.c +10
-0+* Includes multi-packet support where subsequent +* packets are sent with zero contactcount. +*/ +if (value[td->contactcount_index]) + td->num_expected = value[td->contactcount_index]; + +kfree (value); + } +return 0 ; +}
This is a lot of cycles for something that is already available in the core.
Quoted 33 lines
drivers/hid/hid-multitouch.c +10
-0+static void mt_set_input_mode (struct hid_device *hdev) {struct mt_device *td =hid_get_drvdata (hdev);@@ -719,11 +768,15 @@ static void mt_post_parse_default_settings(struct mt_device *td)static void mt_post_parse (struct mt_device *td) {struct mt_fields *f = td->fields; +struct mt_class *cls = &td->mtclass;if (td->touches_by_report >0 ) {int field_count_per_touch = f->length / td->touches_by_report; td->last_slot_field = f->usages[field_count_per_touch -1 ]; } + +if (!td->contactcount) + cls->quirks &= ~MT_QUIRK_CONTACT_CNT_ACCURATE ; }static void mt_input_configured (struct hid_device *hdev,struct hid_input *hi)@@ -1056,6 +1109,11 @@ static const struct hid_device_id mt_devices[] = { MT_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) }, +/* Nexio panels */ + { .driver_data = MT_CLS_ALWAYS_TRUE, +MT_USB_DEVICE (USB_VENDOR_ID_NEXIO , + USB_DEVICE_ID_NEXIO_MULTITOUCH_420)}, + /* Panasonic panels */ { .driver_data = MT_CLS_PANASONIC, MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC,
drivers/hid/hid-multitouch.c static struct hid_driver mt_driver = { · line 1254
Quoted 4 lines
drivers/hid/hid-multitouch.c +1
-0@@ -1193,6 +1251,7 @@ static struct hid_driver mt_driver = { .feature_mapping = mt_feature_mapping, .usage_table = mt_grabbed_usages, .event = mt_event, + .raw_event = mt_raw_event,
Rather a new and simpler event method here, in other words.
Quoted 6 lines
drivers/hid/hid-multitouch.c +0
-0#ifdef CONFIG_PM .reset_resume = mt_reset_resume, .resume = mt_resume,Signature · 1 line
1.8.1
Thanks,
Henrik
Re: [PATCH 02/25] HID: multitouch: add support for Nexio 42" panel
Quoted 16 lines · Henrik Rydberg
Hi Benjamin,
Quoted 5 lines
This device is the worst device I saw. It keeps TipSwitch and InRange at 1 for fingers that are not touching the panel.
The solution is to rely on the field ContactCount, which is accurate as the correct information are packed at the begining of the frame.Quoted 8 lines
Unfortunately, CountactCount is most of the time at the end of the report. The solution is to pick it when we have the whole report in
raw_event.Signed-off-by Benjamin Tissoires <[email protected]>--- drivers/hid/hid-ids.h | 3 ++ drivers/hid/hid-multitouch.c | 91 ++++++++++++++++++++++++++++++++++++-------- 2 files changed, 78 insertions(+), 16 deletions(-)
Quoted 3 lines
I think it would make more sense to introduce a method where the driver sees all report values at once. We have had reasonable cause to add it in the past, but never did.
I will definitively look into it. It seems a fair idea.
Quoted 176 lines
Quoted 176 lines
drivers/hid/hid-ids.h +3
-0@@ -597,6 +597,9 @@#define USB_VENDOR_ID_NEC 0x073e#define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301 +#define USB_VENDOR_ID_NEXIO 0x1870 +#define USB_DEVICE_ID_NEXIO_MULTITOUCH_420 0x010d +#define USB_VENDOR_ID_NEXTWINDOW 0x1926#define USB_DEVICE_ID_NEXTWINDOW_TOUCHSCREEN 0x0003drivers/hid/hid-multitouch.c +58
-16@@ -32,6 +32,8 @@#include <linux/slab.h> #include <linux/usb.h> #include <linux/input/mt.h> +#include <asm/unaligned.h> +#include <asm/byteorder.h> #include "usbhid/usbhid.h" @@ -54,6 +56,7 @@ MODULE_LICENSE("GPL");#define MT_QUIRK_NO_AREA (1 << 9)#define MT_QUIRK_IGNORE_DUPLICATES (1 << 10)#define MT_QUIRK_HOVERING (1 << 11) +#define MT_QUIRK_CONTACT_CNT_ACCURATE (1 << 12)struct mt_slot {__s32 x, y, cx, cy, p, w, h;@@ -83,6 +86,10 @@ struct mt_device {struct mt_class mtclass;/* our mt device class */ struct mt_fields *fields;/* temporary placeholder for storing the multitouch fields */ +struct hid_field *contactcount;/* the hid_field contact count that +will be picked in mt_raw_event */ +__s8 contactcount_index;/* the index of the usage contact count +in its hid_field. */ unsigned last_field_index;/* last field index of the report */ unsigned last_slot_field;/* the last field of a slot */ __s8 inputmode;/* InputMode HID feature, -1 if non-existent */ @@ -111,6 +118,7 @@ struct mt_device {#define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 0x0007#define MT_CLS_DUAL_NSMU_CONTACTID 0x0008#define MT_CLS_INRANGE_CONTACTNUMBER 0x0009 +#define MT_CLS_ALWAYS_TRUE 0x000a/* vendor specific classes */ #define MT_CLS_3M 0x0101@@ -170,6 +178,9 @@ static struct mt_class mt_classes[] = { { .name = MT_CLS_INRANGE_CONTACTNUMBER, .quirks =MT_QUIRK_VALID_IS_INRANGE | MT_QUIRK_SLOT_IS_CONTACTNUMBER }, + { .name = MT_CLS_ALWAYS_TRUE, + .quirks =MT_QUIRK_ALWAYS_VALID | + MT_QUIRK_CONTACT_CNT_ACCURATE },/* * vendor specific classes @@ -250,6 +261,9 @@ static ssize_t mt_set_quirks(struct device *dev, td->mtclass.quirks = val; +if (!td->contactcount) + td->mtclass.quirks &= ~MT_QUIRK_CONTACT_CNT_ACCURATE ; +return count; }@@ -264,24 +278,26 @@ static struct attribute_group mt_attribute_group = { .attrs = sysfs_attrs }; +static int mt_find_usage_index (struct hid_field *field,struct hid_usage *usage) +{ +int i; +for (i =0 ; i < field->maxusage; i++) { +if (field->usage[i].hid == usage->hid) +return i; + } +return -1 ; +} +static void mt_feature_mapping (struct hid_device *hdev,struct hid_field *field,struct hid_usage *usage) {struct mt_device *td =hid_get_drvdata (hdev); -int i;switch (usage->hid) {case HID_DG_INPUTMODE : td->inputmode = field->report->id; - td->inputmode_index =0 ;/* has to be updated below */ - -for (i=0 ; i < field->maxusage; i++) { -if (field->usage[i].hid == usage->hid) { - td->inputmode_index = i; -break ; - } - } - + td->inputmode_index =mt_find_usage_index (field, usage); +/* inputmode_index can't be set at -1 */ break ;case HID_DG_CONTACTMAX : td->maxcontact_report_id = field->report->id;@@ -459,6 +475,10 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, td->last_field_index = field->index;return 1 ;case HID_DG_CONTACTCOUNT : + td->contactcount = field; + td->contactcount_index =mt_find_usage_index (field, + usage); +/* contactcount_index can't be set at -1 */ td->last_field_index = field->index;return 1 ;case HID_DG_CONTACTMAX :@@ -523,6 +543,10 @@ static int mt_compute_slot(struct mt_device *td, struct input_dev *input)*/ static void mt_complete_slot (struct mt_device *td,struct input_dev *input) { +if ((td->mtclass.quirks &MT_QUIRK_CONTACT_CNT_ACCURATE ) && + td->num_received >= td->num_expected) +return ; +if (td->curvalid || (td->mtclass.quirks &MT_QUIRK_ALWAYS_VALID )) {int slotnum =mt_compute_slot (td, input);struct mt_slot *s = &td->curdata;@@ -623,12 +647,6 @@ static int mt_event(struct hid_device *hid, struct hid_field *field, td->curdata.h = value;break ;case HID_DG_CONTACTCOUNT : -/* -* Includes multi-packet support where subsequent -* packets are sent with zero contactcount. -*/ -if (value) - td->num_expected = value;break ;case HID_DG_TOUCH :/* do nothing */ @@ -658,6 +676,37 @@ static int mt_event(struct hid_device *hid, struct hid_field *field,return 1 ; } +static int mt_raw_event (struct hid_device *hid,struct hid_report *report, +u8 *data,int size) +{ +struct mt_device *td =hid_get_drvdata (hid); +struct hid_field *field = td->contactcount; +s32 *value; + +if (field && report->id == field->report->id) { +/* +* Pick in advance the field HID_DG_CONTACTCOUNT as it is +* often placed at the end of the report. +*/ +if (report->id) + data++; + + value =hid_extract_field (hid, field, data); +if (!value) +return 0 ; + +/* +* Includes multi-packet support where subsequent +* packets are sent with zero contactcount. +*/ +if (value[td->contactcount_index])
Quoted 8 lines
drivers/hid/hid-multitouch.c static int mt_event(struct hid_device *hid, struct hid_field *field, · line 708
Quoted 6 lines
drivers/hid/hid-multitouch.c +6
-0+ td->num_expected = value[td->contactcount_index]; + +kfree (value); + } +return 0 ; +}This is a lot of cycles for something that is already available in the core.
Not that much: raw_event is called once per report (unlike ->event which is called one per field per report).
So there is only one extra malloc if the quirk is in place compared to the current implementation.
Cheers,
Benjamin
Quoted 50 lines
Quoted 34 lines
drivers/hid/hid-multitouch.c +10
-0+static void mt_set_input_mode (struct hid_device *hdev) {struct mt_device *td =hid_get_drvdata (hdev);@@ -719,11 +768,15 @@ static void mt_post_parse_default_settings(struct mt_device *td)static void mt_post_parse (struct mt_device *td) {struct mt_fields *f = td->fields; +struct mt_class *cls = &td->mtclass;if (td->touches_by_report >0 ) {int field_count_per_touch = f->length / td->touches_by_report; td->last_slot_field = f->usages[field_count_per_touch -1 ]; } + +if (!td->contactcount) + cls->quirks &= ~MT_QUIRK_CONTACT_CNT_ACCURATE ; }static void mt_input_configured (struct hid_device *hdev,struct hid_input *hi)@@ -1056,6 +1109,11 @@ static const struct hid_device_id mt_devices[] = {MT_USB_DEVICE (USB_VENDOR_ID_TURBOX , USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) }, + /* Nexio panels */ + { .driver_data = MT_CLS_ALWAYS_TRUE, +MT_USB_DEVICE (USB_VENDOR_ID_NEXIO , + USB_DEVICE_ID_NEXIO_MULTITOUCH_420)}, + /* Panasonic panels */ { .driver_data = MT_CLS_PANASONIC, MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC,drivers/hid/hid-multitouch.c static struct hid_driver mt_driver = { · line 1254
Quoted 4 lines
drivers/hid/hid-multitouch.c +1
-0@@ -1193,6 +1251,7 @@ static struct hid_driver mt_driver = { .feature_mapping = mt_feature_mapping, .usage_table = mt_grabbed_usages, .event = mt_event, + .raw_event = mt_raw_event,Rather a new and simpler event method here, in other words.
Quoted 6 lines
drivers/hid/hid-multitouch.c +0
-1#ifdef CONFIG_PM .reset_resume = mt_reset_resume, .resume = mt_resume, --1.8.1
Thanks,
Henrik
Re: [PATCH 02/25] HID: multitouch: add support for Nexio 42" panel
In reply to Henrik RydbergQuoted 16 lines · Henrik Rydberg
Hi Benjamin,
Quoted 5 lines
This device is the worst device I saw. It keeps TipSwitch and InRange at 1 for fingers that are not touching the panel.
The solution is to rely on the field ContactCount, which is accurate as the correct information are packed at the begining of the frame.Quoted 8 lines
Unfortunately, CountactCount is most of the time at the end of the report. The solution is to pick it when we have the whole report in
raw_event.Signed-off-by Benjamin Tissoires <[email protected]>---
drivers/hid/hid-ids.h| 3 ++drivers/hid/hid-multitouch.c| 91 ++++++++++++++++++++++++++++++++++++--------2 files changed, 78 insertions(+), 16 deletions(-)
Quoted 3 lines
I think it would make more sense to introduce a method where the driver sees all report values at once. We have had reasonable cause to add it in the past, but never did.
I dreamed of this more than once in the early days of hid-multitouch, yes. But then it requires quite a few changes in hid-core.c, doesn't it?
Cheers,
St.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 02/25] HID: multitouch: add support for Nexio 42" panel
Quoted 19 lines · Stéphane Chatty
Quoted 16 lines · Henrik Rydberg
Hi Benjamin,
Quoted 13 lines
This device is the worst device I saw. It keeps TipSwitch and InRange at 1 for fingers that are not touching the panel.
The solution is to rely on the field ContactCount, which is accurate as the correct information are packed at the begining of the frame.Unfortunately, CountactCount is most of the time at the end of the report. The solution is to pick it when we have the whole report in
raw_event.Signed-off-by Benjamin Tissoires <[email protected]>---
drivers/hid/hid-ids.h| 3 ++drivers/hid/hid-multitouch.c| 91 ++++++++++++++++++++++++++++++++++++--------2 files changed, 78 insertions(+), 16 deletions(-)
Quoted 7 lines
Quoted 3 lines
I think it would make more sense to introduce a method where the driver sees all report values at once. We have had reasonable cause to add it in the past, but never did.
I dreamed of this more than once in the early days of hid-multitouch, yes. But then it requires quite a few changes in
hid-core.c, doesn't it?
Surprisingly, the hid-core part is very small. The difficulties come in hid-multitouch. But the good is that it's working :) I'll send an updated series soon.
Cheers,
Benjamin
From 2ea45e1f42fdf1991a457b36ad9e4e729d9febc6 Mon Sep 17 00:00:00 2001
From: Benjamin Tissoires <[email protected]>
Date: Mon, 28 Jan 2013 18:30:32 +0100
Subject: [PATCH 1/4] HID: add "report" callback
This callback is called when the parsing of the report has been done by hid core. The driver can now rely on the values stored in the different fields.
--- drivers/hid/hid-core.c | 4 ++++ include/linux/hid.h | 1 + 2 files changed, 5 insertions(+)
drivers/hid/hid-core.c +4 -0
@@ -1195,6 +1195,7 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, {struct hid_report_enum *report_enum = hid->report_enum + type;struct hid_report *report; +struct hid_driver *hdrv;unsigned int a;int rsize, csize = size;u8 *cdata = data;
@@ -1231,6 +1232,9 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,if (hid->claimed !=HID_CLAIMED_HIDRAW ) {for (a =0 ; a < report->maxfield; a++)hid_input_field (hid, report->field[a], cdata, interrupt); + hdrv = hid->driver; +if (hdrv && hdrv->report) + hdrv->report (hid, report); }if (hid->claimed &HID_CLAIMED_INPUT )
include/linux/hid.h +1 -0
@@ -627,6 +627,7 @@ struct hid_driver {const struct hid_usage_id *usage_table;int (*event)(struct hid_device *hdev,struct hid_field *field,struct hid_usage *usage,__s32 value); +void (*report)(struct hid_device *hdev,struct hid_report *report);__u8 *(*report_fixup)(struct hid_device *hdev,__u8 *buf,unsigned int *size);
Signature · 13 lines
1.8.1 From fecc6efa1900611ef601837734f278bc06610aa8 Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires <[email protected]> Date: Mon, 28 Jan 2013 18:39:51 +0100 Subject: [PATCH 2/4] HID: multitouch: use the callback "report" instead of sequential events Signed-off-by: Benjamin Tissoires <[email protected]> --- drivers/hid/hid-multitouch.c | 48 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-)
drivers/hid/hid-multitouch.c +42 -6
86 lines not on this page · raw message
Signature · 13 lines
1.8.1 From 02f3c2f43fa31838dc8faef65690439c85a66086 Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires <[email protected]> Date: Mon, 28 Jan 2013 18:37:59 +0100 Subject: [PATCH 4/4] HID: multitouch: pick the contact count field in advance Signed-off-by: Benjamin Tissoires <[email protected]> --- drivers/hid/hid-multitouch.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/hid/hid-multitouch.c +7 -0
@@ -698,6 +698,13 @@ static void mt_report(struct hid_device *hid, struct hid_report *report)if (report->id != td->mt_report_id)return ; +/* +* Includes multi-packet support where subsequent +* packets are sent with zero contactcount. +*/ +if (field_cc->value[td->contactcount_index]) + td->num_expected = field_cc->value[td->contactcount_index]; +for (r =0 ; r < report->maxfield; r++) { field = report->field[r]; count = field->report_count;
Signature · 1 line
1.8.1
PATCH 3/25 HID: multitouch: fix Win8 protocol for Sharp like devices
In reply to Benjamin TissoiresThe Sharp LC-20FE1-W screen (04dd:9681) behaves like the Nexio 42". It may report out of ranges values that are filtered out by relying on the Contact Count HID field.
Adding the quirk MT_QUIRK_CONTACT_CNT_ACCURATE makes hid-multitouch strongest against this kind of device, without breaking the current devices.
--- drivers/hid/hid-multitouch.c | 1 + 1 file changed, 1 insertion(+)
drivers/hid/hid-multitouch.c +1 -0
@@ -317,6 +317,7 @@ static void mt_feature_mapping(struct hid_device *hdev, *quirks |=MT_QUIRK_ALWAYS_VALID ; *quirks |=MT_QUIRK_IGNORE_DUPLICATES ; *quirks |=MT_QUIRK_HOVERING ; + *quirks |=MT_QUIRK_CONTACT_CNT_ACCURATE ; *quirks &= ~MT_QUIRK_NOT_SEEN_MEANS_UP ; *quirks &= ~MT_QUIRK_VALID_IS_INRANGE ; *quirks &= ~MT_QUIRK_VALID_IS_CONFIDENCE ;
Signature · 1 line
1.8.1
PATCH 4/25 HID: multitouch: ensure that serial devices make no use of contact count
In reply to Benjamin TissoiresThe serial protocol makes contact count a redondant information, and sometimes it is not reliable (TRS-Star are in this case). Disabling the use of contact count for these devices is thus safer.
--- drivers/hid/hid-multitouch.c | 1 + 1 file changed, 1 insertion(+)
drivers/hid/hid-multitouch.c +1 -0
@@ -761,6 +761,7 @@ static void mt_post_parse_default_settings(struct mt_device *td) quirks &= ~MT_QUIRK_NOT_SEEN_MEANS_UP ; quirks &= ~MT_QUIRK_VALID_IS_INRANGE ; quirks &= ~MT_QUIRK_VALID_IS_CONFIDENCE ; + quirks &= ~MT_QUIRK_CONTACT_CNT_ACCURATE ; } td->mtclass.quirks = quirks;
Signature · 1 line
1.8.1
PATCH 5/25 HID: multitouch: fix protocol for Sitronix 1403:5001
In reply to Benjamin TissoiresSince the inclusion of this device in hid-multitouch, the device did not forward any events. Using the serial class makes it working again.
--- drivers/hid/hid-multitouch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-multitouch.c +1 -1
@@ -1171,7 +1171,7 @@ static const struct hid_device_id mt_devices[] = { { .driver_data = MT_CLS_CONFIDENCE,MT_USB_DEVICE (USB_VENDOR_ID_STANTUM_STM , USB_DEVICE_ID_MTP_STM)}, - { .driver_data = MT_CLS_CONFIDENCE, + { .driver_data = MT_CLS_ALWAYS_TRUE,MT_USB_DEVICE (USB_VENDOR_ID_STANTUM_SITRONIX , USB_DEVICE_ID_MTP_SITRONIX)},
Signature · 1 line
1.8.1
PATCH 6/25 HID: multitouch: optimize FlatFrog panels
In reply to Benjamin TissoiresRelying on ALWAYS_VALID enhance a little the processing time of the events.
--- drivers/hid/hid-multitouch.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/hid/hid-multitouch.c +3 -2
@@ -229,8 +229,9 @@ static struct mt_class mt_classes[] = { }, { .name = MT_CLS_FLATFROG, - .quirks =MT_QUIRK_NOT_SEEN_MEANS_UP | - MT_QUIRK_NO_AREA, + .quirks =MT_QUIRK_ALWAYS_VALID | +MT_QUIRK_NO_AREA | + MT_QUIRK_CONTACT_CNT_ACCURATE, .sn_move = 2048, .maxcontacts = 40, },
Signature · 1 line
1.8.1
Re: [PATCH 06/25] HID: multitouch: optimize FlatFrog panels
Hi Benjamin,
Quoted 7 lines
Relying on
ALWAYS_VALIDenhance a little the processing time of the events.Signed-off-by Benjamin Tissoires <[email protected]>--- drivers/hid/hid-multitouch.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Is there a measurement backing up this claim? I suspect micro-optimizations of this kind drowns completely along the rather long way from device, via malloc and loops, to the input core. Considering the must-be-tested-for-regression risk on top of that, this patch falls far below what is worth doing, IMHO.
Quoted 19 lines
drivers/hid/hid-multitouch.c +3
-2@@ -229,8 +229,9 @@ static struct mt_class mt_classes[] = { }, { .name = MT_CLS_FLATFROG, - .quirks =MT_QUIRK_NOT_SEEN_MEANS_UP | - MT_QUIRK_NO_AREA, + .quirks =MT_QUIRK_ALWAYS_VALID | +MT_QUIRK_NO_AREA | + MT_QUIRK_CONTACT_CNT_ACCURATE, .sn_move = 2048, .maxcontacts = 40, },Signature · 1 line
1.8.1
Thanks.
Henrik
Re: [PATCH 06/25] HID: multitouch: optimize FlatFrog panels
Quoted 5 lines · Henrik Rydberg
Hi Benjamin,
Quoted 3 lines
Relying on
ALWAYS_VALIDenhance a little the processing time of the events.
Quoted 8 lines
Quoted 4 lines
Signed-off-by Benjamin Tissoires <[email protected]>--- drivers/hid/hid-multitouch.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)Is there a measurement backing up this claim? I suspect micro-optimizations of this kind drowns completely along the rather long way from device, via malloc and loops, to the input core.
No, the measure I made for this are roughly the same. It's purely micro-optimization, and yes, mallocs must kill the processing time. However, the purpose of this patch and the others entitled 'optimize XXX' is to show that I did not invented the new default class. My true objective is to remove all the quirks related to the 'valid' information in order to have a driver as universal as possible and to be able to clean it up.
Quoted 2 lines
Considering the must-be-tested-for-regression risk on top of that, this patch falls far below what is worth doing, IMHO.
It _has_ been tested. I got the HID traces from FlatFrog and either they use different firmwares with different processing in their devices, the kernel processing is good.
Cheers,
Benjamin
Quoted 23 lines
Quoted 18 lines
drivers/hid/hid-multitouch.c +3
-3@@ -229,8 +229,9 @@ static struct mt_class mt_classes[] = { }, { .name = MT_CLS_FLATFROG, - .quirks =MT_QUIRK_NOT_SEEN_MEANS_UP | - MT_QUIRK_NO_AREA, + .quirks =MT_QUIRK_ALWAYS_VALID | +MT_QUIRK_NO_AREA | + MT_QUIRK_CONTACT_CNT_ACCURATE, .sn_move = 2048, .maxcontacts = 40, }, --Quoted 2 lines
1.8.1
Thanks.
Henrik
PATCH 7/25 HID: multitouch: optimize 3M panels
In reply to Benjamin TissoiresNot very different in terms of processing time. However, this uniformizes the handling of devices.
--- drivers/hid/hid-multitouch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-multitouch.c +2 -1
@@ -186,7 +186,8 @@ static struct mt_class mt_classes[] = {* vendor specific classes */ { .name = MT_CLS_3M, - .quirks =MT_QUIRK_VALID_IS_CONFIDENCE | + .quirks =MT_QUIRK_ALWAYS_VALID | +MT_QUIRK_CONTACT_CNT_ACCURATE | MT_QUIRK_SLOT_IS_CONTACTID, .sn_move = 2048, .sn_width = 128,
Signature · 1 line
1.8.1
PATCH 8/25 HID: multitouch: optimize Cypress panels
In reply to Benjamin TissoiresRelying on ALWAYS_VALID enhance a little the processing time of the events.
--- drivers/hid/hid-multitouch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-multitouch.c +2 -1
@@ -195,7 +195,8 @@ static struct mt_class mt_classes[] = { .maxcontacts = 60, }, { .name = MT_CLS_CYPRESS, - .quirks =MT_QUIRK_NOT_SEEN_MEANS_UP | + .quirks =MT_QUIRK_ALWAYS_VALID | +MT_QUIRK_CONTACT_CNT_ACCURATE | MT_QUIRK_CYPRESS, .maxcontacts = 10 }, { .name = MT_CLS_EGALAX,
Signature · 1 line
1.8.1
PATCH 9/25 HID: multitouch: optimize eGalax panels
In reply to Benjamin TissoiresRelying on ALWAYS_VALID enhance a little the processing time of the events. So using MT_CLS_EGALAX_SERIAL is better than using MT_CLS_EGALAX.
--- drivers/hid/hid-multitouch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-multitouch.c +1 -1
@@ -1014,7 +1014,7 @@ static const struct hid_device_id mt_devices[] = { { .driver_data = MT_CLS_EGALAX_SERIAL,MT_USB_DEVICE (USB_VENDOR_ID_DWAV , USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72AA) }, - { .driver_data = MT_CLS_EGALAX, + { .driver_data = MT_CLS_EGALAX_SERIAL,MT_USB_DEVICE (USB_VENDOR_ID_DWAV , USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA) }, { .driver_data = MT_CLS_EGALAX,
Signature · 1 line
1.8.1
PATCH 10/25 HID: multitouch: optimize Stantum panels
In reply to Benjamin TissoiresNot very different in terms of processing time. However, this uniformizes the handling of devices.
--- drivers/hid/hid-multitouch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-multitouch.c +1 -1
@@ -1168,7 +1168,7 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008) },/* Stantum panels */ - { .driver_data = MT_CLS_CONFIDENCE, + { .driver_data = MT_CLS_ALWAYS_TRUE,MT_USB_DEVICE (USB_VENDOR_ID_STANTUM , USB_DEVICE_ID_MTP)}, { .driver_data = MT_CLS_CONFIDENCE,
Signature · 1 line
1.8.1
PATCH 11/25 HID: multitouch: optimize Quanta panels
In reply to Benjamin TissoiresNot very different in terms of processing time. However, this uniformizes the handling of devices.
--- drivers/hid/hid-multitouch.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/hid/hid-multitouch.c +6 -1
@@ -119,6 +119,7 @@ struct mt_device {#define MT_CLS_DUAL_NSMU_CONTACTID 0x0008#define MT_CLS_INRANGE_CONTACTNUMBER 0x0009#define MT_CLS_ALWAYS_TRUE 0x000a +#define MT_CLS_CONTACT_ID 0x0011/* vendor specific classes */ #define MT_CLS_3M 0x0101
@@ -181,6 +182,10 @@ static struct mt_class mt_classes[] = { { .name = MT_CLS_ALWAYS_TRUE, .quirks =MT_QUIRK_ALWAYS_VALID | MT_QUIRK_CONTACT_CNT_ACCURATE }, + { .name = MT_CLS_CONTACT_ID, + .quirks =MT_QUIRK_ALWAYS_VALID | +MT_QUIRK_CONTACT_CNT_ACCURATE | + MT_QUIRK_SLOT_IS_CONTACTID },/* * vendor specific classes
@@ -1157,7 +1162,7 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) },/* Quanta-based panels */ - { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID, + { .driver_data = MT_CLS_CONTACT_ID,MT_USB_DEVICE (USB_VENDOR_ID_QUANTA , USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) }, { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
Signature · 1 line
1.8.1
PATCH 12/25 HID: multitouch: optimize Lumio panels
In reply to Benjamin TissoiresNot very different in terms of processing time. However, this uniformizes the handling of devices.
--- drivers/hid/hid-multitouch.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/hid/hid-multitouch.c +7 -2
@@ -120,6 +120,7 @@ struct mt_device {#define MT_CLS_INRANGE_CONTACTNUMBER 0x0009#define MT_CLS_ALWAYS_TRUE 0x000a#define MT_CLS_CONTACT_ID 0x0011 +#define MT_CLS_MINUS_ONE 0x0012/* vendor specific classes */ #define MT_CLS_3M 0x0101
@@ -186,6 +187,10 @@ static struct mt_class mt_classes[] = { .quirks = MT_QUIRK_ALWAYS_VALID |MT_QUIRK_CONTACT_CNT_ACCURATE | MT_QUIRK_SLOT_IS_CONTACTID }, + { .name = MT_CLS_MINUS_ONE, + .quirks =MT_QUIRK_ALWAYS_VALID | +MT_QUIRK_CONTACT_CNT_ACCURATE | + MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE },/* * vendor specific classes
@@ -1101,10 +1106,10 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_LG_MULTITOUCH) },/* Lumio panels */ - { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE, + { .driver_data = MT_CLS_MINUS_ONE,MT_USB_DEVICE (USB_VENDOR_ID_LUMIO , USB_DEVICE_ID_CRYSTALTOUCH) }, - { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE, + { .driver_data = MT_CLS_MINUS_ONE,MT_USB_DEVICE (USB_VENDOR_ID_LUMIO , USB_DEVICE_ID_CRYSTALTOUCH_DUAL) },
Signature · 1 line
1.8.1
PATCH 13/25 HID: multitouch: optimize MosArt panels
In reply to Benjamin TissoiresNot very different in terms of processing time. However, this uniformizes the handling of devices.
--- drivers/hid/hid-multitouch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-multitouch.c +1 -1
@@ -1114,7 +1114,7 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_CRYSTALTOUCH_DUAL) },/* MosArt panels */ - { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE, + { .driver_data = MT_CLS_MINUS_ONE,MT_USB_DEVICE (USB_VENDOR_ID_ASUS , USB_DEVICE_ID_ASUS_T91MT)}, { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Signature · 1 line
1.8.1
PATCH 14/25 HID: multitouch: optimize Elo panels
In reply to Benjamin TissoiresRelying on ALWAYS_VALID enhance a little the processing time of the events.
--- drivers/hid/hid-multitouch.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/hid/hid-multitouch.c +7 -1
@@ -121,6 +121,7 @@ struct mt_device {#define MT_CLS_ALWAYS_TRUE 0x000a#define MT_CLS_CONTACT_ID 0x0011#define MT_CLS_MINUS_ONE 0x0012 +#define MT_CLS_DUAL_CONTACT_ID 0x0013/* vendor specific classes */ #define MT_CLS_3M 0x0101
@@ -191,6 +192,11 @@ static struct mt_class mt_classes[] = { .quirks = MT_QUIRK_ALWAYS_VALID |MT_QUIRK_CONTACT_CNT_ACCURATE | MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE }, + { .name = MT_CLS_DUAL_CONTACT_ID, + .quirks =MT_QUIRK_ALWAYS_VALID | +MT_QUIRK_CONTACT_CNT_ACCURATE | + MT_QUIRK_SLOT_IS_CONTACTID, + .maxcontacts = 2 },/* * vendor specific classes
@@ -1050,7 +1056,7 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72C4) },/* Elo TouchSystems IntelliTouch Plus panel */ - { .driver_data = MT_CLS_DUAL_NSMU_CONTACTID, + { .driver_data = MT_CLS_DUAL_CONTACT_ID,MT_USB_DEVICE (USB_VENDOR_ID_ELO , USB_DEVICE_ID_ELO_TS2515) },
Signature · 1 line
1.8.1
PATCH 15/25 HID: multitouch: optimize Hanvon panels
In reply to Benjamin TissoiresNot very different in terms of processing time. However, this uniformizes the handling of devices.
--- drivers/hid/hid-multitouch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-multitouch.c +1 -1
@@ -1084,7 +1084,7 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_GOODTOUCH_000f) },/* Hanvon panels */ - { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID, + { .driver_data = MT_CLS_DUAL_CONTACT_ID,MT_USB_DEVICE (USB_VENDOR_ID_HANVON_ALT , USB_DEVICE_ID_HANVON_ALT_MULTITOUCH) },
Signature · 1 line
1.8.1
PATCH 16/25 HID: multitouch: optimize IRTouch panels
In reply to Benjamin TissoiresNot very different in terms of processing time. However, this uniformizes the handling of devices.
--- drivers/hid/hid-multitouch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-multitouch.c +1 -1
@@ -1102,7 +1102,7 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_ILITEK_MULTITOUCH) },/* IRTOUCH panels */ - { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID, + { .driver_data = MT_CLS_DUAL_CONTACT_ID,MT_USB_DEVICE (USB_VENDOR_ID_IRTOUCHSYSTEMS , USB_DEVICE_ID_IRTOUCH_INFRARED_USB) },
Signature · 1 line
1.8.1
PATCH 17/25 HID: multitouch: fix protocol for Cando 2087:0a02
In reply to Benjamin TissoiresCando 2087:0a02 was broken, this fixes it.
--- drivers/hid/hid-multitouch.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/hid/hid-multitouch.c +7 -1
@@ -122,6 +122,7 @@ struct mt_device {#define MT_CLS_CONTACT_ID 0x0011#define MT_CLS_MINUS_ONE 0x0012#define MT_CLS_DUAL_CONTACT_ID 0x0013 +#define MT_CLS_DUAL_CONTACT_NUMBER 0x0014/* vendor specific classes */ #define MT_CLS_3M 0x0101
@@ -197,6 +198,11 @@ static struct mt_class mt_classes[] = {MT_QUIRK_CONTACT_CNT_ACCURATE | MT_QUIRK_SLOT_IS_CONTACTID, .maxcontacts = 2 }, + { .name = MT_CLS_DUAL_CONTACT_NUMBER, + .quirks =MT_QUIRK_ALWAYS_VALID | +MT_QUIRK_CONTACT_CNT_ACCURATE | + MT_QUIRK_SLOT_IS_CONTACTNUMBER, + .maxcontacts = 2 },/* * vendor specific classes
@@ -969,7 +975,7 @@ static const struct hid_device_id mt_devices[] = { { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,MT_USB_DEVICE (USB_VENDOR_ID_CANDO , USB_DEVICE_ID_CANDO_MULTI_TOUCH) }, - { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER, + { .driver_data = MT_CLS_DUAL_CONTACT_NUMBER,MT_USB_DEVICE (USB_VENDOR_ID_CANDO , USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1) }, { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Signature · 1 line
1.8.1
PATCH 18/25 HID: multitouch: optimize Cando panels
In reply to Benjamin TissoiresNot very different in terms of processing time. However, this uniformizes the handling of devices.
--- drivers/hid/hid-multitouch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-multitouch.c +1 -1
@@ -978,7 +978,7 @@ static const struct hid_device_id mt_devices[] = { { .driver_data = MT_CLS_DUAL_CONTACT_NUMBER,MT_USB_DEVICE (USB_VENDOR_ID_CANDO , USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1) }, - { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER, + { .driver_data = MT_CLS_DUAL_CONTACT_NUMBER,MT_USB_DEVICE (USB_VENDOR_ID_CANDO , USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) }, { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Signature · 1 line
1.8.1
PATCH 19/25 HID: multitouch: optimize ActionStar panels
In reply to Benjamin TissoiresRelying on ALWAYS_VALID enhance a little the processing time of the events.
Also the slot can be extracted faster by using MINUS_ONE.
--- drivers/hid/hid-multitouch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-multitouch.c +1 -1
@@ -955,7 +955,7 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_3M3266) },/* ActionStar panels */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_MINUS_ONE,MT_USB_DEVICE (USB_VENDOR_ID_ACTIONSTAR , USB_DEVICE_ID_ACTIONSTAR_1011) },
Signature · 1 line
1.8.1
PATCH 20/25 HID: multitouch: optimize Atmel panels
In reply to Benjamin TissoiresThe slot can be extracted using MINUS_ONE.
--- drivers/hid/hid-multitouch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-multitouch.c +1 -1
@@ -960,7 +960,7 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_ACTIONSTAR_1011) },/* Atmel panels */ - { .driver_data = MT_CLS_SERIAL, + { .driver_data = MT_CLS_MINUS_ONE,MT_USB_DEVICE (USB_VENDOR_ID_ATMEL , USB_DEVICE_ID_ATMEL_MULTITOUCH) }, { .driver_data = MT_CLS_SERIAL,
Signature · 1 line
1.8.1
PATCH 21/25 HID: multitouch: optimize Ideacom panels
In reply to Benjamin TissoiresThe slot can be extracted by using MINUS_ONE.
--- drivers/hid/hid-multitouch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hid/hid-multitouch.c +2 -2
@@ -1095,10 +1095,10 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_HANVON_ALT_MULTITOUCH) },/* Ideacom panel */ - { .driver_data = MT_CLS_SERIAL, + { .driver_data = MT_CLS_MINUS_ONE,MT_USB_DEVICE (USB_VENDOR_ID_IDEACOM , USB_DEVICE_ID_IDEACOM_IDC6650) }, - { .driver_data = MT_CLS_SERIAL, + { .driver_data = MT_CLS_MINUS_ONE,MT_USB_DEVICE (USB_VENDOR_ID_IDEACOM , USB_DEVICE_ID_IDEACOM_IDC6651) },
Signature · 1 line
1.8.1
PATCH 22/25 HID: multitouch: optimize LG panels
In reply to Benjamin TissoiresRelying on ALWAYS_VALID enhance a little the processing time of the events.
Also, the slot can be extracted by using the contact ID.
--- drivers/hid/hid-multitouch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-multitouch.c +1 -1
@@ -1113,7 +1113,7 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_IRTOUCH_INFRARED_USB) },/* LG Display panels */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_CONTACT_ID,MT_USB_DEVICE (USB_VENDOR_ID_LG , USB_DEVICE_ID_LG_MULTITOUCH) },
Signature · 1 line
1.8.1
PATCH 23/25 HID: multitouch: optimize Nexio panels
In reply to Benjamin TissoiresThe slot can be extracted using by MINUS_ONE.
--- drivers/hid/hid-multitouch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-multitouch.c +1 -1
@@ -1137,7 +1137,7 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) },/* Nexio panels */ - { .driver_data = MT_CLS_ALWAYS_TRUE, + { .driver_data = MT_CLS_MINUS_ONE,MT_USB_DEVICE (USB_VENDOR_ID_NEXIO , USB_DEVICE_ID_NEXIO_MULTITOUCH_420)},
Signature · 1 line
1.8.1
PATCH 24/25 HID: multitouch: remove useless DUAL_NSMU_CONTACTID class
In reply to Benjamin Tissoires--- drivers/hid/hid-multitouch.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/hid/hid-multitouch.c +0 -5
@@ -116,7 +116,6 @@ struct mt_device {#define MT_CLS_CONFIDENCE_MINUS_ONE 0x0005#define MT_CLS_DUAL_INRANGE_CONTACTID 0x0006#define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 0x0007 -#define MT_CLS_DUAL_NSMU_CONTACTID 0x0008#define MT_CLS_INRANGE_CONTACTNUMBER 0x0009#define MT_CLS_ALWAYS_TRUE 0x000a#define MT_CLS_CONTACT_ID 0x0011
@@ -175,10 +174,6 @@ static struct mt_class mt_classes[] = { .quirks = MT_QUIRK_VALID_IS_INRANGE | MT_QUIRK_SLOT_IS_CONTACTNUMBER, .maxcontacts = 2 }, - { .name = MT_CLS_DUAL_NSMU_CONTACTID, - .quirks =MT_QUIRK_NOT_SEEN_MEANS_UP | - MT_QUIRK_SLOT_IS_CONTACTID, - .maxcontacts = 2 }, { .name = MT_CLS_INRANGE_CONTACTNUMBER, .quirks =MT_QUIRK_VALID_IS_INRANGE | MT_QUIRK_SLOT_IS_CONTACTNUMBER },
Signature · 1 line
1.8.1
PATCH 25/25 HID: multitouch: make MT_CLS_ALWAYS_TRUE the new default class
In reply to Benjamin TissoiresBy running a test on all the traces of the devices I have, I noticed that the class MT_CLS_ALWAYS_TRUE could handle all the devices I've seen so far without any other quirks. I guess this is the behavior Win 7 requires in its driver.
We can change the default class then and keep the existing classes for backward compatibility and performances for some of them.
Two operations have been done:
- replaced MT_CLS_DEFAULT by MT_CLS_NSMU
- then replaced MT_CLS_ALWAYS_TRUE by MT_CLS_DEFAULT
--- drivers/hid/hid-multitouch.c | 53 ++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 26 deletions(-)
drivers/hid/hid-multitouch.c +27 -26
@@ -117,7 +117,7 @@ struct mt_device {#define MT_CLS_DUAL_INRANGE_CONTACTID 0x0006#define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 0x0007#define MT_CLS_INRANGE_CONTACTNUMBER 0x0009 -#define MT_CLS_ALWAYS_TRUE 0x000a +#define MT_CLS_NSMU 0x000a#define MT_CLS_CONTACT_ID 0x0011#define MT_CLS_MINUS_ONE 0x0012#define MT_CLS_DUAL_CONTACT_ID 0x0013
@@ -155,6 +155,9 @@ static int cypress_compute_slot(struct mt_device *td)static struct mt_class mt_classes[] = { { .name =MT_CLS_DEFAULT , + .quirks =MT_QUIRK_ALWAYS_VALID | +MT_QUIRK_CONTACT_CNT_ACCURATE }, + { .name =MT_CLS_NSMU , .quirks =MT_QUIRK_NOT_SEEN_MEANS_UP }, { .name =MT_CLS_SERIAL , .quirks =MT_QUIRK_ALWAYS_VALID },
@@ -177,9 +180,7 @@ static struct mt_class mt_classes[] = { { .name = MT_CLS_INRANGE_CONTACTNUMBER, .quirks =MT_QUIRK_VALID_IS_INRANGE | MT_QUIRK_SLOT_IS_CONTACTNUMBER }, - { .name = MT_CLS_ALWAYS_TRUE, - .quirks =MT_QUIRK_ALWAYS_VALID | - MT_QUIRK_CONTACT_CNT_ACCURATE }, + { .name = MT_CLS_CONTACT_ID, .quirks =MT_QUIRK_ALWAYS_VALID | MT_QUIRK_CONTACT_CNT_ACCURATE |
@@ -963,7 +964,7 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_ATMEL_MXT_DIGITIZER) },/* Baanto multitouch devices */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_BAANTO , USB_DEVICE_ID_BAANTO_MT_190W2) },/* Cando panels */
@@ -981,12 +982,12 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) },/* Chunghwa Telecom touch panels */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_CHUNGHWAT , USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) }, /* CVTouch panels */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_CVTOUCH , USB_DEVICE_ID_CVTOUCH_SCREEN) },
@@ -1075,12 +1076,12 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PWT_TENFINGERS) },/* Gametel game controller */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_BT_DEVICE (USB_VENDOR_ID_FRUCTEL , USB_DEVICE_ID_GAMETEL_MT_MODE) }, /* GoodTouch panels */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_GOODTOUCH , USB_DEVICE_ID_GOODTOUCH_000f) },
@@ -1098,7 +1099,7 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_IDEACOM_IDC6651) },/* Ilitek dual touch panel */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_ILITEK , USB_DEVICE_ID_ILITEK_MULTITOUCH) },
@@ -1145,7 +1146,7 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_PANABOARD_UBT880) },/* Novatek Panel */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_NOVATEK , USB_DEVICE_ID_NOVATEK_PCT) },
@@ -1185,13 +1186,13 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008) },/* Stantum panels */ - { .driver_data = MT_CLS_ALWAYS_TRUE, + { .driver_data = MT_CLS_DEFAULT,MT_USB_DEVICE (USB_VENDOR_ID_STANTUM , USB_DEVICE_ID_MTP)}, { .driver_data = MT_CLS_CONFIDENCE,MT_USB_DEVICE (USB_VENDOR_ID_STANTUM_STM , USB_DEVICE_ID_MTP_STM)}, - { .driver_data = MT_CLS_ALWAYS_TRUE, + { .driver_data = MT_CLS_DEFAULT,MT_USB_DEVICE (USB_VENDOR_ID_STANTUM_SITRONIX , USB_DEVICE_ID_MTP_SITRONIX)},
@@ -1201,48 +1202,48 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_TOPSEED2_PERIPAD_701) },/* Touch International panels */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_TOUCH_INTL , USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH) }, /* Unitec panels */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_UNITEC , USB_DEVICE_ID_UNITEC_USB_TOUCH_0709) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_UNITEC , USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) }, /* XAT */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XAT , USB_DEVICE_ID_XAT_CSR) }, /* Xiroku */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_SPX) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_MPX) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_CSR) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_SPX1) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_MPX1) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_CSR1) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_SPX2) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_MPX2) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_CSR2) },
Signature · 1 line
1.8.1
Re: [PATCH 25/25] HID: multitouch: make MT_CLS_ALWAYS_TRUE the new default class
Hi Benjamin,
Quoted 7 lines
By running a test on all the traces of the devices I have, I noticed that the class
MT_CLS_ALWAYS_TRUEcould handle all the devices I've seen so far without any other quirks. I guess this is the behavior Win 7 requires in its driver.We can change the default class then and keep the existing classes for backward compatibility and performances for some of them.
Nice observation. A simpler route is to add new devices according the new scheme, and leave the current code intact. Don't fix what ain't broken.
Quoted 182 lines
Two operations have been done:
- replacedMT_CLS_DEFAULTbyMT_CLS_NSMU
- then replacedMT_CLS_ALWAYS_TRUEbyMT_CLS_DEFAULTSigned-off-by Benjamin Tissoires <[email protected]>--- drivers/hid/hid-multitouch.c | 53 ++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 26 deletions(-)drivers/hid/hid-multitouch.c +27
-26@@ -117,7 +117,7 @@ struct mt_device {#define MT_CLS_DUAL_INRANGE_CONTACTID 0x0006#define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 0x0007#define MT_CLS_INRANGE_CONTACTNUMBER 0x0009 -#define MT_CLS_ALWAYS_TRUE 0x000a +#define MT_CLS_NSMU 0x000a#define MT_CLS_CONTACT_ID 0x0011#define MT_CLS_MINUS_ONE 0x0012#define MT_CLS_DUAL_CONTACT_ID 0x0013@@ -155,6 +155,9 @@ static int cypress_compute_slot(struct mt_device *td)static struct mt_class mt_classes[] = { { .name =MT_CLS_DEFAULT , + .quirks =MT_QUIRK_ALWAYS_VALID | +MT_QUIRK_CONTACT_CNT_ACCURATE }, + { .name =MT_CLS_NSMU , .quirks =MT_QUIRK_NOT_SEEN_MEANS_UP }, { .name =MT_CLS_SERIAL , .quirks =MT_QUIRK_ALWAYS_VALID },@@ -177,9 +180,7 @@ static struct mt_class mt_classes[] = { { .name = MT_CLS_INRANGE_CONTACTNUMBER, .quirks =MT_QUIRK_VALID_IS_INRANGE | MT_QUIRK_SLOT_IS_CONTACTNUMBER }, - { .name = MT_CLS_ALWAYS_TRUE, - .quirks =MT_QUIRK_ALWAYS_VALID | - MT_QUIRK_CONTACT_CNT_ACCURATE }, + { .name = MT_CLS_CONTACT_ID, .quirks =MT_QUIRK_ALWAYS_VALID | MT_QUIRK_CONTACT_CNT_ACCURATE |@@ -963,7 +964,7 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_ATMEL_MXT_DIGITIZER) },/* Baanto multitouch devices */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_BAANTO , USB_DEVICE_ID_BAANTO_MT_190W2) },/* Cando panels */ @@ -981,12 +982,12 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) },/* Chunghwa Telecom touch panels */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_CHUNGHWAT , USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) }, /* CVTouch panels */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_CVTOUCH , USB_DEVICE_ID_CVTOUCH_SCREEN) },@@ -1075,12 +1076,12 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PWT_TENFINGERS) },/* Gametel game controller */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_BT_DEVICE (USB_VENDOR_ID_FRUCTEL , USB_DEVICE_ID_GAMETEL_MT_MODE) }, /* GoodTouch panels */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_GOODTOUCH , USB_DEVICE_ID_GOODTOUCH_000f) },@@ -1098,7 +1099,7 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_IDEACOM_IDC6651) },/* Ilitek dual touch panel */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_ILITEK , USB_DEVICE_ID_ILITEK_MULTITOUCH) },@@ -1145,7 +1146,7 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_PANABOARD_UBT880) },/* Novatek Panel */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_NOVATEK , USB_DEVICE_ID_NOVATEK_PCT) },@@ -1185,13 +1186,13 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008) },/* Stantum panels */ - { .driver_data = MT_CLS_ALWAYS_TRUE, + { .driver_data = MT_CLS_DEFAULT,MT_USB_DEVICE (USB_VENDOR_ID_STANTUM , USB_DEVICE_ID_MTP)}, { .driver_data = MT_CLS_CONFIDENCE,MT_USB_DEVICE (USB_VENDOR_ID_STANTUM_STM , USB_DEVICE_ID_MTP_STM)}, - { .driver_data = MT_CLS_ALWAYS_TRUE, + { .driver_data = MT_CLS_DEFAULT,MT_USB_DEVICE (USB_VENDOR_ID_STANTUM_SITRONIX , USB_DEVICE_ID_MTP_SITRONIX)},@@ -1201,48 +1202,48 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_TOPSEED2_PERIPAD_701) },/* Touch International panels */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_TOUCH_INTL , USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH) }, /* Unitec panels */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_UNITEC , USB_DEVICE_ID_UNITEC_USB_TOUCH_0709) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_UNITEC , USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) }, /* XAT */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XAT , USB_DEVICE_ID_XAT_CSR) }, /* Xiroku */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_SPX) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_MPX) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_CSR) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_SPX1) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_MPX1) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_CSR1) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_SPX2) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_MPX2) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_CSR2) },Signature · 1 line
1.8.1
Thanks,
Henrik
Re: [PATCH 25/25] HID: multitouch: make MT_CLS_ALWAYS_TRUE the new default class
Quoted 7 lines · Henrik Rydberg
Hi Benjamin,
Quoted 5 lines
By running a test on all the traces of the devices I have, I noticed that the class
MT_CLS_ALWAYS_TRUEcould handle all the devices I've seen so far without any other quirks. I guess this is the behavior Win 7 requires in its driver.
Quoted 6 lines
Quoted 2 lines
We can change the default class then and keep the existing classes for backward compatibility and performances for some of them.
Nice observation. A simpler route is to add new devices according the new scheme, and leave the current code intact. Don't fix what ain't broken.
I fully agree with that, and this is the way I built this patch. All the current working devices supported in the kernel through the 'old' default class (that I was not able to test) are keeping the very same class. This class has just been renamed "NSMU".
The new devices will get the new default class.
Maybe that if I do the change with 2 different patches, it will be more readable and error-proof?
Cheers,
Benjamin
Quoted 186 lines
Quoted 181 lines
Two operations have been done:
- replacedMT_CLS_DEFAULTbyMT_CLS_NSMU
- then replacedMT_CLS_ALWAYS_TRUEbyMT_CLS_DEFAULTSigned-off-by Benjamin Tissoires <[email protected]>--- drivers/hid/hid-multitouch.c | 53 ++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 26 deletions(-)drivers/hid/hid-multitouch.c +27
-27@@ -117,7 +117,7 @@ struct mt_device {#define MT_CLS_DUAL_INRANGE_CONTACTID 0x0006#define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 0x0007#define MT_CLS_INRANGE_CONTACTNUMBER 0x0009 -#define MT_CLS_ALWAYS_TRUE 0x000a +#define MT_CLS_NSMU 0x000a#define MT_CLS_CONTACT_ID 0x0011#define MT_CLS_MINUS_ONE 0x0012#define MT_CLS_DUAL_CONTACT_ID 0x0013@@ -155,6 +155,9 @@ static int cypress_compute_slot(struct mt_device *td)static struct mt_class mt_classes[] = { { .name =MT_CLS_DEFAULT , + .quirks =MT_QUIRK_ALWAYS_VALID | +MT_QUIRK_CONTACT_CNT_ACCURATE }, + { .name =MT_CLS_NSMU , .quirks =MT_QUIRK_NOT_SEEN_MEANS_UP }, { .name =MT_CLS_SERIAL , .quirks =MT_QUIRK_ALWAYS_VALID },@@ -177,9 +180,7 @@ static struct mt_class mt_classes[] = { { .name = MT_CLS_INRANGE_CONTACTNUMBER, .quirks =MT_QUIRK_VALID_IS_INRANGE | MT_QUIRK_SLOT_IS_CONTACTNUMBER }, - { .name = MT_CLS_ALWAYS_TRUE, - .quirks =MT_QUIRK_ALWAYS_VALID | - MT_QUIRK_CONTACT_CNT_ACCURATE }, + { .name = MT_CLS_CONTACT_ID, .quirks =MT_QUIRK_ALWAYS_VALID | MT_QUIRK_CONTACT_CNT_ACCURATE |@@ -963,7 +964,7 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_ATMEL_MXT_DIGITIZER) },/* Baanto multitouch devices */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_BAANTO , USB_DEVICE_ID_BAANTO_MT_190W2) },/* Cando panels */ @@ -981,12 +982,12 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) },/* Chunghwa Telecom touch panels */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_CHUNGHWAT , USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) }, /* CVTouch panels */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_CVTOUCH , USB_DEVICE_ID_CVTOUCH_SCREEN) },@@ -1075,12 +1076,12 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PWT_TENFINGERS) },/* Gametel game controller */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_BT_DEVICE (USB_VENDOR_ID_FRUCTEL , USB_DEVICE_ID_GAMETEL_MT_MODE) }, /* GoodTouch panels */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_GOODTOUCH , USB_DEVICE_ID_GOODTOUCH_000f) },@@ -1098,7 +1099,7 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_IDEACOM_IDC6651) },/* Ilitek dual touch panel */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_ILITEK , USB_DEVICE_ID_ILITEK_MULTITOUCH) },@@ -1145,7 +1146,7 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_PANABOARD_UBT880) },/* Novatek Panel */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_NOVATEK , USB_DEVICE_ID_NOVATEK_PCT) },@@ -1185,13 +1186,13 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008) },/* Stantum panels */ - { .driver_data = MT_CLS_ALWAYS_TRUE, + { .driver_data = MT_CLS_DEFAULT,MT_USB_DEVICE (USB_VENDOR_ID_STANTUM , USB_DEVICE_ID_MTP)}, { .driver_data = MT_CLS_CONFIDENCE,MT_USB_DEVICE (USB_VENDOR_ID_STANTUM_STM , USB_DEVICE_ID_MTP_STM)}, - { .driver_data = MT_CLS_ALWAYS_TRUE, + { .driver_data = MT_CLS_DEFAULT,MT_USB_DEVICE (USB_VENDOR_ID_STANTUM_SITRONIX , USB_DEVICE_ID_MTP_SITRONIX)},@@ -1201,48 +1202,48 @@ static const struct hid_device_id mt_devices[] = { USB_DEVICE_ID_TOPSEED2_PERIPAD_701) },/* Touch International panels */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_TOUCH_INTL , USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH) }, /* Unitec panels */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_UNITEC , USB_DEVICE_ID_UNITEC_USB_TOUCH_0709) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_UNITEC , USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) }, /* XAT */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XAT , USB_DEVICE_ID_XAT_CSR) }, /* Xiroku */ - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_SPX) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_MPX) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_CSR) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_SPX1) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_MPX1) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_CSR1) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_SPX2) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_MPX2) }, - { .driver_data = MT_CLS_DEFAULT, + { .driver_data = MT_CLS_NSMU,MT_USB_DEVICE (USB_VENDOR_ID_XIROKU , USB_DEVICE_ID_XIROKU_CSR2) }, --Quoted 2 lines
1.8.1
Thanks,
Henrik
Hi Benjamin,
Quoted 5 lines
finally, I managed to send a new bunch of patches. Sorry for the delay from the previous version, but meanwhile, I implemented an automatic regressions tests for hid device [1].
So this series seems pretty big, but it does not break any known devices (I ran 40 successful tests for this series)[2].
Thanks for the patches.
Quoted 4 lines
To sum up:
- Nexio devices were problematic in the sense they use out of range values for some of the fields, and consider that the driver won't treat the extra touches based on the reported contact count.
Problematic device, but I think we should add a new event function which gives all values at the same time, since those are already present in the core. It seems this will solve the current problem as well as many older workarounds.
Quoted 3 lines
- fortunately, this behavior (relying on contact count) is compatible with all the devices I know, which leads to think that this is how the Windows 7/8 driver manage to handle such a different bunch of devices.
This is a nice observation. IIRC, we used to rely more on contact count in the old drivers.
Quoted 4 lines
- thanks to the automatic testing, I was able to fix broken devices (Sharp LC-20FE1-W screen 04dd:9681, Sitronix 1403:5001 and Cando 2087:0a02) and optimize many others. In order to allow a bisection to be done, I split the patches in many different ones, one per device type.
Great tool, thank you Benjamin.
Quoted 2 lines
- finally, I changed the default class in order to handle the new devices in a better way.
Old wisdom says differently. ;-)
Thanks,
Henrik
Hi Henrik,
Quoted 9 lines · Henrik Rydberg
Hi Benjamin,
Quoted 5 lines
finally, I managed to send a new bunch of patches. Sorry for the delay from the previous version, but meanwhile, I implemented an automatic regressions tests for hid device [1].
So this series seems pretty big, but it does not break any known devices (I ran 40 successful tests for this series)[2].Thanks for the patches.
And thanks for reviewing.
Quoted 10 lines
Quoted 5 lines
To sum up:
- Nexio devices were problematic in the sense they use out of range values for some of the fields, and consider that the driver won't treat the extra touches based on the reported contact count.Problematic device, but I think we should add a new event function which gives all values at the same time, since those are already present in the core. It seems this will solve the current problem as well as many older workarounds.
yeah, makes sense. I think it would also allows us to simplify the logic of hid-multitouch by removing some of the states we have in it.
Quoted 8 lines
Quoted 4 lines
- fortunately, this behavior (relying on contact count) is compatible with all the devices I know, which leads to think that this is how the Windows 7/8 driver manage to handle such a different bunch of devices.
This is a nice observation. IIRC, we used to rely more on contact count in the old drivers.
Quoted 6 lines
Quoted 4 lines
- thanks to the automatic testing, I was able to fix broken devices (Sharp LC-20FE1-W screen 04dd:9681, Sitronix 1403:5001 and Cando 2087:0a02) and optimize many others. In order to allow a bisection to be done, I split the patches in many different ones, one per device type.
Great tool, thank you Benjamin.
Once I will do the work on the suppression of usbhid direct use, we also could rely on that for every HID devices, not only hid-multitouch.
Quoted 5 lines
Quoted 3 lines
- finally, I changed the default class in order to handle the new devices in a better way.
Old wisdom says differently. ;-)
No: old wisdom says the exact same thing :) I did not break the current supported devices. I _kept_ the old default class for all the current supported devices, and I used the new default class only for the new devices, the one that are not registered.
Cheers,
Benjamin
Quoted 3 lines
Thanks,
Henrik