Skip to content

Commit afbcb04

Browse files
bentissJiri Kosina
authored andcommitted
HID: multitouch: get maxcontacts also from logical_max value
Win8 devices are required to present the feature "Maximum Contact Number". Fortunately all win7 devices I've seen presents this feature. If the current value is 0, then, the driver can get the actual supported contact count by refering to the logical_max. This win8 specification ensures that logical_max may not be above 250. This also allows us to detect when devices like irtouch or stantum reports an obviously wrong value of 255. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Acked-by: Henrik Rydberg <rydberg@euromail.se> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent 54f4c0c commit afbcb04

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎drivers/hid/hid-multitouch.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ struct mt_device {
121121
#define MT_CLS_GENERALTOUCH_PWT_TENFINGERS 0x0109
122122

123123
#define MT_DEFAULT_MAXCONTACT 10
124+
#define MT_MAX_MAXCONTACT 250
124125

125126
#define MT_USB_DEVICE(v, p) HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH, v, p)
126127
#define MT_BT_DEVICE(v, p) HID_DEVICE(BUS_BLUETOOTH, HID_GROUP_MULTITOUCH, v, p)
@@ -282,6 +283,9 @@ static void mt_feature_mapping(struct hid_device *hdev,
282283
case HID_DG_CONTACTMAX:
283284
td->maxcontact_report_id = field->report->id;
284285
td->maxcontacts = field->value[0];
286+
if (!td->maxcontacts &&
287+
field->logical_maximum <= MT_MAX_MAXCONTACT)
288+
td->maxcontacts = field->logical_maximum;
285289
if (td->mtclass.maxcontacts)
286290
/* check if the maxcontacts is given by the class */
287291
td->maxcontacts = td->mtclass.maxcontacts;

0 commit comments

Comments
 (0)