From patchwork Fri May 25 12:51:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 10427341 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2E6556025B for ; Fri, 25 May 2018 12:51:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1919B293DF for ; Fri, 25 May 2018 12:51:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D2912940D; Fri, 25 May 2018 12:51:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA7B4293DF for ; Fri, 25 May 2018 12:51:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935955AbeEYMvN (ORCPT ); Fri, 25 May 2018 08:51:13 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:59450 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933260AbeEYMvM (ORCPT ); Fri, 25 May 2018 08:51:12 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8B46F8D6A6; Fri, 25 May 2018 12:51:11 +0000 (UTC) Received: from plouf.banquise.eu.com (ovpn-116-67.ams2.redhat.com [10.36.116.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id E637C202699C; Fri, 25 May 2018 12:51:09 +0000 (UTC) From: Benjamin Tissoires To: Jiri Kosina , Andrew Duggan Cc: Oscar Morante , Peter Hutterer , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Benjamin Tissoires Subject: [PATCH] HID: rmi: use HID_QUIRK_NO_INPUT_SYNC Date: Fri, 25 May 2018 14:51:06 +0200 Message-Id: <20180525125106.18008-1-benjamin.tissoires@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 25 May 2018 12:51:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 25 May 2018 12:51:11 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'benjamin.tissoires@redhat.com' RCPT:'' Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When we receive a RMI4 report, we should not unconditionally send an input_sync event. Instead, we should let the rmi4 transport layer do it for us. This fixes a situation where we might receive X in a report and the rest in a subsequent one. And this messes up user space. Link: https://bugs.freedesktop.org/show_bug.cgi?id=100436 Signed-off-by: Benjamin Tissoires Acked-by: Peter Hutterer --- Hi, Oscar, do you mind if we add your "Tested-by: Oscar Morante "? Andrew, can you check for any sides effects please? Cheers, Benjamin drivers/hid/hid-rmi.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c index 9c9362149641..9e33165250a3 100644 --- a/drivers/hid/hid-rmi.c +++ b/drivers/hid/hid-rmi.c @@ -413,6 +413,24 @@ static int rmi_event(struct hid_device *hdev, struct hid_field *field, return 0; } +static void rmi_report(struct hid_device *hid, struct hid_report *report) +{ + struct hid_field *field = report->field[0]; + + if (!(hid->claimed & HID_CLAIMED_INPUT)) + return; + + switch (report->id) { + case RMI_READ_DATA_REPORT_ID: + /* fall-through */ + case RMI_ATTN_REPORT_ID: + return; + } + + if (field && field->hidinput && field->hidinput->input) + input_sync(field->hidinput->input); +} + #ifdef CONFIG_PM static int rmi_suspend(struct hid_device *hdev, pm_message_t message) { @@ -637,6 +655,7 @@ static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id) hid_set_drvdata(hdev, data); hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS; + hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC; ret = hid_parse(hdev); if (ret) { @@ -744,6 +763,7 @@ static struct hid_driver rmi_driver = { .remove = rmi_remove, .event = rmi_event, .raw_event = rmi_raw_event, + .report = rmi_report, .input_mapping = rmi_input_mapping, .input_configured = rmi_input_configured, #ifdef CONFIG_PM