Difference between revisions of "Mouse polling rate"

From ArchWiki
Jump to: navigation, search
m (Setting the polling rate: simplified modules line - autoload is on, no need to confuse people)
(Fixed messy instructions. Linked to updated version of evhz.)
(19 intermediate revisions by 12 users not shown)
Line 1: Line 1:
[[Category:X Server (English)]][[Category:HOWTOs (English)]][[Category:Mice (English)]]
+
[[Category:Mice]]
 
If you have invested in a high resolution mouse, adjusting the USB polling rate is a common trick to utilise the added precision it brings. The polling rate (or report rate) determines how often the mouse sends information to your computer. Measured in ''Hz'', this setting equates to lag time (in ''ms'').
 
If you have invested in a high resolution mouse, adjusting the USB polling rate is a common trick to utilise the added precision it brings. The polling rate (or report rate) determines how often the mouse sends information to your computer. Measured in ''Hz'', this setting equates to lag time (in ''ms'').
  
Line 27: Line 27:
  
 
== Setting the polling rate ==
 
== Setting the polling rate ==
Here we are using the USBHID module of the kernel to set a custom "mousepoll" rate. Simply add the following line to your /etc/modprobe.conf file:
+
Here we are using the {{ic|usbhid}} module of the kernel to set a custom "mousepoll" rate. Simply add the following line to your {{ic|/etc/modprobe.d/modprobe.conf}} file:
  
 
  options usbhid mousepoll=[polling interval]
 
  options usbhid mousepoll=[polling interval]
Line 35: Line 35:
 
  options usbhid mousepoll=2
 
  options usbhid mousepoll=2
  
Now, to ensure the USBHID module loads upon boot add the following to your /etc/rc.conf file, within the MODULES list:
+
To change the polling rate without rebooting
  
  usbhid
+
  modprobe -r usbhid && modprobe usbhid
  
For example:
+
{{Warning|Make sure that both commands execute otherwise you will be unable to use the mouse and keyboard and will have to reboot or ssh into your machine.}}
  
MOD_AUTOLOAD="yes"
+
Then unplug and replug your mouse.
MODULES=(usbhid)
+
 
 +
{{Note|1=If you use the '''usbinput''' and '''udev''' hooks in your initramfs, usbhid will included on the image and you'll need to add {{ic|/etc/modprobe.d/modprobe.conf}} to the FILES entry in {{ic|/etc/mkinitcpio.conf}}. Remember to regenerate your image after changing the config. Without doing this, the module will be inserted during early userspace without the polling option. Alternatively, you can add usbhid.mousepoll=X to your kernel command line.}}
  
 
== Displaying current mouse rate ==
 
== Displaying current mouse rate ==
A tool exists (named ''evhz'') that can display the current mouse refresh rate -- useful when checking that your customised polling settings have been applied.
+
A tool exists (named ''evhz'') that can display the current mouse refresh rate -- useful when checking that your customized polling settings have been applied.
  
The original source no longer exists ([http://homepages.nildram.co.uk/~kial/evhz.c]), so a mirror has been provided here: [http://www.fileden.com/files/2006/7/4/107702/evhz.c evhz.c]. Full credit goes to the original author, Alan Kivlin.
+
[https://github.com/ian-kelling/evhz/raw/master/evhz.c evhz.c]
  
 
Compile it with:
 
Compile it with:
Line 53: Line 54:
 
  gcc -o evhz evhz.c
 
  gcc -o evhz evhz.c
  
Then execute in root:
+
Then execute as root:
  
 
  ./evhz
 
  ./evhz
Line 60: Line 61:
  
 
== Further Reading ==
 
== Further Reading ==
[http://www.overclock.net/computer-peripherals/173255-cs-s-mouse-optimization-guide.html CS:S Mouse Optimization Guide] -- largely aimed at Windows users, though the same principles apply for Linux.
+
*[http://www.overclock.net/computer-peripherals/173255-cs-s-mouse-optimization-guide.html CS:S Mouse Optimization Guide] -- largely aimed at Windows users, though the same principles apply for Linux.
 
+
[http://en.gentoo-wiki.zugaina.org/index.php/HOWTO_Customize_Mouse_Polling_Rate HOWTO Customize Mouse Polling Rate] -- from Gentoo wiki
+
 
+
[http://www.linux-gamers.net/modules/wiwimod/index.php?page=HOWTO+USBPolling Increase Mouse Polling Rate Interval]
+
 
+
[http://tscherwitschke.de/mouseratechecker.html Mouse Rate Checker] (Windows)
+

Revision as of 04:58, 20 August 2013

If you have invested in a high resolution mouse, adjusting the USB polling rate is a common trick to utilise the added precision it brings. The polling rate (or report rate) determines how often the mouse sends information to your computer. Measured in Hz, this setting equates to lag time (in ms).

By default, the USB polling rate is set at 125hz. The table below represents combinations of Hz values and their corresponding delay time:

Hz ms
1000 1
500 2
250 4
125 8
100 10

If the polling rate is set at 125 Hz, the mouse cursor can only be updated every 8 milliseconds. In situations where lag is critical (for example games), it is useful to decrease this value to as little as possible. Increasing the polling interval will improve precision at the tradeoff of using more CPU resources, therefore care should be taken when adjusting this value.

Setting the polling rate

Here we are using the usbhid module of the kernel to set a custom "mousepoll" rate. Simply add the following line to your /etc/modprobe.d/modprobe.conf file:

options usbhid mousepoll=[polling interval]

(where [polling interval] is a number in ms from the table above. For example, to set a polling rate of 500Hz:

options usbhid mousepoll=2

To change the polling rate without rebooting

modprobe -r usbhid && modprobe usbhid
Warning: Make sure that both commands execute otherwise you will be unable to use the mouse and keyboard and will have to reboot or ssh into your machine.

Then unplug and replug your mouse.

Note: If you use the usbinput and udev hooks in your initramfs, usbhid will included on the image and you'll need to add /etc/modprobe.d/modprobe.conf to the FILES entry in /etc/mkinitcpio.conf. Remember to regenerate your image after changing the config. Without doing this, the module will be inserted during early userspace without the polling option. Alternatively, you can add usbhid.mousepoll=X to your kernel command line.

Displaying current mouse rate

A tool exists (named evhz) that can display the current mouse refresh rate -- useful when checking that your customized polling settings have been applied.

evhz.c

Compile it with:

gcc -o evhz evhz.c

Then execute as root:

./evhz

Alternatively, Windows tools such as DirectX mouserate checker can be run using WINE.

Further Reading