I am trying to use a Logitech G400 Mouse on a PC with Ubuntu 14.04.

However, I can't make Ubuntu recognise two of its buttons (DPI+ and DPI-).

How can I make these buttons recognised?

Apparently, this question is related to a previous one but I could not find a solution there or anywhere else.


Logitech G400 Optical Gaming Mouse

$ uname -a
Linux 3.13.0-53-generic #89-Ubuntu SMP Wed May 20 10:34:39 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.2 LTS
Release:        14.04
Codename:       trusty

Results from xev:

  • Left-click : Button 1
  • Middle-click : Button 2
  • Right-click : Button 3
  • Wheel Up : Button 4
  • Wheel Down : Button 5
  • Thumb Forward: Button 8
  • Thumb Back : Button 9
  • Task Switcher : Button 10
  • DPI+ : no response from xev
  • DPI- : no response from xev
  • There is no solution so far. Linux does not support proprietary mode for this mouse.
    – Pilot6
    Jun 2, 2015 at 8:35
  • I am using exactly this mouse on my Ubuntu 15.04 (and older versions before). Does the cursor speed change, after you change the dpi? Jun 2, 2015 at 8:58
  • I use this mouse on my desktop with openSUSE and btnx. It recognizes all buttons and lets me configure them. I have not tried to compile btnx on Ubuntu (unfortunately it is not in the repos). However, it definitely is worth a try. though strangly enough the two buttons you mention work fine even without configuration on the openSUSE box...and I think they were also working on my Ubuntu 14.04 laptop (going to check this)
    – Bruni
    Jun 2, 2015 at 9:37
  • @davidbaumann: my problem is exactly that the DPI+ and DPI- are not recognised, so I can't change the dpi with them. You can use xinput instead to change the cursor speed.
    – toliveira
    Jun 3, 2015 at 11:13
  • @Bruni, thank you, I will try btnx. This mouse and all its buttons worked out of the box on my laptop, but not on my desktop. I can't find the difference between the two machines.
    – toliveira
    Jun 3, 2015 at 11:14

1 Answer 1


I might have a solution...

I wrote a tool recently, https://github.com/rprichard/logitech-g400-config, that allows configuring both the polling rate (125 Hz -- 1000 Hz) and the DPI setting. (My motivation was to avoid horrific lag when moving windows, e.g. https://www.youtube.com/watch?v=mwBH_AkhW_Q.)

To develop the tool, I examined the USB traffic from the Windows Logitech software using Wireshark. I noticed the software using two HID "feature reports": one for the sampling rate and another for the DPI level. The DPI level report had ID 0x8e with a second byte of 3, 4, 5, or 6. I think they correspond to 400, 800, 1800, and 3600 DPI.

During development of this script, though, I noticed that the device is also happy with a DPI level of 7. It turns out that if I set the DPI to 7, then the DPI+/DPI- buttons no longer adjust the DPI and instead send an event visible with xev. The DPI-default button is always visible with xev.

I'm guessing that DPI-6 and DPI-7 are both 3600 DPI. (My other guess had been that DPI-7 would retain the pre-7 DPI (e.g. DPI-3 followed by DPI-7 would be 400 DPI), but that doesn't appear to be the case.)

To set DPI-7, just run logitech-g400-config.py set -d3600_frozen (after installing libhidapi and maybe setting up udev -- see the README for details). The high DPI might make the mouse pointer very fast. I'm personally using DPI-5 right now with a bunch of xinput settings to tweak the acceleration.

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.