From patchwork Wed Jul 9 15:24:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 4517451 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 915C09F1C4 for ; Wed, 9 Jul 2014 15:24:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CC04E20383 for ; Wed, 9 Jul 2014 15:24:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F33542037F for ; Wed, 9 Jul 2014 15:24:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932555AbaGIPYg (ORCPT ); Wed, 9 Jul 2014 11:24:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20723 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932544AbaGIPYf (ORCPT ); Wed, 9 Jul 2014 11:24:35 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s69FOT6f009389 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 9 Jul 2014 11:24:29 -0400 Received: from shalem.localdomain.com (vpn1-6-44.ams2.redhat.com [10.36.6.44]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s69FOJwF015745; Wed, 9 Jul 2014 11:24:28 -0400 From: Hans de Goede To: Dmitry Torokhov Cc: Yunkang Tang , linux-input@vger.kernel.org, Hans de Goede Subject: [PATCH 06/14] alps: process_bitmap: Round down when spreading adjescent fingers over 2 points Date: Wed, 9 Jul 2014 17:24:11 +0200 Message-Id: <1404919459-23561-7-git-send-email-hdegoede@redhat.com> In-Reply-To: <1404919459-23561-1-git-send-email-hdegoede@redhat.com> References: <1404919459-23561-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 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.6 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 This fixes 2 fingers at the same height or width on the touchpad getting reported at different y / x coordinates. Note num_bits is always at least 1. Signed-off-by: Hans de Goede --- drivers/input/mouse/alps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index ebf8187..f8c04fc 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c @@ -391,13 +391,13 @@ static int alps_process_bitmap(struct alps_data *priv, * adjacent fingers. Divide the single contact between the two points. */ if (fingers_x == 1) { - i = x_low.num_bits / 2; + i = (x_low.num_bits - 1) / 2; x_low.num_bits = x_low.num_bits - i; x_high.start_bit = x_low.start_bit + i; x_high.num_bits = max(i, 1); } if (fingers_y == 1) { - i = y_low.num_bits / 2; + i = (y_low.num_bits - 1) / 2; y_low.num_bits = y_low.num_bits - i; y_high.start_bit = y_low.start_bit + i; y_high.num_bits = max(i, 1);