From patchwork Fri May 20 22:19:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4PigLByaWMgUGllbA==?= X-Patchwork-Id: 804872 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4KMFYQJ020850 for ; Fri, 20 May 2011 22:19:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752388Ab1ETWTi (ORCPT ); Fri, 20 May 2011 18:19:38 -0400 Received: from mailservice.tudelft.nl ([130.161.131.5]:37418 "EHLO mailservice.tudelft.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751981Ab1ETWTh (ORCPT ); Fri, 20 May 2011 18:19:37 -0400 Received: from localhost (localhost [127.0.0.1]) by amavis (Postfix) with ESMTP id 72C752B8050; Sat, 21 May 2011 00:19:36 +0200 (CEST) X-Virus-Scanned: amavisd-new at tudelft.nl X-Spam-Flag: NO X-Spam-Score: -21.89 X-Spam-Level: X-Spam-Status: No, score=-21.89 tagged_above=-99 required=5 tests=[BAYES_00=-1.9, PROLO_LEO3=0.01, TUD_REL01=-20] autolearn=ham Received: from mailservice.tudelft.nl ([130.161.131.73]) by localhost (tudelft.nl [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 6d0LOpAKKDmj; Sat, 21 May 2011 00:19:35 +0200 (CEST) Received: from smtp-a.tudelft.nl (smtp-a.tudelft.nl [130.161.180.7]) by mx2.tudelft.nl (Postfix) with ESMTP id 66C1B2B8043; Sat, 21 May 2011 00:19:35 +0200 (CEST) Received: from [172.19.3.21] (63-103-dsl.ipact.nl [84.35.103.63]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-a.tudelft.nl (Postfix) with ESMTP id 92424B3A62; Sat, 21 May 2011 00:19:34 +0200 (CEST) Message-ID: <4DD6E8F4.5070101@tudelft.nl> Date: Sat, 21 May 2011 00:19:32 +0200 From: =?ISO-8859-1?Q?=C9ric_Piel?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110517 Mandriva/3.1.10-2 (2011.0) Thunderbird/3.1.10 MIME-Version: 1.0 To: Dmitry Torokhov CC: Henrik Rydberg , "linux-input@vger.kernel.org" , Chris Bagwell , Florian Ragwitz Subject: [PATCH] elantech: clean up hardware/firmware version check References: <4DCE24BE.70908@tudelft.nl> <20110516111552.GA10453@polaris.bitmath.org> <20110517054432.GA20428@core.coreip.homeip.net> In-Reply-To: <20110517054432.GA20428@core.coreip.homeip.net> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 20 May 2011 22:19:38 +0000 (UTC) Op 17-05-11 07:44, Dmitry Torokhov schreef: : > I am not happy with the protocol checks from Dell, I am not sure they > make much sense; so I dropped patch 3 for now and because of that patch > 2 did not make much sense either. Actually patch 2 did not make sense on > its own in any case as it should have been partially rolled into 3 and > partially into 4. Hello, Find below patch 2 rebased. Actually, as half of if is not useful anymore (we gave up on checking the data for version 2) and you had integrated the other half already, this doesn't contain a lot anymore. So it ends up being just a clean up patch, mostly putting all the version checks in the same place. See you, Eric 8<----------------------------------------------------------------- According to the protocol document, there are a couple of different versions of the hardware and firmware. Using the version number, it should be possible to distinguish between them, at least for the properties we care about. This moves all the version check together. Signed-off-by: Éric Piel --- drivers/input/mouse/elantech.c | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 3250356..0d9c547 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c @@ -757,15 +757,25 @@ int elantech_init(struct psmouse *psmouse) etd->hw_version = 2; /* For now show extra debug information */ etd->debug = 1; - /* Don't know how to do parity checking for version 2 */ - etd->paritycheck = 0; + /* Version 2 doesn't contain control bits */ + etd->paritycheck = false; if (etd->fw_version >= 0x020800) etd->reports_pressure = true; - + } else if ((etd->fw_version == 0x020022) || (etd->fw_version == 0x020600)) { + /* + * This firmware suffers from misreporting coordinates when + * a touch action starts causing the mouse cursor or scrolled page + * to jump. Enable a workaround. + */ + pr_info("firmware version 2.0.34/2.6.0 detected, enabling jumpy cursor workaround\n"); + etd->jumpy_cursor = 1; + etd->debug = 1; + etd->hw_version = 1; + etd->paritycheck = true; } else { etd->hw_version = 1; - etd->paritycheck = 1; + etd->paritycheck = true; } pr_info("assuming hardware version %d, firmware version %d.%d.%d\n", @@ -779,16 +789,6 @@ int elantech_init(struct psmouse *psmouse) param[0], param[1], param[2]); etd->capabilities = param[0]; - /* - * This firmware suffers from misreporting coordinates when - * a touch action starts causing the mouse cursor or scrolled page - * to jump. Enable a workaround. - */ - if (etd->fw_version == 0x020022 || etd->fw_version == 0x020600) { - pr_info("firmware version 2.0.34/2.6.0 detected, enabling jumpy cursor workaround\n"); - etd->jumpy_cursor = true; - } - if (elantech_set_absolute_mode(psmouse)) { pr_err("failed to put touchpad into absolute mode.\n"); goto init_fail;