4

I recently got a Logitech M500:

Bus 002 Device 004: ID 046d:c069 Logitech, Inc. M500 Laser Mouse

It has nine buttons that I can identify:

  • Two on the left side
  • Left, right
  • Wheel press
  • Wheel scroll up, wheel scroll down
  • Wheel press left, wheel press right

The last two are driving me insane. Every time I try to click the wheel, I accidently hit the "wheel press left" button and Firefox goes to the last visited page. It is very annoying.

Easy enough, right? Just find out which buttons xev shows and disable them. Wrong! xev does not generate "ButtonPress/ButtonRelease" events, but strange "LeaveNotify/EnterNotify/KeymapNotify" pairs:

 LeaveNotify event, serial 40, synthetic NO, window 0x4a00001,
    root 0x94, subw 0x0, time 2344319, (104,86), root:(113,207),
    mode NotifyGrab, detail NotifyAncestor, same_screen YES,
    focus YES, state 0

EnterNotify event, serial 40, synthetic NO, window 0x4a00001,
    root 0x94, subw 0x0, time 2344319, (104,86), root:(113,207),
    mode NotifyUngrab, detail NotifyAncestor, same_screen YES,
    focus YES, state 0

KeymapNotify event, serial 40, synthetic NO, window 0x0,
    keys:  4294967188 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

Now surely, the 4294967188 (-108 in twos complement as 32 bit integer if that helps) will be the keycode, right? Wrong again! It's the same number for both the horizontal wheel left/right and the side back/front buttons.

Here's my xinput list of the device:

Logitech USB Laser Mouse                    id=15   [slave  pointer  (2)]
    Reporting 7 classes:
        Class originated from: 15. Type: XIButtonClass
        Buttons supported: 16
        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" "Button Task" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown"
        Button state:
        Class originated from: 15. Type: XIValuatorClass
        Detail for Valuator 0:
          Label: Rel X
          Range: -1.000000 - -1.000000
          Resolution: 1 units/m
          Mode: relative
        Class originated from: 15. Type: XIValuatorClass
        Detail for Valuator 1:
          Label: Rel Y
          Range: -1.000000 - -1.000000
          Resolution: 1 units/m
          Mode: relative
        Class originated from: 15. Type: XIValuatorClass
        Detail for Valuator 2:
          Label: Rel Horiz Wheel
          Range: -1.000000 - -1.000000
          Resolution: 1 units/m
          Mode: relative
        Class originated from: 15. Type: XIValuatorClass
        Detail for Valuator 3:
          Label: Rel Vert Wheel
          Range: -1.000000 - -1.000000
          Resolution: 1 units/m
          Mode: relative
        Class originated from: 15. Type: XIScrollClass
        Scroll info for Valuator 2
          type: 2 (horizontal)
          increment: 1.000000
          flags: 0x0
        Class originated from: 15. Type: XIScrollClass
        Scroll info for Valuator 3
          type: 1 (vertical)
          increment: -1.000000
          flags: 0x2 ( preferred )

It appears to map the buttons just as they normally would be. So what happens when I write a small script that calls "xinput query-state $DEVNO" in a loop and press the horrible buttons? You guessed it:

2 classes :
ButtonClass
    button[1]=up
    button[2]=up
    button[3]=up
    button[4]=up
    button[5]=up
    button[6]=up
    button[7]=up
    button[8]=up
    button[9]=up
    button[10]=up
    button[11]=up
    button[12]=up
    button[13]=up
    button[14]=up
    button[15]=up
    button[16]=up
ValuatorClass Mode=Relative Proximity=In
    valuator[0]=538
    valuator[1]=456
    valuator[2]=-2
    valuator[3]=-464

They always show up as "up" although they're clearly "down". Mouse buttons that do generate proper ButtonPress events (left/right for example) do show up ad "down" like they should.

1
  • 1
    Please don't vote down, it seems a good question.
    – peterh
    Commented Feb 24, 2015 at 19:34

2 Answers 2

6

I have a Logitech M325, which also uses button 8 and 9 for left and right tilting of the scroll wheel. I use this script to disable them:

#!/bin/bash

set -eu

MOUSE_ID=$(xinput --list | grep Logitech | sed -r 's/.*id=([0-9]+).*/\1/')

if [ -n "$MOUSE_ID" ]; then
    xinput set-button-map $MOUSE_ID 1 2 3 4 5 6 7 0 0
fi
3
  • Thanks, exactly what I was looking for. I just had to adjust the last line as for my mouse the critical buttons are 6 and 7. Sad that they don't build their mouses better so that we have to disable a theoretically nice feature...
    – luator
    Commented Jan 30, 2017 at 13:03
  • I tried the same for Logitech MX Master 2S. The button in question is 6, but setting it to zero has no effect. I tried setting basically everything to 0, but it only seems to have an effect for left and right click, I can't disable either scroll wheel this way. Any ideas why? Commented Sep 27, 2018 at 19:48
  • Btw @Carsten Calsohom your solution is a bit dangerous as there might be multiple logitech devices. The MX Master registers two. Running your script on my machine disabled the left click (because it was assigned 10, the second id matching Logitech). Commented Sep 27, 2018 at 19:49
1

TL;DR: issue xinput set-prop <deviceId> "libinput Horizontal Scroll Enabled" 0

I can get the <deviceId> value from the xinput -list output.

I owe a bluetooth Logitech M555b Mouse; it fell many times (my bad) and on a last fall it started to issue the "right mouse wheel scroll" with intermittent bursts. I notice it just when coding, the code keep scroll to the right. In other uses (i.e. internet browsing, gaming, etc.) the problem was not visible at all.

I started to play with the xev command, but it was unaware of any event during these bursts.

With the command xinput --test <deviceId> instead I saw several motion a[2]=<bigNum> during those bursts.

Then with the command xinput --list-props <deviceId> I saw a propery called Horizontal Scroll Enabled set to 1, I set it to 0 with the TL;DR command on top and, volià, burst stopped (I can re-enable it with value 1 instead of 0 at the end of the command).

Hope it helps others.

You must log in to answer this question.

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