From patchwork Wed Mar 21 16:28:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filip Alac X-Patchwork-Id: 10299667 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 EF2D5600F6 for ; Wed, 21 Mar 2018 15:28:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB567296B2 for ; Wed, 21 Mar 2018 15:28:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CFEFB29811; Wed, 21 Mar 2018 15:28:57 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 71099296B2 for ; Wed, 21 Mar 2018 15:28:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752560AbeCUP24 (ORCPT ); Wed, 21 Mar 2018 11:28:56 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:39737 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752315AbeCUP2z (ORCPT ); Wed, 21 Mar 2018 11:28:55 -0400 Received: by mail-wr0-f196.google.com with SMTP id c24so5626633wrc.6; Wed, 21 Mar 2018 08:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=SbiUpmycgUeDg59RO7DjeOvqfqyITNvPeqJ9q6gwDYg=; b=YrNS1K/RiS1MnRV7d7TMSK8cr9/5z7Tp7Y6uNe529cz4YQpFoaLSo8CZe09+FG9XKi NraWreDxuRXvJMHArLda+fXu/apwosnFBDSeRJuxTiQAl0JrtEAzagn2m67HLRnG0g2r myG1PPAXCYzFR3bNjr+VBWvQHl6s7eIqIBkGWIyAnZNMbsAOyeZQHnCvCFF9JtHd4gsg 2HfnOHp5221a1GXRQqj54gUl32vU1TeITAJzEKXGkeliqa436YezkP3bs/mkgtJ8vLBR k5ahoHb0wU03/g+zpDRFzu+dw7g2AcSOtz3VjNFQhIQWJ4oXvqNHShKQJtJTaSMZruby +13Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=SbiUpmycgUeDg59RO7DjeOvqfqyITNvPeqJ9q6gwDYg=; b=SGO6pElODenD2niRYvPqOa8GACeW3wKnucXJwp+VFX9U7Zx/7cQmUPJ8i2eyjTcOHs qZJy8sSm3L45MrAVyetYnsnVAseiwcpQvYrUVNRVk3dqd2zQR57PfJbni0Ge5QicKnBL uHFFPNP4THycCPgJCM3OJn/oSrxtUru9Xbs4++AMGXUggrTCxlA61DYyD09pPoTFCV+W 4h0blw+3kL+u7NiCxHvicPBUCXO1uXmwbqf0wygMihuUmnTK4RgIJC4MSovN7J08c9Z5 V4ZG69gzZgvqL/J+iHvYBqEMBKJ5LXtFd9Tu8w5OsgwjIwXHhySRpxj7RoOaQ+y/ze35 wZBg== X-Gm-Message-State: AElRT7HRBObeXAjJdThPLIQgCZW3aAsrTYORepc4ddSSv6H5jr+NY3Xv r1fjamBogVJCyvHnYL+lIIHUZePP+cI= X-Google-Smtp-Source: AG47ELt/7Qv5YOpsf+kHHh7yenwtQIMLDFQq+c5/0xsURaxDpCyJtOfcJ3sy5aXd3N4Ts724u2CKsQ== X-Received: by 10.223.153.45 with SMTP id x42mr16628447wrb.124.1521646134157; Wed, 21 Mar 2018 08:28:54 -0700 (PDT) Received: from localhost.localdomain ([37.58.2.13]) by smtp.googlemail.com with ESMTPSA id 14sm6660824wml.41.2018.03.21.08.28.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 08:28:53 -0700 (PDT) From: Filip Alac To: jikos@kernel.org Cc: benjamin.tissoires@redhat.com, linux-usb@vger.kernel.org, linux-input@vger.kernel.org, Filip Alac Subject: [PATCH] HID: usbhid: extend the polling interval configuration to keyboards Date: Wed, 21 Mar 2018 17:28:25 +0100 Message-Id: <20180321162825.2709-1-filipalac@gmail.com> X-Mailer: git-send-email 2.16.2 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 For mouse and joystick devices user can change the polling interval via usbhid.mousepoll and usbhid.jspoll. Implement the same thing for keyboards, so user can reduce(or increase) input latency this way. This has been tested with a Cooler Master Devastator with kbpoll=32, resulting in delay between events of 32 ms(values were taken from evtest). Signed-off-by: Filip Alac --- Documentation/admin-guide/kernel-parameters.txt | 3 +++ drivers/hid/usbhid/hid-core.c | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index b98048b56..e0d825206 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -4352,6 +4352,9 @@ usbhid.jspoll= [USBHID] The interval which joysticks are to be polled at. + usbhid.kbpoll= + [USBHID] The interval which keyboards are to be polled at. + usb-storage.delay_use= [UMS] The delay in seconds before a new device is scanned for Logical Units (default 1). diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 77c50cdff..af0e0d061 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -56,6 +56,10 @@ static unsigned int hid_jspoll_interval; module_param_named(jspoll, hid_jspoll_interval, uint, 0644); MODULE_PARM_DESC(jspoll, "Polling interval of joysticks"); +static unsigned int hid_kbpoll_interval; +module_param_named(kbpoll, hid_kbpoll_interval, uint, 0644); +MODULE_PARM_DESC(kbpoll, "Polling interval of keyboards"); + static unsigned int ignoreled; module_param_named(ignoreled, ignoreled, uint, 0644); MODULE_PARM_DESC(ignoreled, "Autosuspend with active leds"); @@ -1094,7 +1098,9 @@ static int usbhid_start(struct hid_device *hid) hid->name, endpoint->bInterval, interval); } - /* Change the polling interval of mice and joysticks. */ + /* Change the polling interval of mice, joysticks + * and keyboards. + */ switch (hid->collection->usage) { case HID_GD_MOUSE: if (hid_mousepoll_interval > 0) @@ -1104,6 +1110,10 @@ static int usbhid_start(struct hid_device *hid) if (hid_jspoll_interval > 0) interval = hid_jspoll_interval; break; + case HID_GD_KEYBOARD: + if (hid_kbpoll_interval > 0) + interval = hid_kbpoll_interval; + break; } ret = -ENOMEM;