All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] Make sure touch arbitration is applied consistently across devices
@ 2015-01-28 17:42 Ping Cheng
  2015-01-29 13:06 ` Jiri Kosina
  0 siblings, 1 reply; 4+ messages in thread
From: Ping Cheng @ 2015-01-28 17:42 UTC (permalink / raw)
  To: jkosina; +Cc: linux-input, Ping Cheng

stylus_in_proximity is used to make sure no touch event is sent while pen
is in proximity. touch_down is used to make sure a touch up event is sent
when pen comes into proximity while touch is down.

Two touch routines didn't store touch_down. One touch routine forgot to
check stylus_in_proximity before sending touch events. This patch fixes
those issues.

Signed-off-by: Ping Cheng <pingc@wacom.com>
---
v2: added commit comments as reqested by Jiri. No code update.
---
 drivers/hid/wacom_wac.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index f886149..6d490f6 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -1042,7 +1042,7 @@ static int wacom_24hdt_irq(struct wacom_wac *wacom)
 
 	for (i = 0; i < contacts_to_send; i++) {
 		int offset = (WACOM_BYTES_PER_24HDT_PACKET * i) + 1;
-		bool touch = data[offset] & 0x1 && !wacom->shared->stylus_in_proximity;
+		bool touch = (data[offset] & 0x1) && !wacom->shared->stylus_in_proximity;
 		int slot = input_mt_get_slot_by_key(input, data[offset + 1]);
 
 		if (slot < 0)
@@ -1072,6 +1072,7 @@ static int wacom_24hdt_irq(struct wacom_wac *wacom)
 	if (wacom->num_contacts_left <= 0)
 		wacom->num_contacts_left = 0;
 
+	wacom->shared->touch_down = (wacom->num_contacts_left > 0);
 	return 1;
 }
 
@@ -1100,7 +1101,7 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
 
 	for (i = 0; i < contacts_to_send; i++) {
 		int offset = (WACOM_BYTES_PER_MT_PACKET + x_offset) * i + 3;
-		bool touch = data[offset] & 0x1;
+		bool touch = (data[offset] & 0x1) && !wacom->shared->stylus_in_proximity;
 		int id = get_unaligned_le16(&data[offset + 1]);
 		int slot = input_mt_get_slot_by_key(input, id);
 
@@ -1122,6 +1123,7 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
 	if (wacom->num_contacts_left < 0)
 		wacom->num_contacts_left = 0;
 
+	wacom->shared->touch_down = (wacom->num_contacts_left > 0);
 	return 1;
 }
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] Make sure touch arbitration is applied consistently across devices
  2015-01-28 17:42 [PATCH 1/3] Make sure touch arbitration is applied consistently across devices Ping Cheng
@ 2015-01-29 13:06 ` Jiri Kosina
  0 siblings, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2015-01-29 13:06 UTC (permalink / raw)
  To: Ping Cheng; +Cc: linux-input, Ping Cheng

On Wed, 28 Jan 2015, Ping Cheng wrote:

> stylus_in_proximity is used to make sure no touch event is sent while pen
> is in proximity. touch_down is used to make sure a touch up event is sent
> when pen comes into proximity while touch is down.
> 
> Two touch routines didn't store touch_down. One touch routine forgot to
> check stylus_in_proximity before sending touch events. This patch fixes
> those issues.
> 
> Signed-off-by: Ping Cheng <pingc@wacom.com>
> ---
> v2: added commit comments as reqested by Jiri. No code update.

Thanks. I've applied all 3 patches.

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] Make sure touch arbitration is applied consistently across devices
  2015-01-27 21:29 Ping Cheng
@ 2015-01-28 13:31 ` Jiri Kosina
  0 siblings, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2015-01-28 13:31 UTC (permalink / raw)
  To: Ping Cheng; +Cc: linux-input, benjamin.tissoires, Ping Cheng

On Tue, 27 Jan 2015, Ping Cheng wrote:

> Signed-off-by: Ping Cheng <pingc@wacom.com>

Ping, please supply a changelog explaining even a simple and "obvious" 
changes (which actually is not even the case here).

Thanks.

> ---
>  drivers/hid/wacom_wac.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
> index f886149..6d490f6 100644
> --- a/drivers/hid/wacom_wac.c
> +++ b/drivers/hid/wacom_wac.c
> @@ -1042,7 +1042,7 @@ static int wacom_24hdt_irq(struct wacom_wac *wacom)
>  
>  	for (i = 0; i < contacts_to_send; i++) {
>  		int offset = (WACOM_BYTES_PER_24HDT_PACKET * i) + 1;
> -		bool touch = data[offset] & 0x1 && !wacom->shared->stylus_in_proximity;
> +		bool touch = (data[offset] & 0x1) && !wacom->shared->stylus_in_proximity;
>  		int slot = input_mt_get_slot_by_key(input, data[offset + 1]);
>  
>  		if (slot < 0)
> @@ -1072,6 +1072,7 @@ static int wacom_24hdt_irq(struct wacom_wac *wacom)
>  	if (wacom->num_contacts_left <= 0)
>  		wacom->num_contacts_left = 0;
>  
> +	wacom->shared->touch_down = (wacom->num_contacts_left > 0);
>  	return 1;
>  }
>  
> @@ -1100,7 +1101,7 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
>  
>  	for (i = 0; i < contacts_to_send; i++) {
>  		int offset = (WACOM_BYTES_PER_MT_PACKET + x_offset) * i + 3;
> -		bool touch = data[offset] & 0x1;
> +		bool touch = (data[offset] & 0x1) && !wacom->shared->stylus_in_proximity;
>  		int id = get_unaligned_le16(&data[offset + 1]);
>  		int slot = input_mt_get_slot_by_key(input, id);
>  
> @@ -1122,6 +1123,7 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
>  	if (wacom->num_contacts_left < 0)
>  		wacom->num_contacts_left = 0;
>  
> +	wacom->shared->touch_down = (wacom->num_contacts_left > 0);
>  	return 1;
>  }

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] Make sure touch arbitration is applied consistently across devices
@ 2015-01-27 21:29 Ping Cheng
  2015-01-28 13:31 ` Jiri Kosina
  0 siblings, 1 reply; 4+ messages in thread
From: Ping Cheng @ 2015-01-27 21:29 UTC (permalink / raw)
  To: jkosina; +Cc: linux-input, benjamin.tissoires, Ping Cheng

Signed-off-by: Ping Cheng <pingc@wacom.com>
---
 drivers/hid/wacom_wac.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index f886149..6d490f6 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -1042,7 +1042,7 @@ static int wacom_24hdt_irq(struct wacom_wac *wacom)
 
 	for (i = 0; i < contacts_to_send; i++) {
 		int offset = (WACOM_BYTES_PER_24HDT_PACKET * i) + 1;
-		bool touch = data[offset] & 0x1 && !wacom->shared->stylus_in_proximity;
+		bool touch = (data[offset] & 0x1) && !wacom->shared->stylus_in_proximity;
 		int slot = input_mt_get_slot_by_key(input, data[offset + 1]);
 
 		if (slot < 0)
@@ -1072,6 +1072,7 @@ static int wacom_24hdt_irq(struct wacom_wac *wacom)
 	if (wacom->num_contacts_left <= 0)
 		wacom->num_contacts_left = 0;
 
+	wacom->shared->touch_down = (wacom->num_contacts_left > 0);
 	return 1;
 }
 
@@ -1100,7 +1101,7 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
 
 	for (i = 0; i < contacts_to_send; i++) {
 		int offset = (WACOM_BYTES_PER_MT_PACKET + x_offset) * i + 3;
-		bool touch = data[offset] & 0x1;
+		bool touch = (data[offset] & 0x1) && !wacom->shared->stylus_in_proximity;
 		int id = get_unaligned_le16(&data[offset + 1]);
 		int slot = input_mt_get_slot_by_key(input, id);
 
@@ -1122,6 +1123,7 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
 	if (wacom->num_contacts_left < 0)
 		wacom->num_contacts_left = 0;
 
+	wacom->shared->touch_down = (wacom->num_contacts_left > 0);
 	return 1;
 }
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-29 13:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-28 17:42 [PATCH 1/3] Make sure touch arbitration is applied consistently across devices Ping Cheng
2015-01-29 13:06 ` Jiri Kosina
  -- strict thread matches above, loose matches on Subject: below --
2015-01-27 21:29 Ping Cheng
2015-01-28 13:31 ` Jiri Kosina

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.