Skip to content

Commit

Permalink
HID: multitouch: add MT_QUIRK_IGNORE_DUPLICATES
Browse files Browse the repository at this point in the history
This quirk allows a device to reuse a contact id when sending garbage
inactive contacts at the end of a report.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Benjamin Tissoires authored and Jiri Kosina committed Nov 15, 2012
1 parent 29807d1 commit 2872839
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/hid/hid-multitouch.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ MODULE_LICENSE("GPL");
#define MT_QUIRK_VALID_IS_CONFIDENCE (1 << 6)
#define MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE (1 << 8)
#define MT_QUIRK_NO_AREA (1 << 9)
#define MT_QUIRK_IGNORE_DUPLICATES (1 << 10)

struct mt_slot {
__s32 x, y, cx, cy, p, w, h;
Expand Down Expand Up @@ -505,10 +506,18 @@ static void mt_complete_slot(struct mt_device *td, struct input_dev *input)
if (td->curvalid || (td->mtclass.quirks & MT_QUIRK_ALWAYS_VALID)) {
int slotnum = mt_compute_slot(td, input);
struct mt_slot *s = &td->curdata;
struct input_mt *mt = input->mt;

if (slotnum < 0 || slotnum >= td->maxcontacts)
return;

if ((td->mtclass.quirks & MT_QUIRK_IGNORE_DUPLICATES) && mt) {
struct input_mt_slot *slot = &mt->slots[slotnum];
if (input_mt_is_active(slot) &&
input_mt_is_used(mt, slot))
return;
}

input_mt_slot(input, slotnum);
input_mt_report_slot_state(input, MT_TOOL_FINGER,
s->touch_state);
Expand Down

0 comments on commit 2872839

Please sign in to comment.