Re: [PATCH] hid-core: Configurable USB HID Mouse Interrupt Polling Interval

From: Mikkel Krautz
Date: Sat Dec 18 2004 - 20:53:34 EST


On Sat, 18 Dec 2004 08:53:31 -0800, Greg KH <greg@xxxxxxxxx> wrote:
> On Sat, Dec 18, 2004 at 05:39:25PM +0000, Mikkel Krautz wrote:
> > On Fri, 17 Dec 2004 18:59:48 -0800, Greg KH <greg@xxxxxxxxx> wrote:
> > > What about makeing it a module paramater then, that is exported to
> > > sysfs? That makes it easier to adjust on the fly (before the mouse is
> > > inserted), and doesn't require the kernel to be rebuilt.
> >
> > I really like the idea. I'm start to think that this is the ideal way to
> > accomplish this.
> >
> > Here's a new patch. Let's hope it doesn't wrap!
>
> It was eaten :(
>
> > module_init(hid_init);
> > module_exit(hid_exit);
> > +module_param(hid_mouse_polling_interval, int, 644);
>
> 0644, or use the proper #defines instead.
>
> thanks,
>
> greg k-h
>

Here's an updated version, with your and Marcel's suggestions:





Signed-off-by: Mikkel Krautz <krautz@xxxxxxxxx>
---


hid-core.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletion(-)


--- clean/drivers/usb/input/hid-core.c
+++ dirty/drviers/usb/input/hid-core.c
@@ -37,11 +37,12 @@
* Version Information
*/

-#define DRIVER_VERSION "v2.0"
+#define DRIVER_VERSION "v2.01"
#define DRIVER_AUTHOR "Andreas Gal, Vojtech Pavlik"
#define DRIVER_DESC "USB HID core driver"
#define DRIVER_LICENSE "GPL"

+static unsigned int hid_mousepoll_interval;
static char *hid_types[] = {"Device", "Pointer", "Mouse", "Device", "Joystick",
"Gamepad", "Keyboard", "Keypad", "Multi-Axis Controller"};

@@ -1663,6 +1664,11 @@
if ((endpoint->bmAttributes & 3) != 3) /* Not an interrupt endpoint */
continue;

+ /* Change the polling interval of mice. */
+ if (hid->collection->usage == HID_GD_MOUSE
+ && hid_mousepoll_interval > 0)
+ endpoint->bInterval = hid_mousepoll_interval;
+
/* handle potential highspeed HID correctly */
interval = endpoint->bInterval;
if (dev->speed == USB_SPEED_HIGH)
@@ -1910,6 +1916,7 @@

module_init(hid_init);
module_exit(hid_exit);
+module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644);

MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/