diff options
author | Benjamin Tissoires <benjamin.tissoires@enac.fr> | 2012-03-06 11:57:06 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2012-03-12 07:50:27 -0400 |
commit | 9e87f22ac6353b50425c5da412fe2418a48e25a3 (patch) | |
tree | 57e1b4547e8b97357af7d6335b0fec485382e795 /drivers/hid | |
parent | 8d179a9ef25a64b451e2bbd46f6a6c16c6a72eb1 (diff) |
HID: multitouch: detect serial protocol
Microsoft's documentation about multitouch protocols tells that
if a device presents one touch per report, then it should be treated
as a serial protocol.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-multitouch.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index a61ba42e1bff..6fb46d70f39d 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c | |||
@@ -81,6 +81,9 @@ struct mt_device { | |||
81 | __u8 num_received; /* how many contacts we received */ | 81 | __u8 num_received; /* how many contacts we received */ |
82 | __u8 num_expected; /* expected last contact index */ | 82 | __u8 num_expected; /* expected last contact index */ |
83 | __u8 maxcontacts; | 83 | __u8 maxcontacts; |
84 | __u8 touches_by_report; /* how many touches are present in one report: | ||
85 | * 1 means we should use a serial protocol | ||
86 | * > 1 means hybrid (multitouch) protocol */ | ||
84 | bool curvalid; /* is the current contact valid? */ | 87 | bool curvalid; /* is the current contact valid? */ |
85 | struct mt_slot *slots; | 88 | struct mt_slot *slots; |
86 | }; | 89 | }; |
@@ -365,6 +368,7 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
365 | input_mt_init_slots(hi->input, td->maxcontacts); | 368 | input_mt_init_slots(hi->input, td->maxcontacts); |
366 | td->last_slot_field = usage->hid; | 369 | td->last_slot_field = usage->hid; |
367 | td->last_field_index = field->index; | 370 | td->last_field_index = field->index; |
371 | td->touches_by_report++; | ||
368 | return 1; | 372 | return 1; |
369 | case HID_DG_WIDTH: | 373 | case HID_DG_WIDTH: |
370 | hid_map_usage(hi, usage, bit, max, | 374 | hid_map_usage(hi, usage, bit, max, |
@@ -670,6 +674,15 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
670 | if (ret) | 674 | if (ret) |
671 | goto fail; | 675 | goto fail; |
672 | 676 | ||
677 | if (!id && td->touches_by_report == 1) { | ||
678 | /* the device has been sent by hid-generic */ | ||
679 | mtclass = &td->mtclass; | ||
680 | mtclass->quirks |= MT_QUIRK_ALWAYS_VALID; | ||
681 | mtclass->quirks &= ~MT_QUIRK_NOT_SEEN_MEANS_UP; | ||
682 | mtclass->quirks &= ~MT_QUIRK_VALID_IS_INRANGE; | ||
683 | mtclass->quirks &= ~MT_QUIRK_VALID_IS_CONFIDENCE; | ||
684 | } | ||
685 | |||
673 | td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot), | 686 | td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot), |
674 | GFP_KERNEL); | 687 | GFP_KERNEL); |
675 | if (!td->slots) { | 688 | if (!td->slots) { |