From patchwork Fri Feb 26 18:50:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Cox X-Patchwork-Id: 8441231 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6BA519F314 for ; Fri, 26 Feb 2016 18:50:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 73D2520270 for ; Fri, 26 Feb 2016 18:50:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8770420259 for ; Fri, 26 Feb 2016 18:50:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422893AbcBZSuc (ORCPT ); Fri, 26 Feb 2016 13:50:32 -0500 Received: from lxorguk.ukuu.org.uk ([81.2.110.251]:54662 "EHLO lxorguk.ukuu.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422988AbcBZSu3 (ORCPT ); Fri, 26 Feb 2016 13:50:29 -0500 Received: from localhost.localdomain (proxy [81.2.110.250]) by lxorguk.ukuu.org.uk (8.15.2/8.14.1) with ESMTP id u1QJT0tq006534; Fri, 26 Feb 2016 19:29:05 GMT Subject: [PATCH 3/3] goldfish: multitouch: no extra EV_SYN From: Alan To: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org Date: Fri, 26 Feb 2016 18:50:21 +0000 Message-ID: <20160226185007.3539.83946.stgit@localhost.localdomain> In-Reply-To: <20160226184908.3539.48691.stgit@localhost.localdomain> References: <20160226184908.3539.48691.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 From: Lingfeng Yang If we send SYN_REPORT on every single multi-touch event, it breaks the multi-touch. The multi-touch becomes jerky and you have to click 2-3 times to do things while randomly activating notification bars when not clicking. If we suppress these SYN_REPORTS, multi-touch will work fine and the events will have a protocol that looks nice. We need to register Goldfish Events as a multi-touch device by issuing input_mt_init_slots, otherwise input_handle_abs_event in drivers/input/input.c will silently drop all ABS_MT_SLOT events, causing touches of more than one finger to fail. Signed-off-by: Lingfeng Yang Signed-off-by: Jin Qian Signed-off-by: Alan Cox --- drivers/input/keyboard/goldfish_events.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/input/keyboard/goldfish_events.c b/drivers/input/keyboard/goldfish_events.c index c7e308a..c0d77b7 100644 --- a/drivers/input/keyboard/goldfish_events.c +++ b/drivers/input/keyboard/goldfish_events.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -24,6 +25,8 @@ #include #include +#define GOLDFISH_MAX_FINGERS 5 + enum { REG_READ = 0x00, REG_SET_PAGE = 0x00, @@ -52,7 +55,23 @@ static irqreturn_t events_interrupt(int irq, void *dev_id) value = __raw_readl(edev->addr + REG_READ); input_event(edev->input, type, code, value); - input_sync(edev->input); + /* + * Send an extra (EV_SYN, SYN_REPORT, 0x0) event + * if a key was pressed. Some keyboard device + * drivers may only send the EV_KEY event and + * not EV_SYN. + * Note that sending an extra SYN_REPORT is not + * necessary nor correct protocol with other + * devices such as touchscreens, which will send + * their own SYN_REPORT's when sufficient event + * information has been collected (e.g., for + * touchscreens, when pressure and X/Y coordinates + * have been received). Hence, we will only send + * this extra SYN_REPORT if type == EV_KEY. + */ + if (type == EV_KEY) + input_sync(edev->input); + return IRQ_HANDLED; } @@ -154,6 +173,15 @@ static int events_probe(struct platform_device *pdev) input_dev->name = edev->name; input_dev->id.bustype = BUS_HOST; + /* + * Set the Goldfish Device to be multi-touch. + * If we do not issue input_mt_init_slots, + * the kernel will filter out needed ABS_MT_SLOT + * events when we touch the screen in more than one place, + * preventing multi-touch with more than one finger from working. + * See drivers/input/input.c:input_handle_abs_event. + */ + input_mt_init_slots(input_dev, GOLDFISH_MAX_FINGERS, 0); events_import_bits(edev, input_dev->evbit, EV_SYN, EV_MAX); events_import_bits(edev, input_dev->keybit, EV_KEY, KEY_MAX);