diff options
Diffstat (limited to 'drivers/hid/hid-multitouch.c')
| -rw-r--r-- | drivers/hid/hid-multitouch.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index c741f5e50a66..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 | ||
| 83 | struct mt_class { | 85 | struct 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; |
| @@ -1401,6 +1408,11 @@ static const struct hid_device_id mt_devices[] = { | |||
| 1401 | MT_USB_DEVICE(USB_VENDOR_ID_NOVATEK, | 1408 | MT_USB_DEVICE(USB_VENDOR_ID_NOVATEK, |
| 1402 | USB_DEVICE_ID_NOVATEK_PCT) }, | 1409 | USB_DEVICE_ID_NOVATEK_PCT) }, |
| 1403 | 1410 | ||
| 1411 | /* Ntrig Panel */ | ||
| 1412 | { .driver_data = MT_CLS_NSMU, | ||
| 1413 | HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, | ||
| 1414 | USB_VENDOR_ID_NTRIG, 0x1b05) }, | ||
| 1415 | |||
| 1404 | /* PixArt optical touch screen */ | 1416 | /* PixArt optical touch screen */ |
| 1405 | { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER, | 1417 | { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER, |
| 1406 | MT_USB_DEVICE(USB_VENDOR_ID_PIXART, | 1418 | MT_USB_DEVICE(USB_VENDOR_ID_PIXART, |
