All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] HID: usbhid: extend polling interval configuration to joysticks
@ 2017-02-25 19:27 Tobias Jakobi
  2017-02-28 17:06 ` Benjamin Tissoires
  2017-03-06 13:35 ` Jiri Kosina
  0 siblings, 2 replies; 4+ messages in thread
From: Tobias Jakobi @ 2017-02-25 19:27 UTC (permalink / raw)
  To: jikos-DgEjT+Ai2ygdnm+yROfE0A
  Cc: benjamin.tissoires-H+wXaHxf7aLQT0dZR+AlfA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-input-u79uwXL29TY76Z2rM5mHXA, Tobias Jakobi

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-o02PS0xoJP9W0yFyLvAVXMxlOr/tl8fh@public.gmane.org>
---
 Documentation/kernel-parameters.txt |  3 +++
 drivers/hid/usbhid/hid-core.c       | 18 +++++++++++++++---
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 922dec8..928ce2c 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -4260,6 +4260,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).
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index ae83af6..f7a692f 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -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)) {
-- 
2.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] HID: usbhid: extend polling interval configuration to joysticks
  2017-02-25 19:27 [PATCH] HID: usbhid: extend polling interval configuration to joysticks Tobias Jakobi
@ 2017-02-28 17:06 ` Benjamin Tissoires
  2017-03-06 13:35 ` Jiri Kosina
  1 sibling, 0 replies; 4+ messages in thread
From: Benjamin Tissoires @ 2017-02-28 17:06 UTC (permalink / raw)
  To: Tobias Jakobi; +Cc: jikos, linux-usb, linux-input

On Feb 25 2017 or thereabouts, Tobias Jakobi wrote:
> 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>
> ---

Looks good to me.

Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

>  Documentation/kernel-parameters.txt |  3 +++
>  drivers/hid/usbhid/hid-core.c       | 18 +++++++++++++++---
>  2 files changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
> index 922dec8..928ce2c 100644
> --- a/Documentation/kernel-parameters.txt
> +++ b/Documentation/kernel-parameters.txt
> @@ -4260,6 +4260,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).
> diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
> index ae83af6..f7a692f 100644
> --- a/drivers/hid/usbhid/hid-core.c
> +++ b/drivers/hid/usbhid/hid-core.c
> @@ -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)) {
> -- 
> 2.7.3
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] HID: usbhid: extend polling interval configuration to joysticks
  2017-02-25 19:27 [PATCH] HID: usbhid: extend polling interval configuration to joysticks Tobias Jakobi
  2017-02-28 17:06 ` Benjamin Tissoires
@ 2017-03-06 13:35 ` Jiri Kosina
  2017-03-06 13:54   ` Tobias Jakobi
  1 sibling, 1 reply; 4+ messages in thread
From: Jiri Kosina @ 2017-03-06 13:35 UTC (permalink / raw)
  To: Tobias Jakobi; +Cc: benjamin.tissoires, linux-usb, linux-input

On Sat, 25 Feb 2017, Tobias Jakobi wrote:

> 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>

Applied to for-4.12/upstream. Thanks,

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] HID: usbhid: extend polling interval configuration to joysticks
  2017-03-06 13:35 ` Jiri Kosina
@ 2017-03-06 13:54   ` Tobias Jakobi
  0 siblings, 0 replies; 4+ messages in thread
From: Tobias Jakobi @ 2017-03-06 13:54 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: benjamin.tissoires, linux-usb, linux-input

Jiri Kosina wrote:
> On Sat, 25 Feb 2017, Tobias Jakobi wrote:
> 
>> 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>
> 
> Applied to for-4.12/upstream. Thanks,
Thank you as well! :)

- Tobias


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-06 14:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-25 19:27 [PATCH] HID: usbhid: extend polling interval configuration to joysticks Tobias Jakobi
2017-02-28 17:06 ` Benjamin Tissoires
2017-03-06 13:35 ` Jiri Kosina
2017-03-06 13:54   ` Tobias Jakobi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.