HID: usbhid: extend polling interval configuration to joysticks
authorTobias Jakobi <tjakobi@math.uni-bielefeld.de>
Sat, 25 Feb 2017 19:27:27 +0000 (20:27 +0100)
committerRaspbian kernel package updater <root@raspbian.org>
Sun, 23 Jul 2017 02:51:22 +0000 (02:51 +0000)
For mouse devices we can currently change the polling interval
via usbhid.mousepoll. Implement the same thing for joysticks, so
users can reduce input latency this way.

This has been tested with a Logitech RumblePad 2 with jspoll=2,
resulting in a polling rate of 500Hz (verified with evhz).

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Documentation/kernel-parameters.txt
drivers/hid/usbhid/hid-core.c

index be36da42fe0656810d0a327d7fff8a8b283f5d70..04a4ec1f68125dcb00c130c9a70b3cc4932d1a83 100644 (file)
@@ -4278,6 +4278,9 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
        usbhid.mousepoll=
                        [USBHID] The interval which mice are to be polled at.
 
+       usbhid.jspoll=
+                       [USBHID] The interval which joysticks 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).
index ae83af649a607f67239f1a64bf45dd4b5770cc7d..f7a692f9e50cdc80ebebab1ea260cde29b32d147 100644 (file)
@@ -53,6 +53,10 @@ static unsigned int hid_mousepoll_interval;
 module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644);
 MODULE_PARM_DESC(mousepoll, "Polling interval of mice");
 
+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 ignoreled;
 module_param_named(ignoreled, ignoreled, uint, 0644);
 MODULE_PARM_DESC(ignoreled, "Autosuspend with active leds");
@@ -1082,9 +1086,17 @@ static int usbhid_start(struct hid_device *hid)
                               hid->name, endpoint->bInterval, interval);
                }
 
-               /* Change the polling interval of mice. */
-               if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0)
-                       interval = hid_mousepoll_interval;
+               /* Change the polling interval of mice and joysticks. */
+               switch (hid->collection->usage) {
+               case HID_GD_MOUSE:
+                       if (hid_mousepoll_interval > 0)
+                               interval = hid_mousepoll_interval;
+                       break;
+               case HID_GD_JOYSTICK:
+                       if (hid_jspoll_interval > 0)
+                               interval = hid_jspoll_interval;
+                       break;
+               }
 
                ret = -ENOMEM;
                if (usb_endpoint_dir_in(endpoint)) {