Score:1

Unable to remap `btn_middle` to libinput using hwdb

ar flag

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?

Zzzach... avatar
id flag
Have you explored the second solution here? https://unix.stackexchange.com/a/662684/135544 It does not use udev, instead a separate program to remap your side buttons to middle mouse. My searches show others have been able to remap these exact keys to middle mouse. Any chance you have some other operation/program blocking middle mouse you may have forgotten of?
ar flag
@AlwaysTalkingAboutMyDog Thanks, I had tried input-remapper, but sadly it conflicts with scroll-wheel-emulation which I am also using (https://github.com/sezanzeb/input-remapper/issues/124). Certainly, something must be blocking remapping to btn_middle, but I cannot determine what it might be.
Zzzach... avatar
id flag
Scroll-wheel-emulation seems suspicious here, there's a good chance it is interfering with the middle-mouse button if you say it conflicts with input-remapper. I think you've identified the problem yourself here - some conflict between scroll-wheel-emulation and other input changers/simulators. Likely not going to resolve this without investigating scroll-wheel-emulation in more detail on how it captures/blocks/suspends certain mouse clicks under different conditions.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.