aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-multitouch.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid/hid-multitouch.c')
-rw-r--r--drivers/hid/hid-multitouch.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 95b7d61d9910..fb6f1f447279 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -61,6 +61,7 @@ MODULE_LICENSE("GPL");
61#define MT_QUIRK_ALWAYS_VALID (1 << 4) 61#define MT_QUIRK_ALWAYS_VALID (1 << 4)
62#define MT_QUIRK_VALID_IS_INRANGE (1 << 5) 62#define MT_QUIRK_VALID_IS_INRANGE (1 << 5)
63#define MT_QUIRK_VALID_IS_CONFIDENCE (1 << 6) 63#define MT_QUIRK_VALID_IS_CONFIDENCE (1 << 6)
64#define MT_QUIRK_CONFIDENCE (1 << 7)
64#define MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE (1 << 8) 65#define MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE (1 << 8)
65#define MT_QUIRK_NO_AREA (1 << 9) 66#define MT_QUIRK_NO_AREA (1 << 9)
66#define MT_QUIRK_IGNORE_DUPLICATES (1 << 10) 67#define MT_QUIRK_IGNORE_DUPLICATES (1 << 10)
@@ -78,6 +79,7 @@ struct mt_slot {
78 __s32 contactid; /* the device ContactID assigned to this slot */ 79 __s32 contactid; /* the device ContactID assigned to this slot */
79 bool touch_state; /* is the touch valid? */ 80 bool touch_state; /* is the touch valid? */
80 bool inrange_state; /* is the finger in proximity of the sensor? */ 81 bool inrange_state; /* is the finger in proximity of the sensor? */
82 bool confidence_state; /* is the touch made by a finger? */
81}; 83};
82 84
83struct mt_class { 85struct mt_class {
@@ -503,10 +505,8 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
503 return 1; 505 return 1;
504 case HID_DG_CONFIDENCE: 506 case HID_DG_CONFIDENCE:
505 if (cls->name == MT_CLS_WIN_8 && 507 if (cls->name == MT_CLS_WIN_8 &&
506 field->application == HID_DG_TOUCHPAD) { 508 field->application == HID_DG_TOUCHPAD)
507 cls->quirks &= ~MT_QUIRK_ALWAYS_VALID; 509 cls->quirks |= MT_QUIRK_CONFIDENCE;
508 cls->quirks |= MT_QUIRK_VALID_IS_CONFIDENCE;
509 }
510 mt_store_field(usage, td, hi); 510 mt_store_field(usage, td, hi);
511 return 1; 511 return 1;
512 case HID_DG_TIPSWITCH: 512 case HID_DG_TIPSWITCH:
@@ -619,6 +619,7 @@ static void mt_complete_slot(struct mt_device *td, struct input_dev *input)
619 return; 619 return;
620 620
621 if (td->curvalid || (td->mtclass.quirks & MT_QUIRK_ALWAYS_VALID)) { 621 if (td->curvalid || (td->mtclass.quirks & MT_QUIRK_ALWAYS_VALID)) {
622 int active;
622 int slotnum = mt_compute_slot(td, input); 623 int slotnum = mt_compute_slot(td, input);
623 struct mt_slot *s = &td->curdata; 624 struct mt_slot *s = &td->curdata;
624 struct input_mt *mt = input->mt; 625 struct input_mt *mt = input->mt;
@@ -633,10 +634,14 @@ static void mt_complete_slot(struct mt_device *td, struct input_dev *input)
633 return; 634 return;
634 } 635 }
635 636
637 if (!(td->mtclass.quirks & MT_QUIRK_CONFIDENCE))
638 s->confidence_state = 1;
639 active = (s->touch_state || s->inrange_state) &&
640 s->confidence_state;
641
636 input_mt_slot(input, slotnum); 642 input_mt_slot(input, slotnum);
637 input_mt_report_slot_state(input, MT_TOOL_FINGER, 643 input_mt_report_slot_state(input, MT_TOOL_FINGER, active);
638 s->touch_state || s->inrange_state); 644 if (active) {
639 if (s->touch_state || s->inrange_state) {
640 /* this finger is in proximity of the sensor */ 645 /* this finger is in proximity of the sensor */
641 int wide = (s->w > s->h); 646 int wide = (s->w > s->h);
642 /* divided by two to match visual scale of touch */ 647 /* divided by two to match visual scale of touch */
@@ -701,6 +706,8 @@ static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field,
701 td->curdata.touch_state = value; 706 td->curdata.touch_state = value;
702 break; 707 break;
703 case HID_DG_CONFIDENCE: 708 case HID_DG_CONFIDENCE:
709 if (quirks & MT_QUIRK_CONFIDENCE)
710 td->curdata.confidence_state = value;
704 if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE) 711 if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE)
705 td->curvalid = value; 712 td->curvalid = value;
706 break; 713 break;