From patchwork Wed Oct 16 18:35:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 3056741 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1E0C99F2B7 for ; Wed, 16 Oct 2013 18:35:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A6C512047E for ; Wed, 16 Oct 2013 18:35:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0709D2030D for ; Wed, 16 Oct 2013 18:35:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761288Ab3JPSfs (ORCPT ); Wed, 16 Oct 2013 14:35:48 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:64967 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761258Ab3JPSfr (ORCPT ); Wed, 16 Oct 2013 14:35:47 -0400 Received: by mail-pa0-f53.google.com with SMTP id kq14so1472562pab.12 for ; Wed, 16 Oct 2013 11:35:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=d2dm5fltmCVRelPG4FiHIcos6bDz+Uxkhn4gQ3bc8R8=; b=0Ge+vXfB/KhpSMcd0w3XleF7cjV9ksAA8WzZ62w5GGO+2cZKpE4jv5pmnRaOmhWrJO +HIOvnThN8Bf8zDdX+dCfCgg0TdFSxcZtT+o/9QXGSe33UKIGdWbqagOO7QWiEPYRB0a SHMfiYcZZDo3WAvrPrJNYPQmNlIJY5OD8r6kOuq9nHlHHwvpYv2vrS0ohCBCUEsyO6Cj DMZ8AIzqTN7+mgvZl3HEBa/QzPIWBCm9rbh+qKNTiKo/Bc371QRaVdzZKzWWmpU7rK6d 0DbsE5CYQp0bUZCObuWzblQvcr7ZwRhlxhV6767vCD5lx68M6HDJL/mMxVGZxO9AmioC UY/Q== X-Received: by 10.67.30.70 with SMTP id kc6mr1193890pad.32.1381948547219; Wed, 16 Oct 2013 11:35:47 -0700 (PDT) Received: from mailhub.coreip.homeip.net (c-67-188-112-76.hsd1.ca.comcast.net. [67.188.112.76]) by mx.google.com with ESMTPSA id ry4sm108489312pab.4.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 16 Oct 2013 11:35:46 -0700 (PDT) Date: Wed, 16 Oct 2013 11:35:43 -0700 From: Dmitry Torokhov To: Joseph Salisbury Cc: rydberg@euromail.se, Kamal Mostafa , linux-kernel@vger.kernel.org, dudl@cypress.com, git@status.e4ward.com, tim.gardner@canonical.com, linux-input@vger.kernel.org Subject: Re: [PATCH 1/1][Resend] Input: cypress_ps2 - Return zero finger count if palm is detected. Message-ID: <20131016183543.GA21932@core.coreip.homeip.net> References: <007c09ae4ef7f72ffb657de0fb3854fcbc6d88f0.1379968154.git.joseph.salisbury@canonical.com> <1380571922.15513.29.camel@fourier> <525827B3.9080003@canonical.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <525827B3.9080003@canonical.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 > >> Cc: Dmitry Torokhov (maintainer:INPUT (KEYBOARD,...,commit_signer:2/2=100%) > >> Cc: Henrik Rydberg (maintainer:INPUT MULTITOUCH...) > >> Cc: Kamal Mostafa (commit_signer:2/2=100%) > >> Cc: Dudley Du (commit_signer:2/2=100%) > >> Cc: Kyle Fazzari (commit_signer:1/2=50%) > >> Cc: Tim Gardner (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 > > > > > >> --- > >> 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! 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