2

I am using a Logitech Trackman Marble Trackball on Ubuntu 22.04, Gnome Shell 42, Wayland.

I wish to simulate a middle mouse click with one of the extra side buttons, but it seems I am able to synthesize any type of button except the middle button.

  • I have created file at /etc/udev/hwdb.d/71-logitech-trackman.hwdb like so:
evdev:name:Logitech USB Trackball:*
 KEYBOARD_KEY_90004=btn_middle

I then run:

sudo systemd-hwdb update
sudo udevadm trigger

And physically reconnect the device.

  • Running sudo udevadm info /dev/input/event8 | grep btn_middle shows that the mapping has taken effect.
  • Running sudo evtest /dev/input/event8 outputs the correct mapping like so:
Event: time 1689266776.764313, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90004
Event: time 1689266776.764313, type 1 (EV_KEY), code 274 (BTN_MIDDLE), value 1
  • However, running sudo libinput debug-events --device /dev/input/event8 does not emit any output when I press the remapped button (though it does output correct lines for all other events).

Oddly, libinput does emit output if I choose any other target event, such as btn_left, btn_right, or even other buttons that the device does not have, such as btn_back, and these clicks are correctly reflected in the GUI. It appears to be only the middle button that cannot be emulated.

The behaviour is the same if I attempt to remap any of the four physical buttons.

What could be preventing the middle mouse button mapping from working?

2 Answers2

1

I wanted to map side button to left. Here is what I did.

Created file /etc/udev/hwdb.d/99-mouse.hwdb:

evdev:input:b*v062Ap4101*
 KEYBOARD_KEY_90004=btn_left

Where v062Ap4101 is USB device ID from lsusb command. Note all hex numbers have to be uppercase.

Default mapping is:

 KEYBOARD_KEY_90001=btn_left
 KEYBOARD_KEY_90002=btn_right
 KEYBOARD_KEY_90003=btn_middle
 KEYBOARD_KEY_90004=btn_side
 KEYBOARD_KEY_90005=btn_extra

Then:

  • $ sudo systemd-hwdb update - to update the database
  • $ sudo udevadm trigger /sys/class/input/event9 - to reload database
  • $ sudo udevadm test /sys/class/input/event9 - to validate it worked

For testing and dubugging I used $ sudo libinput debug-events . You can get event device number and more. Hope it helps.

0

I have similar issue and i solve it, try change you .hwdb file:

evdev:input:*
 KEYBOARD_KEY_90004=btn_middle