Updated on | #dpi, #mouse, #logitech | 4 User comments

Logitech G500s Laser Mouse buttons and XBindKeys in Ubuntu

You are looking for a Laser Mouse under Linux? I bought the Logitech G500s Laser Mouse, which features hyper-fast, dual-mode scrolling, 10 programmable keys as well as up to 27 grams of extra weight. As we know from Logitech, the Linux support is more than bad, but the kernel is able to identify the mouse. In this tutorial, I will show you how you can program the keys for optimal usability.

I was looking for a supported "Linux" mouse that offers a comfortable and robust design and which has customizable features for an good price. There are lots of mice on the market, that fits these points under windows. But I'm using Ubuntu together with Steam and the market for Ubuntu/Linux supported Hardware is not as great. After a little literature research I've found the G500s from Logitech. The reviews online magazine PCMag concluded:

"For a mouse that only differs from its predecessor in terms of sensor accuracy, the Logitech G500s is a surprisingly good mouse. While I didn't particularly care for the paint job—it looks like it's trying way too hard to convince me that it's cool—it's hard to argue with the actual performance. The Logitech G500s is a solid, accurate and straightforward gaming mouse. For the G500 fan that needs an upgrade, it's a no-brainer. For everyone else, while the Editors' Choice Corsair Vengeance M65 still leads with a slightly better design, the Logitech G500s is still worth a look."

and TomsGuide verticted:

"The Logitech G500s is nearly perfect. This gaming mouse embraces smart design choices at every avenue, and provides an experience that is neither minimalist nor ornate, but balanced in every sense. The G500s may not be the ideal mouse for every consumer and every genre, but it's pretty close. Unless you're a high-level massively multiplayer online gamer and need a plethora of thumb buttons, you'd be wise to consider the G500s in your search for a gaming mouse."

Therefore, I considered the G500s in my search. The most advantage is, that this gaming mouse has 10 programmable buttons, that can be configured under Linux. You can find an overview about the Logitech G500 buttons that can be used under linux in the following table:

1Left Click
This is the button config for the G500S
2Middle Click
3Right Click
4Scroll Wheel Up
5Scroll Wheel Down
6Scroll Wheel click to the left
7Scroll Wheel click to the right
8Sound Lower
9Sound Louder
10Extra Button (e.g. Dash)
i1DPI up
i2DPI down
i3Dual Mode Scrolling

You can find more information about this mouse on the Logitech Homepage.

Identify Hardware

In my case, all buttons are detected under Kernel 4.8. You can check your Kernel version with:

  1. uname -a
Linux thomas 4.8.0-26-generic #28-Ubuntu SMP Tue Oct 18 14:39:52 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Furthermore, have a look if your G500s is identified correctly:

  1. dmesg | grep G500s
[    2.560081] usb 4-4: Product: G500s Laser Gaming Mouse  
[    2.575358] input: Logitech G500s Laser Gaming Mouse as /devices/pci0000:00/0000:00:04.0/usb4/4-4/4-4:1.0/input/input5  
[    2.575479] hid-generic 0003:046D:C24E.0002: input,hidraw1: USB HID v1.11 Mouse [Logitech G500s Laser Gaming Mouse] on usb-0000:00:04.0-4/input0  
[    2.591182] input: Logitech G500s Laser Gaming Mouse as /devices/pci0000:00/0000:00:04.0/usb4/4-4/4-4:1.1/input/input6  
[    2.591306] hid-generic 0003:046D:C24E.0003: input,hiddev0,hidraw2: USB HID v1.11 Keyboard [Logitech G500s Laser Gaming Mouse] on usb-0000:00:04.0-4/input1  
  1. lsusb | grep Logitech
Bus 010 Device 003: ID 046d:c24e Logitech, Inc. G500s Laser Gaming Mouse

Power Control

With the latest Kernel 4.4 RC4, I have a problem of mouse disconnects while steam gaming. You can prevent this by using Udev rules to automate power management of the G500s. You need to create a udev rule and insert the following code:

  1. sudo nano /etc/udev/rules.d/99-logitech-mouse.rules
  1. ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c24e", ATTR{product}=="G500s Laser Gaming Mouse", TEST=="power/control", ATTR{power/control}="on"

Restart your PC and Udev is using this rule.

Installation and configuration of XBindKeys

XBindKeys allows you to launch shell commands with your keyboard or your mouse in Unity or Gnome. You have to install it in Ubuntu with

  1. sudo apt-get install xbindkeys xautomation

and to edit or create ~/.xbindkeysrc with gedit ~/.xbindkeysrc in order to insert the xbindkey's button-to-key config:

  1. # Paste with the middle key
  2. "xte 'keydown Control_L' 'key V' 'keyup Control_L'"
  3.   b:2
  5. # Scroll Left = "previous Tab" in Browser
  6. "xte 'keydown Alt_L' 'key Left' 'keyup Alt_L'"
  7.   b:6
  9. # Scroll right = "next Tab" in Browser
  10. "xte 'keydown Alt_L' 'key Right' 'keyup Alt_L'"
  11.   b:7
  13. # Sound Lower
  14. "xte 'key XF86AudioLowerVolume'"
  15.   b:8
  17. # Sound Louder
  18. "xte 'key XF86AudioRaiseVolume'"
  19.   b:9
  21. #Present Windows
  22. "xte 'key Super_L'"
  23.   b:10

After this you can test the binded keys with

  1. xbindkeys -f ~/.xbindkeysrc

in your shell.

Start XBindKey on Ubuntu startup

You can use gnome-session-properties to start XBindKeys on computer startup. A good description to create a startup application you can find in the Ubuntu Wiki under AddingProgramToSessionStartup.

The settings looks like this:

  • Name: XBindKeys
  • Command: /usr/bin/xbindkeys_autostart
  • Description: Starts XBindKeys. Config can be set in ~/.xbindkeysrc

Control the dpi rate under Ubuntu for Logitech G500

Vladyslav Shtabovenko created a small app for tweaking the Logitech G500 gaming mouse under Linux. This software allows you to configure the hardware settings of the G500 gaming mouse, e.g. dots per inch (dpi) resolution, USB report rate or angle snapping. Normally you can only do this by using Windows with the Logitech SetPoint Software. This tool will flash your lovely settings directly into the G500's internal profile. The dpi rate relates directly to the mouse reading, along with the movement on screen. In other words, if you use a 1024x786 screen resolution, and you having a 1000DPI mouse, it would 'technicly' take 1 inch to move from one side to the other.

At first you need to download the software from GitHub.

  1. mkdir /tmp/g500 && cd /tmp/g500
  2. git clone https://github.com/vsht/g500-control.git

Now, you are able to install this tool very easily:

  1. cd g500-control
  2. make
  3. sudo make install

After the successful installation, g500-control is available with /usr/sbin/g500-control.

Examples for g500-control

DPI 400, 800 and 2000

This example corresponds to G500's factory settings with 500 USB report rate, angle snapping disabled and 3 dpi resolutions (400, 800 and 2000). The dpi buttons are used to switch between the 3 dpi values.

  1. sudo g500_control /dev/usb/hiddev0 --urr_default --as_default --dpi_default

DPI 1600 for both axes

In this example only one dpi resolution (1600 dpi for both axes) is set. The DPI buttons can be mapped to anything you want via xbindkeys or similar tools.

  1. sudo g500_control /dev/usb/hiddev0 --urr_default --as_default --dpi_1 1600 1600

DPI 1600 for both axes and with higher USB report rate

This examples looks like the same as above, but now we increase USB report rate from 500 to 1000 and enable angle snapping.

  1. sudo g500_control /dev/usb/hiddev0 --1000 --as_on --dpi_1 1600 1600

Different dpi resolutions for each axis

In this example we increase USB report rate from 500 to 1000 and enable angle snapping. Furthermore, we also use different dpi resolutions for each axis. For the x axis it's 3200 and for the y axis it's 4000.

  1. sudo g500_control /dev/usb/hiddev0 --1000 --as_on --dpi_1 3200 4000

G500s dpi profiles

Now we can change to an more interesting example. We set 3 different dpi resolutions: 800, 1600 and 5700 (equal for both axes). The dpi buttons (+/-) are used to switch between these. Moreover, we explicitly set USB repeat rate to 500 and disable angle snapping.

  1. sudo g500_control /dev/usb/hiddev0 --500 --as_off --dpi_3 800 800 1600 1600 5700 5700 dpi_btn_up
Change switch buttons

This example is the same as same as G500s dpi profile but here we use (<-/->) as dpi buttons.

  1. sudo g500_control /dev/usb/hiddev0 --500 --as_off --dpi_3 800 800 1600 1600 5700 5700 dpi_btn_side
5 different dpi's

In this example, we set 5 different dpi resolutions: 800, 1600, 3200, 4800 and 5700 (equal for both axes). The dpi buttons (+/-) are used to switch between these. Moreover, we explicitly set USB repeat rate to 333 and enable angle snapping.

  1. sudo g500_control /dev/usb/hiddev0 --333 --as_on --dpi_5 800 800 1600 1600 3200 3200 4800 4800 5700 5700 dpi_btn_up
... and other switches

In this example, we set 5 different dpi resolutions: 800, 1600, 3200, 4800 and 5700 (equal for both axes). The dpi buttons (+/-) are used to switch between these.

  1. sudo g500_control /dev/usb/hiddev0 --333 --as_on --dpi_5 800 800 1600 1600 3200 3200 4800 4800 5700 5700 dpi_btn_up
... ,other switches and a second resolution

This example is similar to the above, but the second resolution has now different values for the axes: 1600 dpi for the x axis and 1000 dpi for the y axis

  1. sudo g500_control /dev/usb/hiddev0 --333 --as_on --dpi_5 800 800 1600 1000 3200 3200 4800 4800 5700 5700 dpi_btn_up

Well, what do you think?

Pömpel said
u know that u r talking about g500s and the program u mentioned is for g500 ?
Alexis Calles said
Hi Ludwig,
Thank you very much for this very clear and helpful guide (https://ludwig.im/en/projects/logitech-g500s-in-ubuntu), you should work for logitech ^^
I'm having a very strange issue with my Logitech G500s, in windows, everything works perfectly but in Ubuntu the 10th button is not working at all (I tried xev and xinput --test 11) but it shows nothing for the 10th button :-(
Do you have any idea of where I should start to fix this issue? Thank you!
BTW your contact form is not working because of the Recaptcha refusing to validate... (tested many times with Firefox and Opera)
Thomas Ludwig said
Hi Alexis,

its a long time ago but I dont know why its not showing the 10th button. I hope you could solve it.


Skalli said
Yup. I'm under arch and have the same problem. The 10th button is not recognized at all. I've also tried xev. In Windows I use it as second middle mouse button since pressing the scrollwheel is a long way and error prone.
Have you got it working?
Comments powered by LudwigDisqus for ModX