linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* HID: questions about polling rates
@ 2010-11-12 19:15 Stefan Achatz
  2010-11-13  0:31 ` Alan Stern
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Achatz @ 2010-11-12 19:15 UTC (permalink / raw)
  To: Jiri Kosina, linux-input, linux-kernel, linux-usb, linux-kernel

Hello,

while working on my roccat device drivers I thought about the possiblity
of on the fly polling rate changes and tested some things.

First I tried different polling rates by writing values from 1 to 10
into /sys/bus/usb/drivers/usbhid/module/parameters/mousepoll. I observed
that the polling rates seem to be capped on both sides. With value 1 I
measure 2ms instead of 1ms with my hardware protocol analyzer. With 10 I
get 8ms instead of 10ms.
I only use cheap onboard usb controllers, but under windows they work
with 1ms.
A internet and code search revealed nothing regarding this to me. Is
someone of you aware of this behaviour and could tell me more about it?

Changing the polling rate of a device on the fly would requires to use
usb_kill_urb() and usb_submit_urb() with new interval. To get the
int_urb I would need additional informations for incomplete struct
usbhid_device that lie in drivers/hid/usbhid/usbhid.h.
My driver code is at home in drivers/hid/. Is it okay to include a
header further down in the structure? Or does anyone have concerns about
moving the mentioned header to include/linux? Is this a matter to follow
at all?

Thanks in advance
Stefan


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

* Re: HID: questions about polling rates
  2010-11-12 19:15 HID: questions about polling rates Stefan Achatz
@ 2010-11-13  0:31 ` Alan Stern
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Stern @ 2010-11-13  0:31 UTC (permalink / raw)
  To: Stefan Achatz
  Cc: Jiri Kosina, linux-input, linux-kernel, linux-usb, linux-kernel

On Fri, 12 Nov 2010, Stefan Achatz wrote:

> Hello,
> 
> while working on my roccat device drivers I thought about the possiblity
> of on the fly polling rate changes and tested some things.
> 
> First I tried different polling rates by writing values from 1 to 10
> into /sys/bus/usb/drivers/usbhid/module/parameters/mousepoll. I
> observed that the polling rates seem to be capped on both sides. With
> value 1 I measure 2ms instead of 1ms with my hardware protocol
> analyzer. With 10 I get 8ms instead of 10ms.

What type of USB host controller are you using?

The existing drivers (at least, the ones I'm aware of) will only poll
at intervals that are powers of 2.  They won't poll at intervals of 10
ms, for example; the value gets rounded down to 8 ms.  But you should 
be able to poll at intervals of 16 or 32 ms if you want.

There's no reason I know of why you shouldn't be able to poll at 1-ms
intervals.

>  I only use cheap onboard
> usb controllers, but under windows they work with 1ms. A internet and
> code search revealed nothing regarding this to me. Is someone of you
> aware of this behaviour and could tell me more about it?

Note that according to the USB spec, low-speed devices like mice are 
not allowed to request polling intervals shorter than 10 ms.  Of course 
this doesn't matter to you, because you are overriding the device's 
built-in settings.

> Changing the polling rate of a device on the fly would requires to
> use usb_kill_urb() and usb_submit_urb() with new interval. To get the
> int_urb I would need additional informations for incomplete struct
> usbhid_device that lie in drivers/hid/usbhid/usbhid.h. My driver code
> is at home in drivers/hid/. Is it okay to include a header further
> down in the structure? Or does anyone have concerns about moving the
> mentioned header to include/linux? Is this a matter to follow at all?

You can include any header you like in your driver, regardless of where
it lives.  Why do you want to change the polling rate on the fly?

Alan Stern


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

end of thread, other threads:[~2010-11-13  0:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-12 19:15 HID: questions about polling rates Stefan Achatz
2010-11-13  0:31 ` Alan Stern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).