From patchwork Sat Dec 27 11:31:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriele Mazzotta X-Patchwork-Id: 5544591 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 B4627BEEA8 for ; Sat, 27 Dec 2014 11:32:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 052F320173 for ; Sat, 27 Dec 2014 11:32:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 367782016C for ; Sat, 27 Dec 2014 11:32:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751476AbaL0LcD (ORCPT ); Sat, 27 Dec 2014 06:32:03 -0500 Received: from mail-wi0-f169.google.com ([209.85.212.169]:51877 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751459AbaL0Lb7 (ORCPT ); Sat, 27 Dec 2014 06:31:59 -0500 Received: by mail-wi0-f169.google.com with SMTP id r20so20378372wiv.0; Sat, 27 Dec 2014 03:31:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rIYdnrQWRW0z5ivQjxDo7ZEz2dXzA56OXnJsWSCU9U0=; b=Ell5Oy4uX1puRSTOQ36fCy2GVSM3/N5qra/33j2uiqijTFDiJ0FYD7EKMKyU5SwSl6 PFWj7swjMwN7C7fQcotW180EXj2LcL7Qo6BoPYsSa5QJ6mJcwuTEQn16EYgJLUcj/3Um WW0MLrQv7nu1U0HFavtzZFa/ghlNnvNLq4gFFfghPMgnXFdQA56xPjYgnkg10+K6d35x jIge+t34q7aSy2P7uUhvlpg9HZy7IZ3U/gDYgBpL++MG/aRRJu57lcLg1EmK44z/Dmvg hhaRdJbfcYvrRhlBc7RMQzVxxvIiFoPLM71vR1CGfKn1s7rGuHd9ubVkMfNH9jLbh4yM Ueag== X-Received: by 10.180.218.133 with SMTP id pg5mr77093888wic.70.1419679918556; Sat, 27 Dec 2014 03:31:58 -0800 (PST) Received: from xps13.homenet (2-235-140-64.ip228.fastwebnet.it. [2.235.140.64]) by mx.google.com with ESMTPSA id s9sm31495839wiz.12.2014.12.27.03.31.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 27 Dec 2014 03:31:58 -0800 (PST) From: Gabriele Mazzotta To: dmitry.torokhov@gmail.com, rydberg@euromail.se Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, silverhammermba@gmail.com, Gabriele Mazzotta Subject: [PATCH 2/2] input: synaptics - fix width calculation on image sensors Date: Sat, 27 Dec 2014 12:31:29 +0100 Message-Id: <1419679889-6582-3-git-send-email-gabriele.mzt@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1419679889-6582-1-git-send-email-gabriele.mzt@gmail.com> References: <1419679889-6582-1-git-send-email-gabriele.mzt@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, 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 When two or more fingers are on the touchpad, the 'w' slot holds the finger count rather than the width. Retrieve the correct value encoded in the lower bits of 'x', 'y' and 'z'. The minimum width reported is 8 rather than 4 in this case, while the maximum remains 15. Signed-off-by: Gabriele Mazzotta --- drivers/input/mouse/synaptics.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index ea0563e..5ff4c5b 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c @@ -593,7 +593,9 @@ static void synaptics_parse_agm(const unsigned char buf[], switch (agm_packet_type) { case 1: /* Gesture packet: (x, y, z) half resolution */ - agm->w = hw->w; + agm->w = ((buf[1] & 0x01) | + ((buf[2] & 0x01) << 1) | + ((buf[5] & 0x01) << 2)) + 8; agm->x = (((buf[4] & 0x0f) << 8) | buf[1]) << 1; agm->y = (((buf[4] & 0xf0) << 4) | buf[2]) << 1; agm->z = ((buf[3] & 0x30) | (buf[5] & 0x0f)) << 1;