From patchwork Wed May 5 12:20:46 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?w4PigLByaWMgUGllbA==?= X-Patchwork-Id: 97061 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o45CLmwY007509 for ; Wed, 5 May 2010 12:21:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934347Ab0EEMVi (ORCPT ); Wed, 5 May 2010 08:21:38 -0400 Received: from mailservice.tudelft.nl ([130.161.131.5]:54728 "EHLO mailservice.tudelft.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934313Ab0EEMVh (ORCPT ); Wed, 5 May 2010 08:21:37 -0400 Received: from localhost (localhost [127.0.0.1]) by amavis (Postfix) with ESMTP id 990F87F80BF; Wed, 5 May 2010 14:21:36 +0200 (CEST) X-Virus-Scanned: amavisd-new at tudelft.nl X-Spam-Flag: NO X-Spam-Score: -22.589 X-Spam-Level: X-Spam-Status: No, score=-22.589 tagged_above=-99 required=5 tests=[BAYES_00=-2.599, PROLO_LEO3=0.01, TUD_REL01=-20] autolearn=ham Received: from mailservice.tudelft.nl ([130.161.131.69]) by localhost (tudelft.nl [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 6AGTuCXOtEev; Wed, 5 May 2010 14:21:35 +0200 (CEST) Received: from smtp-a.tudelft.nl (smtp-a.tudelft.nl [130.161.180.7]) by mx1.tudelft.nl (Postfix) with ESMTP id E1DEC7F8027; Wed, 5 May 2010 14:21: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 BCCD7B3A62; Wed, 5 May 2010 14:21:35 +0200 (CEST) Message-ID: <4BE1629E.50901@tudelft.nl> Date: Wed, 05 May 2010 14:20:46 +0200 From: =?UTF-8?B?w4lyaWMgUGllbA==?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.21) Gecko/20090319 Mandriva/2.0.0.21-1mdv2009.1 (2009.1) Thunderbird/2.0.0.21 Mnenhy/0.7.6.666 MIME-Version: 1.0 To: Dmitry Torokhov CC: Florian Ragwitz , "linux-input@vger.kernel.org" Subject: [PATCH 2/2] elantech: Report multitouch with proper ABS_MT messages X-Enigmail-Version: 1.0.1 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 (demeter.kernel.org [140.211.167.41]); Wed, 05 May 2010 12:21:49 +0000 (UTC) diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 6a99b30..22978a9 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c @@ -253,7 +253,6 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse) /* byte 0: n1 n0 . . . . R L */ fingers = (packet[0] & 0xc0) >> 6; - input_report_key(dev, BTN_TOUCH, fingers != 0); switch (fingers) { case 1: @@ -268,6 +267,10 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse) * byte 5: y7 y6 y5 y4 y3 y2 y1 y0 */ y1 = ETP_YMAX_V2 - (((packet[4] & 0x03) << 8) | packet[5]); + input_report_abs(dev, ABS_MT_POSITION_X, x1); + input_report_abs(dev, ABS_MT_POSITION_Y, y1); + input_mt_sync(dev); + input_report_abs(dev, ABS_TOOL_WIDTH, width); input_report_abs(dev, ABS_X, x1); input_report_abs(dev, ABS_Y, y1); @@ -290,6 +293,13 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse) x2 = ((packet[3] & 0x10) << 4) | packet[4]; /* byte 5: by7 by6 by5 by4 by3 by2 by1 by0 */ y2 = ETP_2FT_YMAX - (((packet[3] & 0x20) << 3) | packet[5]); + /* Multitouch */ + input_report_abs(dev, ABS_MT_POSITION_X, x1 << 2); + input_report_abs(dev, ABS_MT_POSITION_Y, y1 << 2); + input_mt_sync(dev); + input_report_abs(dev, ABS_MT_POSITION_X, x2 << 2); + input_report_abs(dev, ABS_MT_POSITION_Y, y2 << 2); + input_mt_sync(dev); /* * For compatibility with the X Synaptics driver scale up * one coordinate and report as ordinary mouse movent @@ -307,6 +317,7 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse) break; } + input_report_key(dev, BTN_TOUCH, fingers != 0); input_report_key(dev, BTN_TOOL_FINGER, fingers == 1); input_report_key(dev, BTN_TOOL_DOUBLETAP, fingers == 2); input_report_key(dev, BTN_TOOL_TRIPLETAP, fingers == 3); @@ -472,6 +483,8 @@ static void elantech_set_input_params(struct psmouse *psmouse) input_set_abs_params(dev, ABS_TOOL_WIDTH, ETP_WMIN_V2, ETP_WMAX_V2, 0, 0); input_set_abs_params(dev, ABS_X, ETP_XMIN_V2, ETP_XMAX_V2, 0, 0); input_set_abs_params(dev, ABS_Y, ETP_YMIN_V2, ETP_YMAX_V2, 0, 0); + input_set_abs_params(dev, ABS_MT_POSITION_X, ETP_XMIN_V2, ETP_XMAX_V2, 0, 0); + input_set_abs_params(dev, ABS_MT_POSITION_Y, ETP_YMIN_V2, ETP_YMAX_V2, 0, 0); input_set_abs_params(dev, ABS_HAT0X, ETP_2FT_XMIN, ETP_2FT_XMAX, 0, 0); input_set_abs_params(dev, ABS_HAT0Y, ETP_2FT_YMIN, ETP_2FT_YMAX, 0, 0); input_set_abs_params(dev, ABS_HAT1X, ETP_2FT_XMIN, ETP_2FT_XMAX, 0, 0);