aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-multitouch.c
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@gmail.com>2012-11-14 10:59:18 -0500
committerJiri Kosina <jkosina@suse.cz>2012-11-15 04:08:56 -0500
commitafbcb04c181f36634f4af207bb0c9cc46b7405e4 (patch)
tree1d41dd184948bc2c940a9b38fdf62add230d2b1f /drivers/hid/hid-multitouch.c
parent54f4c0c3e9d9ad50bf58a4f7c2bbdfb3fa4ab3a7 (diff)
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>
Diffstat (limited to 'drivers/hid/hid-multitouch.c')
-rw-r--r--drivers/hid/hid-multitouch.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 3d2e6bbb004..9c7415ff4aa 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -121,6 +121,7 @@ struct mt_device {
121#define MT_CLS_GENERALTOUCH_PWT_TENFINGERS 0x0109 121#define MT_CLS_GENERALTOUCH_PWT_TENFINGERS 0x0109
122 122
123#define MT_DEFAULT_MAXCONTACT 10 123#define MT_DEFAULT_MAXCONTACT 10
124#define MT_MAX_MAXCONTACT 250
124 125
125#define MT_USB_DEVICE(v, p) HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH, v, p) 126#define MT_USB_DEVICE(v, p) HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH, v, p)
126#define MT_BT_DEVICE(v, p) HID_DEVICE(BUS_BLUETOOTH, HID_GROUP_MULTITOUCH, v, p) 127#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,
282 case HID_DG_CONTACTMAX: 283 case HID_DG_CONTACTMAX:
283 td->maxcontact_report_id = field->report->id; 284 td->maxcontact_report_id = field->report->id;
284 td->maxcontacts = field->value[0]; 285 td->maxcontacts = field->value[0];
286 if (!td->maxcontacts &&
287 field->logical_maximum <= MT_MAX_MAXCONTACT)
288 td->maxcontacts = field->logical_maximum;
285 if (td->mtclass.maxcontacts) 289 if (td->mtclass.maxcontacts)
286 /* check if the maxcontacts is given by the class */ 290 /* check if the maxcontacts is given by the class */
287 td->maxcontacts = td->mtclass.maxcontacts; 291 td->maxcontacts = td->mtclass.maxcontacts;