USB mouse drift when clicking

I have a Razer BASILISK V3 mouse and recently whenever I left click, the mouse pointer starts clicking and dragging down and to the left. This happens as long as I am holding the left click button. So I can’t right click a piece of text without it selecting some characters to the left of it and I also can’t click on draggable items.
What I tried:

  • Unplugging and replugging the mouse
  • Checked libinput version - I have libinput 1.25.0 and xf86-input-libinput 1.4.0
  • Checked evdev version - I have libevdev 1.13.1
  • Ran xinput list - the output is as follows: (I’m on Wayland):
WARNING: running xinput against an Xwayland server. See the xinput man page for details.
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ xwayland-pointer:10                     	id=6	[slave  pointer  (2)]
⎜   ↳ xwayland-relative-pointer:10            	id=7	[slave  pointer  (2)]
⎜   ↳ xwayland-pointer-gestures:10            	id=8	[slave  pointer  (2)]
⎜   ↳ xwayland-tablet stylus:10               	id=10	[slave  pointer  (2)]
⎜   ↳ xwayland-tablet eraser:10               	id=11	[slave  pointer  (2)]
⎜   ↳ xwayland-tablet cursor:10               	id=12	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ xwayland-keyboard:10                    	id=9	[slave  keyboard (3)]

Does this happen in other OSes? Could be a hardware issue.

It does not happen on my Windows partition.

I ran libinput list-devices and it listed my Basilisk mouse twice:

Device:           Razer Razer Basilisk V3
Kernel:           /dev/input/event7
Group:            1
Seat:             seat0, default
Capabilities:     pointer 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: disabled
Calibration:      n/a
Scroll methods:   button
Click methods:    none
Disable-w-typing: n/a
Disable-w-trackpointing: n/a
Accel profiles:   flat *adaptive custom
Rotation:         0.0

Device:           Razer Razer Basilisk V3 Keyboard
Kernel:           /dev/input/event8
Group:            1
Seat:             seat0, default
Capabilities:     keyboard pointer 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      n/a
Nat.scrolling:    disabled
Middle emulation: n/a
Calibration:      n/a
Scroll methods:   none
Click methods:    none
Disable-w-typing: n/a
Disable-w-trackpointing: n/a
Accel profiles:   n/a
Rotation:         0.0

Device:           Razer Razer Basilisk V3
Kernel:           /dev/input/event27
Group:            1
Seat:             seat0, default
Capabilities:     keyboard 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      n/a
Nat.scrolling:    n/a
Middle emulation: n/a
Calibration:      n/a
Scroll methods:   none
Click methods:    none
Disable-w-typing: n/a
Disable-w-trackpointing: n/a
Accel profiles:   n/a
Rotation:         0.0

Should I disable one of them? If so, which one? can I have my OS “forget” the mouse and come back?

Ok this is interesting…

I rebooted my system, and the mouse issue dissapeared. I reproduced the mouse issue by playing Back to the Dawn on Steam with my controller, then exiting out of the game. When I did, the mouse was back up to the clicking-and-dragging bug.

I thought, there must be something in Steam that is causing this. So, I ran sudo killall steam and the mouse works normally again. I reopen the Steam client and the issue does not come back.

I reopened Back to the Dawn, but this time did not touch the controller and played using only keyboard and mouse. Upon exiting the game, the mouse issue is not present. When I open the game and used the controller in the game, the issue didn’t come back either. I mention this game specifically because the issue did not happen when opening other games.

So the issue happens when I start the Steam client on a fresh boot, play this one specific game, then exit it. Killing and reopening the Steam client and playing the game again does not reproduce the issue, only on first boot.

What is going on here? I don’t want to have to run sudo killall steam every time my mouse starts acting up like this, and I’m going to be playing this game for a while. I’d like to know the root cause.

I assume you also use the controller.

I have no idea why is it happening, but I searched linux mouse drift controller looks like a lot of people have issues with controllers. Did you try unplugging it after you stopped the game?

Ok as it turns out Steam was not necessary at all. I literally just moved the right stick on my controller, and the mouse cursor acts up. Unplugging the controller restores mouse functionality to normal, and the issue only happens when I move the right stick again.

A question I saw on StackOverflow suggests disabling joystick control over the mouse cursor by editing /etc/X11/xorg.conf.d/51-joystick.conf, so I’m going to try that

EDIT: It worked. Solution is to create file/etc/X11/xorg.conf.d/51-joystick.conf, then put the following in it:

Section "InputClass"
        Identifier "joystick catchall"
        MatchIsJoystick "on"
        MatchDevicePath "/dev/input/event*"
        Driver "joystick"
        Option "StartKeysEnabled" "False"       #Disable mouse
        Option "StartMouseEnabled" "False"      #support
EndSection

all according to https://wiki.archlinux.org/title/Gamepad#Disable_joystick_from_controlling_mouse

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.