Logitech G500 and Linux · uwot.eu
another meaningless subtitle

Logitech G500 and Linux

· by fabio · Read in about 6 min · (1221 Words)
acceleration angle snapping fedora G500 linux logitech mouse speed

Despite not being a gamer at all I see having a decent mouse as an important thing, I spend 10 to 15 hours a day in front of my PC and probably for at least half of the time I’m using the mouse, so I don’t get why I should not have the best input peripherals on the market.
My current mouse is a Logitech G500 (NP 910-001262), of course it being the best mouse on the market is an highly debatable thing since, along side with the keyboard, mouse choice is highly subjective.
G500 is something you love or you hate, starting from the unusual scroll wheel, going to the sensor position to the strange side buttons there are a lot of uncommon things.
This small write-up is not meant to be a review nor a guide, I would like it to be just a bunch of tips from someone who is using a G500 on a Linux box.
First of all: this mouse has no angle snapping, or better, out of the box angle snapping is enabled (Logitech, why? seriously, none like angle snapping) but it can be disabled from drivers.
Obviously drivers are available only for Windows (Logitech…) and I don’t seem to be able to change mouse settings from a virtual machine (VMware Workstation 9), anyway I didn’t put much time on this so it could be doable.
So what I suggest is plug G500 in a physical Windows machine, install drivers and tune the settings, once you are done, save settings on G500 internal memory and plug it in your Linux machine.
Once in Linux, which in my case is Fedora 18 and XFCE as DE, there are still acceleration issues which can be solved quite easily using “xinput”.
– Someone report that G500 sensor is “flawed” and it has some kind of “built-in” acceleration, honestly I don’t see it but could be that I’m just used to it –

xinput list

display devices, in my case result is what follow:

⎡ Virtual core pointer                        id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Logitech G500                             id=11   [slave  pointer  (2)]
⎜   ↳ Logitech G500                             id=12   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Power Button                              id=7    [slave  keyboard (3)]
    ↳ Gaming Keyboard                           id=8    [slave  keyboard (3)]
    ↳ Gaming Keyboard                           id=9    [slave  keyboard (3)]
    ↳ G11 Keyboard                              id=10   [slave  keyboard (3)]

pick the right device, which in my case is “id=12” and type:

xinput list-props 12

this will print a bunch of settings with their current values:

Device 'Logitech G500':
    Device Enabled (141):   1
    Coordinate Transformation Matrix (143): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    Device Accel Profile (271): 0
    Device Accel Constant Deceleration (272):   1.000000
    Device Accel Adaptive Deceleration (273):   1.000000
    Device Accel Velocity Scaling (274):    10.000000
    Device Product ID (260):    1133, 49256
    Device Node (261):  "/dev/input/event2"
    Evdev Axis Inversion (275): 0, 0
    Evdev Axes Swap (277):  0
    Axis Labels (278):  "Rel X" (151), "Rel Y" (152), "Rel Horiz Wheel" (269), "Rel Vert Wheel" (270)
    Button Labels (279):    "Button Left" (144), "Button Middle" (145), "Button Right" (146), "Button Wheel Up" (147), "Button Wheel Down" (148), "Button Horiz Wheel Left" (149), "Button Horiz Wheel Right" (150), "Button Side" (264), "Button Extra" (265), "Button Forward" (266), "Button Back" (267), "Button Task" (268), "Button Unknown" (263), "Button Unknown" (263), "Button Unknown" (263), "Button Unknown" (263), "Button Unknown" (263), "Button Unknown" (263), "Button Unknown" (263), "Button Unknown" (263), "Button Unknown" (263), "Button Unknown" (263), "Button Unknown" (263), "Button Unknown" (263)
    Evdev Middle Button Emulation (280):    0
    Evdev Middle Button Timeout (281):  50
    Evdev Third Button Emulation (282): 0
    Evdev Third Button Emulation Timeout (283): 1000
    Evdev Third Button Emulation Button (284):  3
    Evdev Third Button Emulation Threshold (285):   20
    Evdev Wheel Emulation (286):    0
    Evdev Wheel Emulation Axes (287):   0, 0, 4, 5
    Evdev Wheel Emulation Inertia (288):    10
    Evdev Wheel Emulation Timeout (289):    200
    Evdev Wheel Emulation Button (290): 4
    Evdev Drag Lock Buttons (291):  0

.:. ACCELERATION

The value associated to “Device Accel Profile (271)” is what determines how X handles pointers acceleration.
Like a superuser.com user suggested, possible values for this setting are:

-1: none no velocity-dependent pointer acceleration or deceleration. If constant deceleration is also unused, motion processing is suppressed, saving some cycles.
0: classic (the default) similar to old behaviour, but more predictable. Selects between 'polynomial' and 'simple' based on threshold =/!= 0.
1: device-dependent available if the hardware driver installs it. May be coming for synaptics.
2: polynomial Scales polynomial: velocity serves as the coefficient, acceleration being the exponent. Very useable, the recommended profile.
3: smooth linear scales mostly linear, but with a smooth (non-linear) start.
4: simple Transitions between accelerated/unaccelerated, but with a smooth transition range. This has the fundamental problem of accelerating on two niveaus, on which acceleration stays independent of velocity. Traditionally the default however.
5: power accelerates by a power function. velocity is the exponent here. Adheres to threshold. Will easily get hard to control, so it is important you have properly tuned your velocity estimation.
6: linear just linear to velocity and acceleration. Simple and clean.
7: limited smoothly ascends to acceleration, maxing out at threshold, where it becomes flat (is limited).

Obviously “-1” is what we want if we decide to completely disable acceleration, so:

xinput set-prop 12 271 "-1"

Mouse pointer speed can be adjusted tuning “Device Accel Constant Deceleration (272)”, higher values for lower speed.
An issue I still can’t solve is increasing pointer speed in case it’s too low when acceleration is disabled.
– Just for reference: right now I’m using a 1800 DPI profile with angle snapping and acceleration disabled –

.:. ACCELERATION ENABLED AND POINTER SENSIBILITY

Another useful command which will come handy in case we decide to keep acceleration active is “xset”, “man xset” will explain pretty much all but for the lazy here’s how it works.
It gives the ability to set an acceleration value and a threshold value that when is triggered makes the pointer accelerate, usage is pretty straight forward.

xset q

print current values, then to edit “Pointer Control” section we have to use:

xset mouse _value_ _threshold_

.:. USB POLLING RATE

Another thing that can be done to improve mouse usability and in general user experience is set an higher USB polling rate, here the thing become a bit more complex and more distro specific.
Fedora 18 x64 with kernel version 3.8.9-200.fc18.x86_64 has “usbhid” module included, so it cannot be worked with modprobe and stuff; to force USB polling rate at the desired level is required to add a kernel startup parameter.
In Fedora 18 open with root privilege “/etc/default/grub” and add “usbhid.mousepoll=xxx” with “xxx” equal to “1” if 1000Hz, “2” if 500 Hz, “4” if 250 Hz, “8” if 125 Hz and “10” if 100 Hz.
Once we are done just rebuild the actual “grub.cfg” file using “grub2-mkconfig -o /boot/grub2/grub.cfg”.
– BE CAREFUL TO NOT MESS UP THIS STUFF –
If usbhid module is compiled as an external module and systemd is used read “man modules-load.d”, if with systemv add a script to “/etc/modules” directory.
Command “cat /sys/module/usbhid/parameters/mousepoll” can be used to probe current USB polling rate.