diff options
author | Ping Cheng <pinglinux@gmail.com> | 2015-01-09 14:05:13 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2015-01-12 04:16:32 -0500 |
commit | b3bd7ef397a6031f5398c76a9a0b0695a38f6587 (patch) | |
tree | 107de1438ea1f9ed8148c8cdce52419270e89863 /drivers/hid/wacom_wac.c | |
parent | 373a5356dfb75ea7140f8d37cf26eb6a62910617 (diff) |
HID: wacom: peport In Range event according to the spec
Some Cintiq and Intuos tablets report In Range event. This event is sent before
valid data is reported when tool enters proximity; or before out of proximity
event is reported when tool exits.
While entering proximity, In Range means a pen is detected. This information
can be used for palm/touch rejection on both pen and touch enabled devices.
While exiting, it means the tool has reached its maximum detectable distance.
Signed-off-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/wacom_wac.c')
-rw-r--r-- | drivers/hid/wacom_wac.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 527668913a26..a4ba8caa2456 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c | |||
@@ -443,9 +443,6 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) | |||
443 | 443 | ||
444 | /* Enter report */ | 444 | /* Enter report */ |
445 | if ((data[1] & 0xfc) == 0xc0) { | 445 | if ((data[1] & 0xfc) == 0xc0) { |
446 | if (features->quirks & WACOM_QUIRK_MULTI_INPUT) | ||
447 | wacom->shared->stylus_in_proximity = true; | ||
448 | |||
449 | /* serial number of the tool */ | 446 | /* serial number of the tool */ |
450 | wacom->serial[idx] = ((data[3] & 0x0f) << 28) + | 447 | wacom->serial[idx] = ((data[3] & 0x0f) << 28) + |
451 | (data[4] << 20) + (data[5] << 12) + | 448 | (data[4] << 20) + (data[5] << 12) + |
@@ -554,19 +551,22 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) | |||
554 | (features->type == CINTIQ && !(data[1] & 0x40))) | 551 | (features->type == CINTIQ && !(data[1] & 0x40))) |
555 | return 1; | 552 | return 1; |
556 | 553 | ||
557 | /* Range Report */ | 554 | if (features->quirks & WACOM_QUIRK_MULTI_INPUT) |
558 | if ((data[1] & 0xfe) == 0x20) { | 555 | wacom->shared->stylus_in_proximity = true; |
556 | |||
557 | /* in Range while exiting */ | ||
558 | if (((data[1] & 0xfe) == 0x20) && wacom->reporting_data) { | ||
559 | input_report_key(input, BTN_TOUCH, 0); | 559 | input_report_key(input, BTN_TOUCH, 0); |
560 | input_report_abs(input, ABS_PRESSURE, 0); | 560 | input_report_abs(input, ABS_PRESSURE, 0); |
561 | input_report_abs(input, ABS_DISTANCE, wacom->features.distance_max); | 561 | input_report_abs(input, ABS_DISTANCE, wacom->features.distance_max); |
562 | if (features->quirks & WACOM_QUIRK_MULTI_INPUT) | 562 | return 2; |
563 | wacom->shared->stylus_in_proximity = true; | ||
564 | } | 563 | } |
565 | 564 | ||
566 | /* Exit report */ | 565 | /* Exit report */ |
567 | if ((data[1] & 0xfe) == 0x80) { | 566 | if ((data[1] & 0xfe) == 0x80) { |
568 | if (features->quirks & WACOM_QUIRK_MULTI_INPUT) | 567 | if (features->quirks & WACOM_QUIRK_MULTI_INPUT) |
569 | wacom->shared->stylus_in_proximity = false; | 568 | wacom->shared->stylus_in_proximity = false; |
569 | wacom->reporting_data = false; | ||
570 | 570 | ||
571 | /* don't report exit if we don't know the ID */ | 571 | /* don't report exit if we don't know the ID */ |
572 | if (!wacom->id[idx]) | 572 | if (!wacom->id[idx]) |
@@ -952,6 +952,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) | |||
952 | input_report_abs(input, ABS_MISC, wacom->id[idx]); /* report tool id */ | 952 | input_report_abs(input, ABS_MISC, wacom->id[idx]); /* report tool id */ |
953 | input_report_key(input, wacom->tool[idx], 1); | 953 | input_report_key(input, wacom->tool[idx], 1); |
954 | input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]); | 954 | input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]); |
955 | wacom->reporting_data = true; | ||
955 | return 1; | 956 | return 1; |
956 | } | 957 | } |
957 | 958 | ||