I'm running Firefox version 67 on Ubuntu 18.10 LTS.

I have a Logitech M-UAG120 mouse with a scrollwheel. The scrollwheel has a way to push it sideways to the left and to the right. What I need is for the pushing left action to do the same as Firefox's Alt-LEFT to go back a page, and the opposite operation for pushing the scrollwheel to the right. Right now, Firefox is not responding to either X events for either scrollwheel pushing operations. (I am calling these "pushing operations" because this is not the same as clicking the middle mouse button via pushing down vertically on the scrollwheel, which is working properly). The scrolling operation also works properly.

I ran xev and determined it is generating these X events:

  1. Left scrollwheel push operation: Button 6
  2. Right scrollwheel push operation: Button 7

I looked into http://kb.mozillazine.org/About:config and found nothing specific to those events, searched the web and came up short.

How do I configure the mouse, or Firefox, to either have the X events be consistent so that they produce the same behaviors? I do not want to install special drivers for this mouse if at all possible.

Update #1

On my Ubuntu 18.10 LTS desktop, which has a Logitech M525 Bluetooth mouse, the left and right scrollwheel push operations generates a different set of X events than the wired mouse used on my laptop, as seen from xev:

  1. Left scrollwheel push operation: Button 8
  2. Right scrollwheel push operation: Button 9

And this particular mouse's left/right scrollwheel push operations work as I expect it to.

Update #2:

I tested the Logitech M-UAG120 mouse again on both machines (my laptop and my desktop, both running Ubuntu 18.10 LTS), and the X events generated are consistently different than the Logitech M525 Bluetooth mouse.

I speculate that the specific X events are not standardized across mouse devices, but that is surprising since both mouse devices are from Logitech.

  • Do you use these "pushing operations" for anything else?
    – Avia Efrat
    Jun 6, 2019 at 21:03
  • @Avia For this specific mouse, on the laptop, those are the only things they are used for. What surprises me is that on my desktop, using a different Bluetooth mouse that also has a clickable scroll wheel, the back scroll wheel click operation works as expected on the Firefox browser. Same version of Ubuntu used on that desktop. Sure, the mouse on those machines is different, but I would have expected them to generate the same X events. I will run xev on the desktop machine using its mouse and update my question with the details.
    – bgoodr
    Jun 8, 2019 at 14:49
  • I posted Update #1 that shows that the desktop mouse generates different X events. I will also retest the wired mouse back on the desktop to see if that changes the X events generated, or if the mouse itself is hardcoded to generate those specific X events.
    – bgoodr
    Jun 8, 2019 at 15:03
  • I posted Update #2 to confirm that the M-UAG120 mouse is consistently generating different X events than the M525 mouse. So I wonder how I can force these X events to be generated the same? Or is it just to ditch this wired mouse and standardize on the M525 mouse ... at least that is what I'm concluding now.
    – bgoodr
    Jun 8, 2019 at 15:24
  • I posted a solution.
    – bgoodr
    Jun 8, 2019 at 21:31

1 Answer 1



I found the following solution:

I added /usr/share/X11/xorg.conf.d/71-Logitech-Optical-Tilt-Wheel-Mouse-M-UAG120.conf:

Section "InputClass"
        Identifier "Logitech Optical Tilt Wheel Mouse M-UAG120"
        MatchUSBID "046d:c019" 
        MatchDevicePath "/dev/input/event*"
        # I found that using this command:
        #   xinput --set-button-map 10 1 2 3 4 5 8 9 8 9
        #                                        ^ ^
        # The "^" above are the numbers I changed from 6 and 7 to 8 and 9, respectively.
        # That does the same thing as this ButtonMapping below:
        Option "ButtonMapping" "1 2 3 4 5 8 9 8 9"

And rebooted.

It is puzzling to me that restarting gdm display manager using sudo service gdm restart did not work: It prevented me from logging in (kept popping back to the password prompt even though I did not have CAPSLOCK on or anything), so I had to resort to rebooting.

TL;DR Reference Material

Reference material I found that was helpful to understand the above:

xinput to find the device id and button parameters

By device id, I mean the id=10 number below. By "button parameters" I mean the meaning of the parameters used in the ButtonMapping in the /usr/share/X11/xorg.conf.d/71-Logitech-Optical-Tilt-Wheel-Mouse-M-UAG120.conf files.

Grep to find the device after it is plugged in:

$ xinput --list | grep -i logit
⎜   ↳ Logitech USB Optical Mouse                id=10   [slave  pointer  (2)]

See what the system thinks are the meanings of the buttons:

$ xinput --list 10 | grep -i 'Button labels'
        Button labels: "Button Left" "Button Middle" "Button Right" "Button Wheel Up" "Button Wheel Down" "Button Horiz Wheel Left" "Button Horiz Wheel Right" "Button Side" "Button Extra" "Button Forward" "Button Back" None

I'm speculating that the quoted strings there are 1-based enumerated values corresponding to the ButtonMapping, but I don't have proof of that yet. So assuming that is correct, we can number them:

$ xinput --list 10 | grep -i 'Button labels' | sed 's%: %:\n%g; s%" "%"\n"%g' | sed '1d' | cat -n
     1  "Button Left"
     2  "Button Middle"
     3  "Button Right"
     4  "Button Wheel Up"
     5  "Button Wheel Down"
     6  "Button Horiz Wheel Left"
     7  "Button Horiz Wheel Right"
     8  "Button Side"
     9  "Button Extra"
    10  "Button Forward"
    11  "Button Back" None

That speculation also seems to jive with Logitech_Marble_Mouse -- Basic_function.

So the ButtonMapping positions for 8 and 9 correspond to the "browser back" and "browser forward" actions I want the system to pass to the Firefox X application. Since I wanted to preserve all other behaviors, the key line in the /usr/share/X11/xorg.conf.d/71-Logitech-Optical-Tilt-Wheel-Mouse-M-UAG120.conf file is:

Option "ButtonMapping" "1 2 3 4 5 8 9 8 9"
#                                 ^ ^

(The ^ marked the 6 and 7 parameters being changed, only).

Button Mapping

libinput(4) man page Button Mapping section describes the mechanism.

"libinput" is what I stumbled upon because at Ubuntu 16.04 and Logitech M570 it states:

Ubuntu 18.04 doesn't use the evdev driver by default anymore. It's been superseded by Libinput

Dynamically changing the button map using xinput command

input(1) man page has an option to directly verify the button parameters to the ButtonMapping option without restarting the display manager or X server:

--set-button-map device map_button_1 [map_button_2 [...]]
        Change the button mapping of device. The buttons are specified in physical order (starting with button 1) and are mapped to the logical button provided. 0 disables a but‐
        ton. The default button mapping for a device is 1 2 3 4 5 6 etc.

So the command that I could use, without having to reboot/restart anything, was:

$ xinput --set-button-map 10 1 2 3 4 5 8 9 8 9

Assigning buttons

Logitech_Marble_Mouse -- Assigning buttons is ArchLinux-specific and device-specific, but was still quite helpful, specifically where it states:

You may want to assign new actions for button presses. This is done by setting positional parameters. Values may be changed for buttons 1, 2, 3, 8, and 9. (Button 2 is simply a combination press of the two large buttons.) Do not alter parameters 4, 5, 6, or 7.

Except I actually did have to change the 6 and 7 parameters in my ButtonMapping for this mouse device. The above did not explain why it stated "Do not alter".

xorg.conf(5) man page

xorg.conf(5) man page shows how the conf files work, but be aware that, since the beheavior changes from release to release, be sure that you are on the correct release, as can be seen at the top of their web pages:

xorg.conf(5) annotated screenshot


Running the lsusb command (lsusb(8) man page) helped me identify the vendor and device id:

$ lsusb -d 046d:c019
Bus 001 Device 009: ID 046d:c019 Logitech, Inc. Optical Tilt Wheel Mouse

That is what I ended up using inside the MatchUSBID option in the InputClass section in the 71-Logitech-Optical-Tilt-Wheel-Mouse-M-UAG120.conf. See Govelius's answer to Trouble assigning different layouts to multiple simultaneous input devices in Linux.

/var/log/Xorg*.log files

Finding the most recently modified /var/log/Xorg.*.log files:

$ ls -ladtr /var/log/X*
-rw-r--r-- 1 root root 18922 Mar 17  2017 /var/log/Xorg.failsafe.log.old
-rw-r--r-- 1 root root 18922 Mar 19  2017 /var/log/Xorg.failsafe.log
-rw-r--r-- 1 root root 26019 Jun  8 12:20 /var/log/Xorg.2.log.old
-rw-r--r-- 1 root root 26019 Jun  8 12:21 /var/log/Xorg.2.log
-rw-r--r-- 1 root root 28910 Jun  8 12:45 /var/log/Xorg.0.log.old
-rw-r--r-- 1 root root 38010 Jun  8 12:45 /var/log/Xorg.1.log.old
-rw-r--r-- 1 root root 27869 Jun  8 12:57 /var/log/Xorg.0.log
-rw-r--r-- 1 root root 34901 Jun  8 12:57 /var/log/Xorg.1.log

Then grepping through it to see my ButtonMapping is showing up:

$ grep -n -B10 -i -H -e 'ButtonMapping' /var/log/Xorg.1.log
/var/log/Xorg.1.log-292-[   665.912] (**) Logitech USB Optical Mouse: Applying InputClass "libinput pointer catchall"
/var/log/Xorg.1.log-293-[   665.912] (**) Logitech USB Optical Mouse: Applying InputClass "Logitech Optical Tilt Wheel Mouse M-UAG120"
/var/log/Xorg.1.log-294-[   665.912] (II) Using input driver 'libinput' for 'Logitech USB Optical Mouse'
/var/log/Xorg.1.log-295-[   665.912] (II) systemd-logind: got fd for /dev/input/event5 13:69 fd 46 paused 0
/var/log/Xorg.1.log-296-[   665.913] (**) Logitech USB Optical Mouse: always reports core events
/var/log/Xorg.1.log-297-[   665.913] (**) Option "Device" "/dev/input/event5"
/var/log/Xorg.1.log-298-[   665.913] (**) Option "_source" "server/udev"
/var/log/Xorg.1.log-299-[   665.914] (II) event5  - Logitech USB Optical Mouse: is tagged by udev as: Mouse
/var/log/Xorg.1.log-300-[   665.914] (II) event5  - Logitech USB Optical Mouse: device is a pointer
/var/log/Xorg.1.log-301-[   665.914] (II) event5  - Logitech USB Optical Mouse: device removed
/var/log/Xorg.1.log:302:[   665.914] (**) Option "ButtonMapping" "1 2 3 4 5 8 9 8 9"

Logitech Optical Tilt Wheel Mouse M-UAG120 shows up and the subsequent ButtonMapping.

InputClass configuration

The libinput(4) man page InputClass Section describes all the options including the MatchUSBID option.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .