I'm using Logitech MX anywhere 2S mouse on Fedora 27, but only the left/right buttons and wheel up/down buttons are recognized by xev. I'm looking for a way to map the three remaining buttons.

Here're the buttons of that mouse

I want button 3 and 8 in the picture above mapped. Can someone help me?


So I tried evtest mentioned in the comment, and I got

Testing ... (interrupt to exit)
Event: time 1513145549.654477, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90003
Event: time 1513145549.654477, type 1 (EV_KEY), code 274 (BTN_MIDDLE), value 1
Event: time 1513145549.654477, -------------- SYN_REPORT ------------
9:48 / 16:31
Event: time 1513145549.806472, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90003
Event: time 1513145549.806472, type 1 (EV_KEY), code 274 (BTN_MIDDLE), value 0
Event: time 1513145549.806472, -------------- SYN_REPORT ------------
Event: time 1513145555.448316, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90005
Event: time 1513145555.448316, type 1 (EV_KEY), code 276 (BTN_EXTRA), value 1
Event: time 1513145555.448316, -------------- SYN_REPORT ------------
Event: time 1513145555.594292, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90005
Event: time 1513145555.594292, type 1 (EV_KEY), code 276 (BTN_EXTRA), value 0
Event: time 1513145555.594292, -------------- SYN_REPORT ------------
Event: time 1513145558.152251, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90004
Event: time 1513145558.152251, type 1 (EV_KEY), code 275 (BTN_SIDE), value 1
Event: time 1513145558.152251, -------------- SYN_REPORT ------------
Event: time 1513145558.298240, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90004
Event: time 1513145558.298240, type 1 (EV_KEY), code 275 (BTN_SIDE), value 0
Event: time 1513145558.298240, -------------- SYN_REPORT ------------

Those are buttons at 2 and 8 in the picture. And I use xbindkeys to remap those buttons and it works.


After I updated some packages and rebooted, I can't find those buttons in evtest, why's that?

It seems that I need to re-connect my mouse to make it work and I don't even need xbindkeys started to do so.

  • 2
    Do they generate events at all? Look at the raw input device to see. – Ignacio Vazquez-Abrams Dec 12 '17 at 5:37
  • How? Is it xev and press the corresponding buttons? – Turgon Dec 12 '17 at 5:44
  • 1
    @Turgon try with evtest too... (lsinput will help you find the right device.) – Stephen Kitt Dec 12 '17 at 6:45
  • In addition to evtest, look at the new lines in dmesg after you connect the mouse and/or the controller (you didn't say what kind of mouse it is). If there's a hidraw device, look at that. There was some other question where it turned out the Logitech wireless controller produces two HID devices, and some mouse events end up on one, some on the other. Maybe try to find that question for details. – dirkt Dec 12 '17 at 11:09

Make sure you don't have any of the mouse buttons listed in your .xbindkeysrc yet as they won't not show up in xev if you do (at least on my system).

You can also try upgrading your Linux kernel as this mouse is relatively new.

Here are the actual button numbers from xev: key mapping for Anywhere 2s Source: https://deepmi.me/etc/18869/

  • Actually, I think the problem in my EDIT has something to do with my mouse. Sometimes when I switch the mouse to my laptop (Windows) and then switch back to my PC, those buttons simply won't work. In any case, I can make them work by reconnecting the mouse. – Turgon Nov 6 '18 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.