I have a very specific need to change the mousepoll value in Ubuntu 15.04.

In Kerbal Space Program there's a Linux bug where if you drag the view with the right mouse button while the mousepoll value is higher than 125hz the game will hang for a second or two making it very frustrating to play.

I have a Logitech G400 mouse that polls at up to 1000hz. I cannot work out how to change this.

I have tried:

  • Setting options usbhid mousepoll=8 in /etc/modprobe.d/usbhid
  • Setting usbhid.mousepoll=8 on the command line while booting
  • Running sudo modprobe -r usbhid && sudo modprobe usbhid mousepoll=8 from the command line

These are somewhat effective in that cat /sys/module/usbhid/parameters/mousepoll returns 8 as expected. But the problem remains in KSP, and when I run evhz from https://github.com/ian-kelling/evhz it still reports polling rate of 1000hz.

Possibly relevant:

  • I'm on a laptop. The touchpad isn't using usbhid and polls at 125hz according to evhz. No problems doing the right click panning in KSP using this.
  • Xfce 4.12 (tried with compositing enabled and disabled, no change)
  • Nvidia 346.59 drivers
  • Performance in KSP is otherwise as expected based on my laptop's hardware
  • Packages (including kernel) are all stock
  • Mouse is plugged into a USB 3.0 port

I did find a solution to this problem.

I installed Windows in a virtual machine, attached the USB mouse device to the VM, then traced the USB traffic with Wireshark and isolated the control command that the official Logitech driver used to set the polling rate. (This was quite helpful in pointing me in the right direction: https://unix.stackexchange.com/questions/138742/how-to-dump-usb-traffic)

This magic Ruby code (must be run as root, or by a user with permission to write to /dev/hidraw1) will set the polling rate to 125Hz on my mouse:


f = File.open("/dev/hidraw1", "w+")

/dev/hidraw1 is the hidraw device for my mouse. This path may be different depending on how many devices you have plugged into your machine.

The 0xC0024806 sequence is the ioctl value required to "Send a feature report" to the hidraw device. I can't remember exactly how I obtained this value unfortunately, and it may not be 100% technically correct. Works for me though!

The "\x20\x03" sequence was the data that the driver sent in the feature report to the mouse. 20 appears to be the value in hex used to identify a polling change request, and 03 sets it to 125hz. 02 sets it to 250hz, 01 to 500Hz and 00 to 1000hz.

BE WARNED: This works for me on a Logitech G400 mouse. I think there's only one hardware variant of this mouse so it should be safe on that model. It hasn't been tested on any other model, and will not work on any Logitech mouse that uses the HID++ protocol to communicate (this includes many newer mice, and any wireless models using the Unifying receiver).

I also barely knew what I was doing, and every single thing I did to figure it out was learned for the first time along the way, including this phrase: Caveat lector (reader beware)!

  • Thank you for this, that script worked out of the box. I also have a G400 and none of the usual usbhid methods worked. – pileofrocks Apr 2 '19 at 10:09

I had the same problem with a Logitech G302.

Planetary annihilation mouse lag problem

Unfortunately, it seems that the Logitech mouse does not support reducing the mouse polling rate.

But if it is really necessary, you can reduce it by hardware by connecting your mouse to a slower usb port.

Using evhz, I noticed the mouse polling rate reduced from 1000Hz to 250Hz with a different usb port.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.