linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] Input: cypress_ps2 - Return zero finger count if palm is detected.
       [not found] <cover.1379968154.git.joseph.salisbury@canonical.com>
@ 2013-09-24 15:44 ` Joseph Salisbury
  2013-09-30 20:12   ` Kamal Mostafa
  0 siblings, 1 reply; 4+ messages in thread
From: Joseph Salisbury @ 2013-09-24 15:44 UTC (permalink / raw)
  To: linux-kernel
  Cc: dmitry.torokhov, rydberg, kamal, dudl, git, tim.gardner,
	linux-input, stable

BugLink: http://bugs.launchpad.net/bugs/1229361

This patch sets the finger count to 0 in the case of palm contact.

Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> (maintainer:INPUT (KEYBOARD,...,commit_signer:2/2=100%)
Cc: Henrik Rydberg <rydberg@euromail.se> (maintainer:INPUT MULTITOUCH...)
Cc: Kamal Mostafa <kamal@canonical.com> (commit_signer:2/2=100%)
Cc: Dudley Du <dudl@cypress.com> (commit_signer:2/2=100%)
Cc: Kyle Fazzari <git@status.e4ward.com> (commit_signer:1/2=50%)
Cc: Tim Gardner <tim.gardner@canonical.com> (commit_signer:1/2=50%)
Cc: linux-input@vger.kernel.org (open list:INPUT (KEYBOARD,...)
Cc: linux-kernel@vger.kernel.org (open list)
Cc: stable@vger.kernel.org

---
 drivers/input/mouse/cypress_ps2.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
index 45b3eda..95b2c40 100644
--- a/drivers/input/mouse/cypress_ps2.c
+++ b/drivers/input/mouse/cypress_ps2.c
@@ -441,7 +441,7 @@ static int cypress_get_finger_count(unsigned char header_byte)
 			case 2: return 5;
 			default:
 				/* Invalid contact (e.g. palm). Ignore it. */
-				return -1;
+				return 0;
 		}
 	}
 
@@ -460,7 +460,7 @@ static int cypress_parse_packet(struct psmouse *psmouse,
 
 	contact_cnt = cypress_get_finger_count(header_byte);
 
-	if (contact_cnt < 0) /* e.g. palm detect */
+	if (contact_cnt < 0)
 		return -EINVAL;
 
 	report_data->contact_cnt = contact_cnt;
-- 
1.7.9.5

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

* Re: [PATCH 1/1] Input: cypress_ps2 - Return zero finger count if palm is detected.
  2013-09-24 15:44 ` [PATCH 1/1] Input: cypress_ps2 - Return zero finger count if palm is detected Joseph Salisbury
@ 2013-09-30 20:12   ` Kamal Mostafa
  2013-10-11 16:30     ` [PATCH 1/1][Resend] " Joseph Salisbury
  0 siblings, 1 reply; 4+ messages in thread
From: Kamal Mostafa @ 2013-09-30 20:12 UTC (permalink / raw)
  To: Joseph Salisbury
  Cc: linux-kernel, dmitry.torokhov, rydberg, dudl, git, tim.gardner,
	linux-input

[-- Attachment #1: Type: text/plain, Size: 1862 bytes --]

On Tue, 2013-09-24 at 11:44 -0400, Joseph Salisbury wrote:
> BugLink: http://bugs.launchpad.net/bugs/1229361
> 
> This patch sets the finger count to 0 in the case of palm contact.
> 
> Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> (maintainer:INPUT (KEYBOARD,...,commit_signer:2/2=100%)
> Cc: Henrik Rydberg <rydberg@euromail.se> (maintainer:INPUT MULTITOUCH...)
> Cc: Kamal Mostafa <kamal@canonical.com> (commit_signer:2/2=100%)
> Cc: Dudley Du <dudl@cypress.com> (commit_signer:2/2=100%)
> Cc: Kyle Fazzari <git@status.e4ward.com> (commit_signer:1/2=50%)
> Cc: Tim Gardner <tim.gardner@canonical.com> (commit_signer:1/2=50%)
> Cc: linux-input@vger.kernel.org (open list:INPUT (KEYBOARD,...)
> Cc: linux-kernel@vger.kernel.org (open list)
> Cc: stable@vger.kernel.org

This patch works fine: eliminates stream of junk driver messages with no
ill effects.

Tested-by: Kamal Mostafa <kamal@canonical.com>

 -Kamal


> ---
>  drivers/input/mouse/cypress_ps2.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
> index 45b3eda..95b2c40 100644
> --- a/drivers/input/mouse/cypress_ps2.c
> +++ b/drivers/input/mouse/cypress_ps2.c
> @@ -441,7 +441,7 @@ static int cypress_get_finger_count(unsigned char header_byte)
>  			case 2: return 5;
>  			default:
>  				/* Invalid contact (e.g. palm). Ignore it. */
> -				return -1;
> +				return 0;
>  		}
>  	}
>  
> @@ -460,7 +460,7 @@ static int cypress_parse_packet(struct psmouse *psmouse,
>  
>  	contact_cnt = cypress_get_finger_count(header_byte);
>  
> -	if (contact_cnt < 0) /* e.g. palm detect */
> +	if (contact_cnt < 0)
>  		return -EINVAL;
>  
>  	report_data->contact_cnt = contact_cnt;


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* [PATCH 1/1][Resend] Input: cypress_ps2 - Return zero finger count if palm is detected.
  2013-09-30 20:12   ` Kamal Mostafa
@ 2013-10-11 16:30     ` Joseph Salisbury
  2013-10-16 18:35       ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Joseph Salisbury @ 2013-10-11 16:30 UTC (permalink / raw)
  To: dmitry.torokhov, rydberg
  Cc: Kamal Mostafa, linux-kernel, dudl, git, tim.gardner, linux-input

On 09/30/2013 04:12 PM, Kamal Mostafa wrote:
> On Tue, 2013-09-24 at 11:44 -0400, Joseph Salisbury wrote:
>> BugLink: http://bugs.launchpad.net/bugs/1229361
>>
>> This patch sets the finger count to 0 in the case of palm contact.
>>
>> Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
>> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> (maintainer:INPUT (KEYBOARD,...,commit_signer:2/2=100%)
>> Cc: Henrik Rydberg <rydberg@euromail.se> (maintainer:INPUT MULTITOUCH...)
>> Cc: Kamal Mostafa <kamal@canonical.com> (commit_signer:2/2=100%)
>> Cc: Dudley Du <dudl@cypress.com> (commit_signer:2/2=100%)
>> Cc: Kyle Fazzari <git@status.e4ward.com> (commit_signer:1/2=50%)
>> Cc: Tim Gardner <tim.gardner@canonical.com> (commit_signer:1/2=50%)
>> Cc: linux-input@vger.kernel.org (open list:INPUT (KEYBOARD,...)
>> Cc: linux-kernel@vger.kernel.org (open list)
>> Cc: stable@vger.kernel.org
> This patch works fine: eliminates stream of junk driver messages with no
> ill effects.
>
> Tested-by: Kamal Mostafa <kamal@canonical.com>
>
>  -Kamal
>
>
>> ---
>>  drivers/input/mouse/cypress_ps2.c |    4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
>> index 45b3eda..95b2c40 100644
>> --- a/drivers/input/mouse/cypress_ps2.c
>> +++ b/drivers/input/mouse/cypress_ps2.c
>> @@ -441,7 +441,7 @@ static int cypress_get_finger_count(unsigned char header_byte)
>>  			case 2: return 5;
>>  			default:
>>  				/* Invalid contact (e.g. palm). Ignore it. */
>> -				return -1;
>> +				return 0;
>>  		}
>>  	}
>>  
>> @@ -460,7 +460,7 @@ static int cypress_parse_packet(struct psmouse *psmouse,
>>  
>>  	contact_cnt = cypress_get_finger_count(header_byte);
>>  
>> -	if (contact_cnt < 0) /* e.g. palm detect */
>> +	if (contact_cnt < 0)
>>  		return -EINVAL;
>>  
>>  	report_data->contact_cnt = contact_cnt;
Hi Dmitry and Henrik,

Have you had a chance to review this patch to consider it for inclusion
in mainline?

Thanks,

Joe


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

* Re: [PATCH 1/1][Resend] Input: cypress_ps2 - Return zero finger count if palm is detected.
  2013-10-11 16:30     ` [PATCH 1/1][Resend] " Joseph Salisbury
@ 2013-10-16 18:35       ` Dmitry Torokhov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2013-10-16 18:35 UTC (permalink / raw)
  To: Joseph Salisbury
  Cc: rydberg, Kamal Mostafa, linux-kernel, dudl, git, tim.gardner,
	linux-input

Hi Joe,

On Fri, Oct 11, 2013 at 12:30:43PM -0400, Joseph Salisbury wrote:
> On 09/30/2013 04:12 PM, Kamal Mostafa wrote:
> > On Tue, 2013-09-24 at 11:44 -0400, Joseph Salisbury wrote:
> >> BugLink: http://bugs.launchpad.net/bugs/1229361
> >>
> >> This patch sets the finger count to 0 in the case of palm contact.
> >>
> >> Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
> >> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> (maintainer:INPUT (KEYBOARD,...,commit_signer:2/2=100%)
> >> Cc: Henrik Rydberg <rydberg@euromail.se> (maintainer:INPUT MULTITOUCH...)
> >> Cc: Kamal Mostafa <kamal@canonical.com> (commit_signer:2/2=100%)
> >> Cc: Dudley Du <dudl@cypress.com> (commit_signer:2/2=100%)
> >> Cc: Kyle Fazzari <git@status.e4ward.com> (commit_signer:1/2=50%)
> >> Cc: Tim Gardner <tim.gardner@canonical.com> (commit_signer:1/2=50%)
> >> Cc: linux-input@vger.kernel.org (open list:INPUT (KEYBOARD,...)
> >> Cc: linux-kernel@vger.kernel.org (open list)
> >> Cc: stable@vger.kernel.org
> > This patch works fine: eliminates stream of junk driver messages with no
> > ill effects.
> >
> > Tested-by: Kamal Mostafa <kamal@canonical.com>
> >
> >  -Kamal
> >
> >
> >> ---
> >>  drivers/input/mouse/cypress_ps2.c |    4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
> >> index 45b3eda..95b2c40 100644
> >> --- a/drivers/input/mouse/cypress_ps2.c
> >> +++ b/drivers/input/mouse/cypress_ps2.c
> >> @@ -441,7 +441,7 @@ static int cypress_get_finger_count(unsigned char header_byte)
> >>  			case 2: return 5;
> >>  			default:
> >>  				/* Invalid contact (e.g. palm). Ignore it. */
> >> -				return -1;
> >> +				return 0;
> >>  		}
> >>  	}
> >>  
> >> @@ -460,7 +460,7 @@ static int cypress_parse_packet(struct psmouse *psmouse,
> >>  
> >>  	contact_cnt = cypress_get_finger_count(header_byte);
> >>  
> >> -	if (contact_cnt < 0) /* e.g. palm detect */
> >> +	if (contact_cnt < 0)
> >>  		return -EINVAL;
> >>  
> >>  	report_data->contact_cnt = contact_cnt;
> Hi Dmitry and Henrik,
> 
> Have you had a chance to review this patch to consider it for inclusion
> in mainline?

I think the main problem is that we were reporting PSMOUSE_BAD_DATA for
palm packets.

Could you try a slightly extended patch below to make sure it all still
works?

Thanks!

-- 
Dmitry

Input: cypress_ps2 - do not consider data bad if palm is detected

From: Joseph Salisbury <joseph.salisbury@canonical.com>

If hardware (or firmware) detects palm on the surface of the device it does
not mean that the data packet is bad from the protocol standpoint. Instead
of reporting PSMOUSE_BAD_DATA in this case simply threat it as if nothing
touches the surface.

BugLink: http://bugs.launchpad.net/bugs/1229361

Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
Tested-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/mouse/cypress_ps2.c |   20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
index ef651cc..e499e55 100644
--- a/drivers/input/mouse/cypress_ps2.c
+++ b/drivers/input/mouse/cypress_ps2.c
@@ -439,7 +439,7 @@ static int cypress_get_finger_count(unsigned char header_byte)
 			case 2: return 5;
 			default:
 				/* Invalid contact (e.g. palm). Ignore it. */
-				return -1;
+				return 0;
 		}
 	}
 
@@ -452,17 +452,10 @@ static int cypress_parse_packet(struct psmouse *psmouse,
 {
 	unsigned char *packet = psmouse->packet;
 	unsigned char header_byte = packet[0];
-	int contact_cnt;
 
 	memset(report_data, 0, sizeof(struct cytp_report_data));
 
-	contact_cnt = cypress_get_finger_count(header_byte);
-
-	if (contact_cnt < 0) /* e.g. palm detect */
-		return -EINVAL;
-
-	report_data->contact_cnt = contact_cnt;
-
+	report_data->contact_cnt = cypress_get_finger_count(header_byte);
 	report_data->tap = (header_byte & ABS_MULTIFINGER_TAP) ? 1 : 0;
 
 	if (report_data->contact_cnt == 1) {
@@ -535,11 +528,9 @@ static void cypress_process_packet(struct psmouse *psmouse, bool zero_pkt)
 	int slots[CYTP_MAX_MT_SLOTS];
 	int n;
 
-	if (cypress_parse_packet(psmouse, cytp, &report_data))
-		return;
+	cypress_parse_packet(psmouse, cytp, &report_data);
 
 	n = report_data.contact_cnt;
-
 	if (n > CYTP_MAX_MT_SLOTS)
 		n = CYTP_MAX_MT_SLOTS;
 
@@ -604,11 +595,6 @@ static psmouse_ret_t cypress_validate_byte(struct psmouse *psmouse)
 	if ((packet[0] & 0x08) == 0x08)
 		return PSMOUSE_BAD_DATA;
 
-	contact_cnt = cypress_get_finger_count(packet[0]);
-
-	if (contact_cnt < 0)
-		return PSMOUSE_BAD_DATA;
-
 	if (cytp->mode & CYTP_BIT_ABS_NO_PRESSURE)
 		cypress_set_packet_size(psmouse, contact_cnt == 2 ? 7 : 4);
 	else

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

end of thread, other threads:[~2013-10-16 18:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1379968154.git.joseph.salisbury@canonical.com>
2013-09-24 15:44 ` [PATCH 1/1] Input: cypress_ps2 - Return zero finger count if palm is detected Joseph Salisbury
2013-09-30 20:12   ` Kamal Mostafa
2013-10-11 16:30     ` [PATCH 1/1][Resend] " Joseph Salisbury
2013-10-16 18:35       ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).