From patchwork Wed Aug 7 17:51:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Whitlock X-Patchwork-Id: 265618 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 38DF72C009F for ; Thu, 8 Aug 2013 09:30:58 +1000 (EST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1V7DBl-0004vE-2W; Wed, 07 Aug 2013 23:30:45 +0000 Received: from jefferson.mattwhitlock.com ([216.240.130.137]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1V77tD-0006ft-6z for kernel-team@lists.ubuntu.com; Wed, 07 Aug 2013 17:51:15 +0000 Received: from [2001:470:1f07:e46:219:d1ff:fe75:dc2f] (HELO crushinator.localnet) by [2001:470:d:b89::1] with ESMTP ; Wed, 07 Aug 2013 10:51:13 -0700 From: Matt Whitlock To: Ubuntu Kernel Team Subject: [PATCH] make ektf3k driver report non-MT events too Date: Wed, 07 Aug 2013 13:51:12 -0400 Message-ID: <1658315.vxlUMBhYuy@crushinator> User-Agent: KMail/4.10.5 (Linux/3.8.13-gentoo; KDE/4.10.5; x86_64; ; ) MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 07 Aug 2013 23:30:43 +0000 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com Joseph Salisbury requested that I submit this patch to the Ubuntu Kernel Team mailing list for review. > This patch resolves a shortcoming of the ektf3k driver. Previously, the > driver was reporting only multi-touch events. xf86-input-evdev 2.7.3 > crashes upon receiving input events from [that] driver, and 2.8.1 simply > ignores the input device altogether as a workaround for the crash. > > This patch adds single-touch ABS_X, ABS_Y, and ABS_PRESSURE axes, as well as > the BTN_TOUCH key. Only the first finger touching reports on these > single-touch axes (while continuing to report on the multi-touch axes); > additional fingers report only on the multi-touch axes. > > I have tested this patch on a Nexus 7 running X.org server 1.13.4 and > xf86-input-evdev 2.8.1. Without the patch, evdev ignores all input from the > touchscreen. With the patch, evdev generates mouse events in response to > touches, as one would expect. https://bugs.launchpad.net/ubuntu/+source/linux-grouper/+bug/1209049 === modified file 'drivers/input/touchscreen/ektf3k.c' --- drivers/input/touchscreen/ektf3k.c 2013-05-02 01:22:19 +0000 +++ drivers/input/touchscreen/ektf3k.c 2013-08-06 22:15:53 +0000 @@ -910,6 +910,9 @@ for(i = 0; i < FINGER_NUM; i++){ active = fbits & 0x1; if(active || mTouchStatus[i]){ + if (active != mTouchStatus[i]) { + input_report_key(idev, BTN_TOUCH, active); + } input_mt_slot(ts->input_dev, i); input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, active); if(active){ @@ -923,6 +926,11 @@ input_report_abs(idev, ABS_MT_POSITION_X, y); input_report_abs(idev, ABS_MT_POSITION_Y, x); if(unlikely(gPrint_point)) touch_debug(DEBUG_INFO, "[elan] finger id=%d X=%d y=%d size=%d pressure=%d\n", i, x, y, touch_size, pressure_size); + if (i == 0) { + input_report_abs(idev, ABS_PRESSURE, pressure_size); + input_report_abs(idev, ABS_X, y); + input_report_abs(idev, ABS_Y, x); + } } } mTouchStatus[i] = active; @@ -956,10 +964,12 @@ if ( (num < 3) || ((checksum & 0x00ff) == buf[34])) { fbits = buf[2] & 0x30; fbits = (fbits << 4) | buf[1]; - //input_report_key(idev, BTN_TOUCH, 1); for(i = 0; i < FINGER_NUM; i++){ active = fbits & 0x1; if(active || mTouchStatus[i]){ + if (active != mTouchStatus[i]) { + input_report_key(idev, BTN_TOUCH, active); + } input_mt_slot(ts->input_dev, i); input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, active); if(active){ @@ -973,6 +983,11 @@ input_report_abs(idev, ABS_MT_POSITION_X, y); input_report_abs(idev, ABS_MT_POSITION_Y, x); if(unlikely(gPrint_point)) touch_debug(DEBUG_INFO, "[elan] finger id=%d X=%d y=%d size=%d pressure=%d\n", i, x, y, touch_size, pressure_size); + if (i == 0) { + input_report_abs(idev, ABS_PRESSURE, pressure_size); + input_report_abs(idev, ABS_X, y); + input_report_abs(idev, ABS_Y, x); + } } } mTouchStatus[i] = active; @@ -1505,11 +1520,15 @@ } ts->input_dev->name = "elan-touchscreen"; - //set_bit(BTN_TOUCH, ts->input_dev->keybit); + set_bit(BTN_TOUCH, ts->input_dev->keybit); ts->abs_x_max = pdata->abs_x_max; ts->abs_y_max = pdata->abs_y_max; touch_debug(DEBUG_INFO, "[Elan] Max X=%d, Max Y=%d\n", ts->abs_x_max, ts->abs_y_max); + input_set_abs_params(ts->input_dev, ABS_X, pdata->abs_y_min, pdata->abs_y_max, 0, 0); // for 800 * 1280 + input_set_abs_params(ts->input_dev, ABS_Y, pdata->abs_x_min, pdata->abs_x_max, 0, 0); // for 800 * 1280 + input_set_abs_params(ts->input_dev, ABS_PRESSURE, 0, MAX_FINGER_PRESSURE, 0, 0); + input_mt_init_slots(ts->input_dev, FINGER_NUM); input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X, pdata->abs_y_min, pdata->abs_y_max, 0, 0); // for 800 * 1280 input_set_abs_params(ts->input_dev, ABS_MT_POSITION_Y, pdata->abs_x_min, pdata->abs_x_max, 0, 0);// for 800 * 1280