From: Han Boetes <han@mijncomputer.nl>
To: linux-kernel@vger.kernel.org
Subject: [2.6 patch] add a sysctl to control the refreshrate of USB-mice
Date: Mon, 30 Aug 2004 17:06:55 +0159 [thread overview]
Message-ID: <20040830150717.GC15605@boetes.org> (raw)
I found this patch which adds a sysctl that controls the refreshrate of
USB-mice.
I am not the author, I contacted him and he thought it was messy and
since he is busy he doesn't want to maintain it any longer. But since he
only posted a URL to the patch and the original site is no longer active
this patch was nearly lost.
Increasing the refreshrate is not compliant with the USB specifications
but it is possible and the higher precision of the mice benefits:
- Graphical artists who use the gimp for example.
- Gamers. Quake 3 players for example.
So even if this patch won't make it into the kernel it's at least
properly archived.
diff -ruNp a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
--- a/drivers/usb/input/hid-core.c 2003-09-25 15:07:12.000000000 -0700
+++ b/drivers/usb/input/hid-core.c 2003-10-08 19:08:13.000000000 -0700
@@ -21,6 +21,7 @@
#include <linux/mm.h>
#include <linux/smp_lock.h>
#include <linux/spinlock.h>
+#include <linux/sysctl.h>
#include <asm/unaligned.h>
#include <asm/byteorder.h>
#include <linux/input.h>
@@ -42,9 +43,42 @@
#define DRIVER_DESC "USB HID core driver"
#define DRIVER_LICENSE "GPL"
+static unsigned hid_mouse_poll_interval = 2; /* 10 is default for HID mice, rounded off to 8 by root hub */
+
static char *hid_types[] = {"Device", "Pointer", "Mouse", "Device", "Joystick",
"Gamepad", "Keyboard", "Keypad", "Multi-Axis Controller"};
+/*
+ * sysctl-tuning infrastructure.
+ */
+static ctl_table hid_table[] = {
+ { 1, "hid_mouse_poll_interval", &hid_mouse_poll_interval, sizeof(int), 0644, NULL,
+ &proc_dointvec, NULL, },
+ { 0, }
+};
+
+static ctl_table hid_root[] = {
+ { 1, "hid", NULL, 0, 0555, hid_table, },
+ { 0, }
+};
+
+static ctl_table dev_root[] = {
+ { CTL_DEV, "dev", NULL, 0, 0555, hid_root, },
+ { 0, }
+};
+static struct ctl_table_header *sysctl_header;
+
+static int __init init_sysctl(void)
+{
+ sysctl_header = register_sysctl_table(dev_root, 0);
+ return 0;
+}
+
+static void __exit cleanup_sysctl(void)
+{
+ unregister_sysctl_table(sysctl_header);
+}
+
/*
* Register a new report for a device.
*/
@@ -1511,6 +1545,15 @@ static struct hid_device *usb_hid_config
continue;
if (!(hid->urbin = usb_alloc_urb(0, GFP_KERNEL)))
goto fail;
+
+ /* if (dev->descriptor.idVendor == 0x046d) { */
+ if (hid->collection[0].usage == 0x10002) {
+ endpoint->bInterval = hid_mouse_poll_interval;
+ printk("HID Mouse 0x%x forced to %d ms polling\n",
+ dev->descriptor.idProduct,
+ endpoint->bInterval);
+ }
+
pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress);
usb_fill_int_urb(hid->urbin, dev, pipe, hid->inbuf, 0,
hid_irq_in, hid, endpoint->bInterval);
@@ -1694,6 +1737,7 @@ static struct usb_driver hid_driver = {
static int __init hid_init(void)
{
int retval;
+ init_sysctl();
retval = hiddev_init();
if (retval)
goto hiddev_init_fail;
@@ -1711,6 +1755,7 @@ hiddev_init_fail:
static void __exit hid_exit(void)
{
+ cleanup_sysctl();
hiddev_exit();
usb_deregister(&hid_driver);
}
# Han
reply other threads:[~2004-08-30 15:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040830150717.GC15605@boetes.org \
--to=han@mijncomputer.nl \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox