Howto customise mouse polling rate

From QWiki

This page was taken from the Gentoo wiki, you might not need to read all of this and it might not apply. Generally, you just need to load the kernel module usbhid with option mousepoll=N, where N is the duration in seconds between each poll. ("sudo modprobe -r usbhid && sudo modprobe usbhid mousepoll=1" for 1000hz.)
Refer to documentation from your own distribution if you are unsure about loading this automatically, etc.

It may also be beneficial to use raw mouse input (in_mouse 3) for a smoother mouse. See the mouse section in Smooth Quake in Linux


Preface

Increasing your mouse polling rate is a common tweak which many gamers perform on their systems. This article will describe the method of setting your mouse's polling rate. As Linux is a highly configurable operating system (especially Gentoo), we first need to determine whether or not the USB HID driver, USBHID, is compiled as a module, or whether it's compiled directly into the kernel. As such, this HowTo is based on the output of the following command which tells you how your kernel supports USBHID:

  1. zgrep CONFIG_USB_HID= /proc/config.gz 
  * If CONFIG_USB_HID=y (if USBHID is compiled into your kernel) then you will need to proceed with the next subsection; configuring your bootloader.
  * If CONFIG_USB_HID=m (if USBHID is compiled as a module) then you may proceed with the modprobe.d method. We are trying to accomplish the same thing in both sections, which is to tell the USBHID module of the kernel to set a custom "mousepoll" rate. 

The mousepoll argument accepts an integer, the interval between mouse polls in milliseconds. The default is 10 milliseconds or 100Hz.

  * 1 = 1000Hz
  * 2 = 500Hz
  * 4 = 250Hz
  * 8 = 125Hz
  * 10 = 100Hz (Default) 

Mousepoll is specified in milliseconds, for example, mousepoll=2 would yield 1000/2 = 500Hz. The default mousepoll rate is 10ms or 100Hz. It is recommended that most Logitech mice use mousepoll=2, whilst Razer mice can accept a polling rate of 1. A list of known-to-work polling rates may be found at the end of this article. From experience, a Logitech MX500 works fine with a polling rate of 1000Hz, but that is unnecessarily high. [edit] Bootloader method for CONFIG_USB_HID=y

This section is split into two as there are two major bootloaders, Grub and LILO. The concept for both is the same, we have to append usbhid.mousepoll=2 to the kernel at boot time. [edit] Grub

  You need to append "usbhid.mousepoll=2" to the kernel section of your kernel in your /boot/grub/grub.conf file. 
  Here's an example for a modern Gentoo system: 

File: /boot/grub/grub.conf - An example for a modern Gentoo system

default 0

timeout 5 splashimage=(hd0,0)/boot/grub/splash.xpm.gz

title=Gentoo Linux 2.6.18-r2 root (hd0,0) kernel /boot/kernel-genkernel-x86-2.6.18-gentoo-r2 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/hda3 usbhid.mousepoll=2 udev initrd /boot/initramfs-genkernel-x86-2.6.18-gentoo-r2


LILO

  The append line of the image section for the kernel which you load needs to contain "usbhid.mousepoll=2" 
  Here's an example for a modern Gentoo system: 

File: A section of /etc/lilo.conf for a similar system

boot=/dev/hda

prompt timeout=50 default=Gentoo

image=/boot/kernel-genkernel-x86-2.6.18-gentoo-r1

 label=Gentoo
 read-only
 root=/dev/ram0
 append="init=/linuxrc ramdisk=8192 real_root=/dev/hdc3 usbhid.mousepoll=2 udev"
 initrd=/boot/initramfs-genkernel-x86-2.6.18-gentoo-r1


Modprobe.d method for CONFIG_USB_HID=m

We are presented with yet another decision: do we want always want a custom mouse polling rate, or would we rather manually set it (as the superuser) each time we want to change it - and every time the computer reboots the settings will disappear. [edit] Automatically set mouse polling on boot

This method is simpler than the above bootloader method, we simply need to add "options usbhid mousepoll=2" to /etc/modprobe.d/usbhid This can be accomplished by executing the following command as root:

  1. echo "options usbhid mousepoll=2" > /etc/modprobe.d/usbhid 

The result should be as follows. File: /etc/modprobe.d/usbhid

options usbhid mousepoll=2

You would be wise to ensure that the module loads upon boot, append "usbhid" to the file /etc/modules.autoload.d/kernel-2.6 (or kernel-2.4 for a 2.4 kernel) File: /etc/modules.autoload.d/kernel-2.6

  1. /etc/modules.autoload.d/kernel-2.6: kernel modules to load when system boots. 
  1. Note that this file is for 2.6 kernels.
  2. Add the names of modules that you'd like to load when the system
  3. starts into this file, one per line. Comments begin with # and
  4. are ignored. Read man modules.autoload for additional details.
  1. For example:
  2. 3c59x

usbhid


Manually set polling interval

To customize your polling interval during runtime, you will need to simply execute the following command as the superuser (root)

  1. modprobe usbhid mousepoll=2 


Mouse settings known to work

Logitech MX300 500hz
Logitech MX310 500hz
Logitech MX400 500hz
Logitech MX500 500hz
Logitech MX510 500hz
Logitech MX518 500hz
Logitech G3 1000hz
Logitech G5 1000hz
Logitech G7 >1000hz
Logitech G9 1000hz
Microsoft IntelliMouse 1.1(SE) 500hz
Microsoft IntelliMouse 3.0 500hz
Microsoft IntelliMouse 4.0 500hz
Microsoft Habu 1000hz
Razer Copperhead 1000hz
Razer Krait 1000hz
Razer Viper 1000hz
Razer DiamondBack 1000hz
Razer DeathAdder 1000hz

Retrieved from "http://en.gentoo-wiki.com/X11_Mouse/Change_Mouse_Resolution"

See also

Smooth Quake in Linux