aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilip Alac <filipalac@gmail.com>2018-03-21 12:28:25 -0400
committerJiri Kosina <jkosina@suse.cz>2018-03-23 09:48:37 -0400
commit2ddc8e2d2b5902b376fee51585c8eed72b8836e7 (patch)
treeb1b77a503fb105b998b5999ea21c9af10aba24ed
parentc17a7476e4c41884d82e3675c25ceae982c07a63 (diff)
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>
-rw-r--r--Documentation/admin-guide/kernel-parameters.txt3
-rw-r--r--drivers/hid/usbhid/hid-core.c12
2 files changed, 14 insertions, 1 deletions
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index b98048b56ada..e0d825206681 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -4352,6 +4352,9 @@
4352 usbhid.jspoll= 4352 usbhid.jspoll=
4353 [USBHID] The interval which joysticks are to be polled at. 4353 [USBHID] The interval which joysticks are to be polled at.
4354 4354
4355 usbhid.kbpoll=
4356 [USBHID] The interval which keyboards are to be polled at.
4357
4355 usb-storage.delay_use= 4358 usb-storage.delay_use=
4356 [UMS] The delay in seconds before a new device is 4359 [UMS] The delay in seconds before a new device is
4357 scanned for Logical Units (default 1). 4360 scanned for Logical Units (default 1).
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 77c50cdfff97..af0e0d061b15 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;
56module_param_named(jspoll, hid_jspoll_interval, uint, 0644); 56module_param_named(jspoll, hid_jspoll_interval, uint, 0644);
57MODULE_PARM_DESC(jspoll, "Polling interval of joysticks"); 57MODULE_PARM_DESC(jspoll, "Polling interval of joysticks");
58 58
59static unsigned int hid_kbpoll_interval;
60module_param_named(kbpoll, hid_kbpoll_interval, uint, 0644);
61MODULE_PARM_DESC(kbpoll, "Polling interval of keyboards");
62
59static unsigned int ignoreled; 63static unsigned int ignoreled;
60module_param_named(ignoreled, ignoreled, uint, 0644); 64module_param_named(ignoreled, ignoreled, uint, 0644);
61MODULE_PARM_DESC(ignoreled, "Autosuspend with active leds"); 65MODULE_PARM_DESC(ignoreled, "Autosuspend with active leds");
@@ -1094,7 +1098,9 @@ static int usbhid_start(struct hid_device *hid)
1094 hid->name, endpoint->bInterval, interval); 1098 hid->name, endpoint->bInterval, interval);
1095 } 1099 }
1096 1100
1097 /* Change the polling interval of mice and joysticks. */ 1101 /* Change the polling interval of mice, joysticks
1102 * and keyboards.
1103 */
1098 switch (hid->collection->usage) { 1104 switch (hid->collection->usage) {
1099 case HID_GD_MOUSE: 1105 case HID_GD_MOUSE:
1100 if (hid_mousepoll_interval > 0) 1106 if (hid_mousepoll_interval > 0)
@@ -1104,6 +1110,10 @@ static int usbhid_start(struct hid_device *hid)
1104 if (hid_jspoll_interval > 0) 1110 if (hid_jspoll_interval > 0)
1105 interval = hid_jspoll_interval; 1111 interval = hid_jspoll_interval;
1106 break; 1112 break;
1113 case HID_GD_KEYBOARD:
1114 if (hid_kbpoll_interval > 0)
1115 interval = hid_kbpoll_interval;
1116 break;
1107 } 1117 }
1108 1118
1109 ret = -ENOMEM; 1119 ret = -ENOMEM;