Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3440140imm; Fri, 25 May 2018 05:53:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqCupDDsflPpJzpRbj1sV0CIm2eclUuinYB9FIlYB1JK8PbIU1RTB1KE9IXPCkZfpVWNG9C X-Received: by 2002:a62:e50d:: with SMTP id n13-v6mr2430444pff.125.1527252782218; Fri, 25 May 2018 05:53:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527252782; cv=none; d=google.com; s=arc-20160816; b=vytaERJ/mS53DHvEDBkQBwTfK7TXqXI0e1gkifmbexl7pR2ZWi+TpICIi1GWsJu85G xZXaJL54TM1ncoiCGl2SQmvkE/kuikVGcrvKwUjdLG8dMHflDw58XyUOjRIT6l+XNKq0 fdVqKZYTTZA1L9maEXOC6MmrFDdr6QhgTn0krYf5WJnNsxIeAiktVEiR0Y1oAewVAWqX oEZoFreqxpNu/ca97uPZrczpdJGyJRf7XeEqmcvz6tAr+Na8PFbOjOZgcJA/TcFYiY0F gFJEhldMaOM6bDCK24nzQq5oVQrR3gZwGfpMKwsl0lu/3rjc41HS1TpkQFB5g+yX1j0X Ft4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=rO1Ox7o9U+vxwEgcqDhxD8YRilJOnJc84HaVtg66L2w=; b=abJpqzdN+cJuR1Kc7GiMoS4r4Nc1W3CHxIMVfeeJlbsfCTLt3JEK1emALbUDWWhO0O 9cBf89DI0DW9Ej/Oyv4j+9MDMum7exJ12WWmA3y8/SntNgVwomgGalthGooLQ3wJS5UG uT+hLmARYLKWBfBBGLwFhjxkKQYwrhJNXkEetZSy1abB6Hfdsz+O9xiovLUrDANUX/qc X3Vl78D3aT8UxZFwZynFPZsGSoxDTxEnMSqQfo5KWgp2vzng/zRzp7ARPTgi50tdEAvK araoxuvggFSnZk3CQagQQcxnq2XA3FkzEEOCwBqIK5EHFQTx0bVG/mkSayP+3GfXn4Bv /djA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s23-v6si24055663plr.458.2018.05.25.05.52.47; Fri, 25 May 2018 05:53:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935980AbeEYMvN (ORCPT + 99 others); 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 -- 2.14.3