public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] hid-core: Configurable USB HID Mouse Interrupt Polling Interval
@ 2005-02-07 15:44 Mikkel Krautz
  2005-02-07 15:59 ` Randy.Dunlap
       [not found] ` <20050207174303.GA3113@ucw.cz>
  0 siblings, 2 replies; 28+ messages in thread
From: Mikkel Krautz @ 2005-02-07 15:44 UTC (permalink / raw)
  To: vojtech; +Cc: linux-kernel, greg

And, here's an updated version of hid-core.c:

Signed-off-by: Mikkel Krautz <krautz@gmail.com>
---
--- clean/drivers/usb/input/hid-core.c
+++ dirty/drivers/usb/input/hid-core.c
@@ -37,13 +37,20 @@
  * 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 char *hid_types[] = {"Device", "Pointer", "Mouse", "Device", "Joystick",
 				"Gamepad", "Keyboard", "Keypad", "Multi-Axis Controller"};
+/*
+ * Module parameters.
+ */
+
+static unsigned int hid_mousepoll_interval;
+module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644);
+MODULE_PARM_DESC(mousepoll, "Polling interval of mice");
 
 /*
  * Register a new report for a device.
@@ -1695,6 +1702,12 @@
 		if (dev->speed == USB_SPEED_HIGH)
 			interval = 1 << (interval - 1);
 
+		/* Change the polling interval of mice. */
+		if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0)
+			interval = hid_mousepoll_interval;
+		else
+			hid_mousepoll_interval = interval;
+		
 		if (endpoint->bEndpointAddress & USB_DIR_IN) {
 			if (hid->urbin)
 				continue;



^ permalink raw reply	[flat|nested] 28+ messages in thread
* Re: [PATCH] hid-core: Configurable USB HID Mouse Interrupt Polling Interval
@ 2005-02-07 18:57 Mikkel Krautz
  2005-02-08 15:15 ` zyphr
  0 siblings, 1 reply; 28+ messages in thread
From: Mikkel Krautz @ 2005-02-07 18:57 UTC (permalink / raw)
  To: vojtech; +Cc: linux-kernel, greg

This includes the kernel-parameters.txt-patch, and the hid-core.c-patch, without the extra else-statement.

Thanks,
Mikkel

Signed-off-by: Mikkel Krautz <krautz@gmail.com>
---
--- clean/Documentation/kernel-parameters.txt
+++ dirty/Documentation/kernel-parameters.txt
@@ -73,6 +73,7 @@
 	SWSUSP	Software suspension is enabled.
 	TS	Appropriate touchscreen support is enabled.
 	USB	USB support is enabled.
+	USBHID	USB Human Interface Device support is enabled.
 	V4L	Video For Linux support is enabled.
 	VGA	The VGA console has been enabled.
 	VT	Virtual terminal support is enabled.
@@ -1393,6 +1394,9 @@
 			Format: <io>,<irq>
 
 	usb-handoff	[HW] Enable early USB BIOS -> OS handoff
+
+	usbhid.mousepoll=
+			[USBHID] The interval which mice are to be polled at.
  
 	video=		[FB] Frame buffer configuration
 			See Documentation/fb/modedb.txt.
--- clean/drivers/usb/input/hid-core.c
+++ dirty/drivers/usb/input/hid-core.c
@@ -37,13 +37,20 @@
  * 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 char *hid_types[] = {"Device", "Pointer", "Mouse", "Device", "Joystick",
 				"Gamepad", "Keyboard", "Keypad", "Multi-Axis Controller"};
+/*
+ * Module parameters.
+ */
+
+static unsigned int hid_mousepoll_interval;
+module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644);
+MODULE_PARM_DESC(mousepoll, "Polling interval of mice");
 
 /*
  * Register a new report for a device.
@@ -1695,6 +1702,10 @@
 		if (dev->speed == USB_SPEED_HIGH)
 			interval = 1 << (interval - 1);
 
+		/* Change the polling interval of mice. */
+		if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0)
+			interval = hid_mousepoll_interval;
+		
 		if (endpoint->bEndpointAddress & USB_DIR_IN) {
 			if (hid->urbin)
 				continue;



^ permalink raw reply	[flat|nested] 28+ messages in thread
* Re: [PATCH] hid-core: Configurable USB HID Mouse Interrupt Polling Interval
@ 2005-02-07 16:46 Mikkel Krautz
  0 siblings, 0 replies; 28+ messages in thread
From: Mikkel Krautz @ 2005-02-07 16:46 UTC (permalink / raw)
  To: rddunlap; +Cc: vojtech, linux-kernel, greg

Randy.Dunlap wrote:
> Why is it writable by root?  IOW, will writing a new value to it
> change the operational value dynamically?

Yes, sort of. It requires a re-plug of the mouse, though. :)

> Also, from the kernel-parameters.txt patch:
> (a) "which"
> (b) drop one of the "at"s... either one.

Oops, thanks!

Here's an updated version of the kernel-parameters patch:

Signed-off-by: Mikkel Krautz <krautz@gmail.com>
---
--- clean/Documentation/kernel-parameters.txt
+++ dirty/Documentation/kernel-parameters.txt
@@ -73,6 +73,7 @@
 	SWSUSP	Software suspension is enabled.
 	TS	Appropriate touchscreen support is enabled.
 	USB	USB support is enabled.
+	USBHID	USB Human Interface Device support is enabled.
 	V4L	Video For Linux support is enabled.
 	VGA	The VGA console has been enabled.
 	VT	Virtual terminal support is enabled.
@@ -1393,6 +1394,9 @@
 			Format: <io>,<irq>
 
 	usb-handoff	[HW] Enable early USB BIOS -> OS handoff
+
+	usbhid.mousepoll=
+			[USBHID] The interval which mice are to be polled at.
  
 	video=		[FB] Frame buffer configuration
 			See Documentation/fb/modedb.txt.



^ permalink raw reply	[flat|nested] 28+ messages in thread
* Re: [PATCH] hid-core: Configurable USB HID Mouse Interrupt Polling Interval
@ 2005-02-07 15:42 Mikkel Krautz
  0 siblings, 0 replies; 28+ messages in thread
From: Mikkel Krautz @ 2005-02-07 15:42 UTC (permalink / raw)
  To: vojtech; +Cc: linux-kernel, greg

Here's an updated version of kernel-parameters.txt:

Signed-off-by: Mikkel Krautz <krautz@gmail.com>
---
--- clean/Documentation/kernel-parameters.txt
+++ dirty/Documentation/kernel-parameters.txt
@@ -73,6 +73,7 @@
 	SWSUSP	Software suspension is enabled.
 	TS	Appropriate touchscreen support is enabled.
 	USB	USB support is enabled.
+	USBHID	USB Human Interface Device support is enabled.
 	V4L	Video For Linux support is enabled.
 	VGA	The VGA console has been enabled.
 	VT	Virtual terminal support is enabled.
@@ -1393,6 +1394,9 @@
 			Format: <io>,<irq>
 
 	usb-handoff	[HW] Enable early USB BIOS -> OS handoff
+
+	usbhid.mousepoll=
+			[USBHID] The interval at wich mice are to be polled at.
  
 	video=		[FB] Frame buffer configuration
 			See Documentation/fb/modedb.txt.



^ permalink raw reply	[flat|nested] 28+ messages in thread
* [PATCH] hid-core: Configurable USB HID Mouse Interrupt Polling Interval
@ 2004-12-18  2:12 Mikkel Krautz
  2004-12-18  0:43 ` Gene Heskett
  2004-12-18  1:27 ` Greg KH
  0 siblings, 2 replies; 28+ messages in thread
From: Mikkel Krautz @ 2004-12-18  2:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: vojtech, krautz

Hi!

This patch adds the option "USB HID Mouse Interrupt Polling Interval"
to drivers/usb/input/Kconfig, and a few lines of code to
drivers/usb/input/hid-core.c, to make the config option function.

It allows people to change the interval, at which their USB HID mice
are polled at. This is extremely useful for people who require high
precision, or just likes the feeling of a very precise mouse. ;)

As the Kconfig help implies, setting a lower polling interval is known
to work on several mice produced by Logitech and Microsoft. I only
have a Logitech MX500 to test it on. My results have been positive,
and so have many other people's.

Mikkel Krautz




Signed-off-by: Mikkel Krautz <krautz@gmail.com>
---

--- clean/drivers/usb/input/Kconfig
+++ dirty/drivers/usb/input/Kconfig
@@ -24,6 +24,38 @@
 	  To compile this driver as a module, choose M here: the
 	  module will be called usbhid.
 
+config USB_HID_MOUSE_POLLING_INTERVAL
+	int "USB HID Mouse Interrupt Polling Interval"
+	default 10
+	depends on USB_HID
+	help
+	  The "USB HID Mouse Interrupt Polling Interval" is the interval, at
+	  which your USB HID mouse is to be polled at. The interval is
+	  specified in miliseconds.
+
+	  Decreasing the interval will, of course, give you a much more
+	  precise mouse.
+
+	  Generally speaking, a polling interval of 2 ms should be more than
+	  enough for most people, and is great for gaming and other things
+	  that require high precision.
+
+	  An interval lower than the default is not guaranteed work on your
+	  specific piece of hardware. If you want to play it safe, don't
+	  change this value.
+
+	  Now, if you indeed want to feel the joy of a precise mouse, the
+	  following mice are known to work without problems, when the interval
+	  is set to at least 2 ms:
+
+	    * Logitech's MX-family
+	    * Logitech Mouse Man Dual Optical
+	    * Logitech iFeel
+	    * Microsoft Intellimouse Explorer
+	    * Microsoft Intellimouse Optical 1.1
+
+	  If unsure, keep it at 10 ms.
+
 comment "Input core support is needed for USB HID input layer or HIDBP
support"
 	depends on USB_HID && INPUT=n
 
--- clean/drivers/usb/input/hid-core.c
+++ dirty/drivers/usb/input/hid-core.c
@@ -37,7 +37,7 @@
  * 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"
@@ -1663,6 +1663,12 @@
 		if ((endpoint->bmAttributes & 3) != 3)		/* Not an interrupt endpoint
*/
 			continue;
 
+		/* Set the interrupt polling interval of mice, to the one specified
in the config. */
+		if (hid->collection->usage == HID_GD_MOUSE
+				&& CONFIG_USB_HID_MOUSE_POLLING_INTERVAL > 0
+				&& CONFIG_USB_HID_MOUSE_POLLING_INTERVAL < 255)
+			endpoint->bInterval = CONFIG_USB_HID_MOUSE_POLLING_INTERVAL;
+
 		/* handle potential highspeed HID correctly */
 		interval = endpoint->bInterval;
 		if (dev->speed == USB_SPEED_HIGH)




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

end of thread, other threads:[~2005-02-08 16:08 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-07 15:44 [PATCH] hid-core: Configurable USB HID Mouse Interrupt Polling Interval Mikkel Krautz
2005-02-07 15:59 ` Randy.Dunlap
2005-02-07 17:16   ` Domen Puncer
2005-02-07 17:00     ` Randy.Dunlap
     [not found] ` <20050207174303.GA3113@ucw.cz>
2005-02-07 17:51   ` Mikkel Krautz
2005-02-07 17:56     ` Mikkel Krautz
     [not found]       ` <20050207183818.GB2006@ucw.cz>
2005-02-07 18:41         ` Mikkel Krautz
  -- strict thread matches above, loose matches on Subject: below --
2005-02-07 18:57 Mikkel Krautz
2005-02-08 15:15 ` zyphr
2005-02-08 16:02   ` Oliver Neukum
2005-02-08 16:09   ` Vojtech Pavlik
2005-02-07 16:46 Mikkel Krautz
2005-02-07 15:42 Mikkel Krautz
2004-12-18  2:12 Mikkel Krautz
2004-12-18  0:43 ` Gene Heskett
2004-12-18  1:27 ` Greg KH
2004-12-18  4:22   ` Mikkel Krautz
2004-12-18  3:36     ` Gene Heskett
2004-12-18  4:42   ` Mikkel Krautz
2004-12-18  2:59     ` Greg KH
2004-12-18  4:55   ` Mikkel Krautz
2004-12-18 17:39   ` Mikkel Krautz
2004-12-18 15:40     ` Marcel Holtmann
2004-12-18 17:44       ` Mikkel Krautz
2004-12-18 16:53     ` Greg KH
2004-12-19  1:52       ` Mikkel Krautz
2005-02-06 19:07         ` Vojtech Pavlik
2005-02-06 20:00           ` Mikkel Krautz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox