Skip to content

Commit 2ddc8e2

Browse files
filipalacJiri Kosina
authored andcommitted
HID: usbhid: extend the polling interval configuration to keyboards
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 <filipalac@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent c17a747 commit 2ddc8e2

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4352,6 +4352,9 @@
43524352
usbhid.jspoll=
43534353
[USBHID] The interval which joysticks are to be polled at.
43544354

4355+
usbhid.kbpoll=
4356+
[USBHID] The interval which keyboards are to be polled at.
4357+
43554358
usb-storage.delay_use=
43564359
[UMS] The delay in seconds before a new device is
43574360
scanned for Logical Units (default 1).

drivers/hid/usbhid/hid-core.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ static unsigned int hid_jspoll_interval;
5656
module_param_named(jspoll, hid_jspoll_interval, uint, 0644);
5757
MODULE_PARM_DESC(jspoll, "Polling interval of joysticks");
5858

59+
static unsigned int hid_kbpoll_interval;
60+
module_param_named(kbpoll, hid_kbpoll_interval, uint, 0644);
61+
MODULE_PARM_DESC(kbpoll, "Polling interval of keyboards");
62+
5963
static unsigned int ignoreled;
6064
module_param_named(ignoreled, ignoreled, uint, 0644);
6165
MODULE_PARM_DESC(ignoreled, "Autosuspend with active leds");
@@ -1094,7 +1098,9 @@ static int usbhid_start(struct hid_device *hid)
10941098
hid->name, endpoint->bInterval, interval);
10951099
}
10961100

1097-
/* Change the polling interval of mice and joysticks. */
1101+
/* Change the polling interval of mice, joysticks
1102+
* and keyboards.
1103+
*/
10981104
switch (hid->collection->usage) {
10991105
case HID_GD_MOUSE:
11001106
if (hid_mousepoll_interval > 0)
@@ -1104,6 +1110,10 @@ static int usbhid_start(struct hid_device *hid)
11041110
if (hid_jspoll_interval > 0)
11051111
interval = hid_jspoll_interval;
11061112
break;
1113+
case HID_GD_KEYBOARD:
1114+
if (hid_kbpoll_interval > 0)
1115+
interval = hid_kbpoll_interval;
1116+
break;
11071117
}
11081118

11091119
ret = -ENOMEM;

0 commit comments

Comments
 (0)