From patchwork Tue Jun 3 17:59:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 4289671 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 16C87BEEA7 for ; Tue, 3 Jun 2014 17:59:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3E81A2013A for ; Tue, 3 Jun 2014 17:59:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4E94320138 for ; Tue, 3 Jun 2014 17:59:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754658AbaFCR7k (ORCPT ); Tue, 3 Jun 2014 13:59:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21379 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753618AbaFCR7j (ORCPT ); Tue, 3 Jun 2014 13:59:39 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s53HxbtQ018096 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 3 Jun 2014 13:59:37 -0400 Received: from plouf.redhat.com (ovpn-113-114.phx2.redhat.com [10.3.113.114]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s53HxaoR006170; Tue, 3 Jun 2014 13:59:36 -0400 From: Benjamin Tissoires To: Dmitry Torokhov , linux-input , linux-kernel@vger.kernel.org Cc: Hans de Goede , Peter Hutterer Subject: [PATCH] Input - synaptics: fix resolution for manually provided min/max Date: Tue, 3 Jun 2014 13:59:35 -0400 Message-Id: <1401818375-7212-1-git-send-email-benjamin.tissoires@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 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.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 commit 421e08c41fda fixed the reported min/max for the X and Y axis, but unfortunately, it broke the resolution of those same axis. On the t540p, the resolution is the same regarding X and Y. It is not a problem for xf86-input-synaptics because this driver is only interested in the ratio between X and Y. Unfortunately, xf86-input-cmt uses directly the resolution, and having a null resolution leads to some divide by 0 errors, which are translated by -infinity in the resulting coordinates. Reported-by: Peter Hutterer Signed-off-by: Benjamin Tissoires Cc: stable@vger.kernel.org --- Hi Dmitry, in the original submission, the test for the quirk was at the end of the synaptics_resolution() function. However, there was a mixmatch with the config in this original submission and you had to change the patch slightly. Unfortunately, this change created this bug which was hard to notice, which is why it comes that late in the cycle (and also because we are trying to find out if xf86-input-cmt could replace xf86-input-synaptics). Anyway, as mentioned in the commit message, this will not harm a big majority of users, because only those using ChromeOS will be impacted (not sure they have the Lenovo 40 series in their kernel either). Again, it's your call to leave or not the stable@ tag, but given that all we put regarding those crappy devices are tagged as such, I put it there also. Cheers, Benjamin drivers/input/mouse/synaptics.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index c5ec703..9cff1f8 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c @@ -347,15 +347,6 @@ static int synaptics_resolution(struct psmouse *psmouse) unsigned char resp[3]; int i; - for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) - if (matches_pnp_id(psmouse, min_max_pnpid_table[i].pnp_ids)) { - priv->x_min = min_max_pnpid_table[i].x_min; - priv->x_max = min_max_pnpid_table[i].x_max; - priv->y_min = min_max_pnpid_table[i].y_min; - priv->y_max = min_max_pnpid_table[i].y_max; - return 0; - } - if (SYN_ID_MAJOR(priv->identity) < 4) return 0; @@ -366,6 +357,15 @@ static int synaptics_resolution(struct psmouse *psmouse) } } + for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) + if (matches_pnp_id(psmouse, min_max_pnpid_table[i].pnp_ids)) { + priv->x_min = min_max_pnpid_table[i].x_min; + priv->x_max = min_max_pnpid_table[i].x_max; + priv->y_min = min_max_pnpid_table[i].y_min; + priv->y_max = min_max_pnpid_table[i].y_max; + return 0; + } + if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 5 && SYN_CAP_MAX_DIMENSIONS(priv->ext_cap_0c)) { if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MAX_COORDS, resp)) {