From patchwork Fri Oct 8 14:57:59 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chase Douglas X-Patchwork-Id: 241491 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o98ExGRe003215 for ; Fri, 8 Oct 2010 14:59:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753748Ab0JHO6J (ORCPT ); Fri, 8 Oct 2010 10:58:09 -0400 Received: from adelie.canonical.com ([91.189.90.139]:60445 "EHLO adelie.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758355Ab0JHO6I (ORCPT ); Fri, 8 Oct 2010 10:58:08 -0400 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1P4EOd-0007Ir-89; Fri, 08 Oct 2010 15:58:07 +0100 Received: from cpe-75-180-27-10.columbus.res.rr.com ([75.180.27.10] helo=canonical.com) by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1P4EOc-0003mu-Oa; Fri, 08 Oct 2010 15:58:07 +0100 From: Chase Douglas To: linux-input@vger.kernel.org, xorg-devel@lists.x.org Cc: Dmitry Torokhov , Takashi Iwai , Chris Bagwell , Andy Whitcroft , Henrik Rydberg , linux-kernel@vger.kernel.org, Peter Hutterer , Duncan McGreggor Subject: [PATCH 2/3] Input: synaptics - add multitouch multifinger support Date: Fri, 8 Oct 2010 10:57:59 -0400 Message-Id: <1286549880-32580-3-git-send-email-chase.douglas@canonical.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1286549880-32580-2-git-send-email-chase.douglas@canonical.com> References: <1286549880-32580-1-git-send-email-chase.douglas@canonical.com> <1286549880-32580-2-git-send-email-chase.douglas@canonical.com> 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.3 (demeter1.kernel.org [140.211.167.41]); Fri, 08 Oct 2010 14:59:16 +0000 (UTC) diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 990598f..7289d88 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c @@ -471,7 +471,6 @@ static void synaptics_process_packet(struct psmouse *psmouse) struct input_dev *dev = psmouse->dev; struct synaptics_data *priv = psmouse->private; struct synaptics_hw_state hw; - int num_fingers; int finger_width; int i; @@ -483,6 +482,7 @@ static void synaptics_process_packet(struct psmouse *psmouse) input_report_abs(dev, ABS_MT_POSITION_Y, YMAX_NOMINAL + YMIN_NOMINAL - hw.y); input_report_abs(dev, ABS_MT_PRESSURE, hw.z); + priv->num_fingers++; } input_mt_sync(dev); @@ -510,13 +510,13 @@ static void synaptics_process_packet(struct psmouse *psmouse) } if (hw.z > 0) { - num_fingers = 1; + priv->num_fingers++; finger_width = 5; if (SYN_CAP_EXTENDED(priv->capabilities)) { switch (hw.w) { case 0 ... 1: if (SYN_CAP_MULTIFINGER(priv->capabilities)) - num_fingers = hw.w + 2; + priv->num_fingers = hw.w + 2; break; case 2: if (SYN_MODEL_PEN(priv->model_id)) @@ -528,10 +528,8 @@ static void synaptics_process_packet(struct psmouse *psmouse) break; } } - } else { - num_fingers = 0; + } else finger_width = 0; - } /* Post events * BTN_TOUCH has to be first as mousedev relies on it when doing @@ -555,15 +553,19 @@ static void synaptics_process_packet(struct psmouse *psmouse) if (SYN_CAP_PALMDETECT(priv->capabilities)) input_report_abs(dev, ABS_TOOL_WIDTH, finger_width); - input_report_key(dev, BTN_TOOL_FINGER, num_fingers == 1); + input_report_key(dev, BTN_TOOL_FINGER, priv->num_fingers == 1); input_report_key(dev, BTN_LEFT, hw.left); input_report_key(dev, BTN_RIGHT, hw.right); - if (SYN_CAP_MULTIFINGER(priv->capabilities)) { - input_report_key(dev, BTN_TOOL_DOUBLETAP, num_fingers == 2); - input_report_key(dev, BTN_TOOL_TRIPLETAP, num_fingers == 3); + if (SYN_CAP_MULTIFINGER(priv->capabilities) || priv->multitouch) { + input_report_key(dev, BTN_TOOL_DOUBLETAP, + priv->num_fingers == 2); + input_report_key(dev, BTN_TOOL_TRIPLETAP, + priv->num_fingers == 3); } + priv->num_fingers = 0; + if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) input_report_key(dev, BTN_MIDDLE, hw.middle); @@ -674,7 +676,7 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) __set_bit(BTN_LEFT, dev->keybit); __set_bit(BTN_RIGHT, dev->keybit); - if (SYN_CAP_MULTIFINGER(priv->capabilities)) { + if (SYN_CAP_MULTIFINGER(priv->capabilities) || priv->multitouch) { __set_bit(BTN_TOOL_DOUBLETAP, dev->keybit); __set_bit(BTN_TOOL_TRIPLETAP, dev->keybit); } diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h index 5126c9c..0989b8d 100644 --- a/drivers/input/mouse/synaptics.h +++ b/drivers/input/mouse/synaptics.h @@ -113,6 +113,7 @@ struct synaptics_data { unsigned char mode; /* current mode byte */ int scroll; int multitouch; /* Whether device provides MT */ + unsigned int num_fingers; /* Number of fingers touching */ }; void synaptics_module_init(void);