Bug 468217

Summary: xf86-input-libinput 1.3.0 DPI and mouse acceleration issue on KDE Plasma X11
Product: [Applications] systemsettings Reporter: Geno <spider.gaming>
Component: kcm_mouseAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: bugs.kde, dominicgluskin, duha.bugs, fabian, fijxu, kde, martin.tk, miranda, nate, pmwpmw, realnc, subhuman2222, tseewald, vistausss
Priority: VHI    
Version: 5.27.3   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 5.27.5
Sentry Crash Report:

Description Geno 2023-04-06 17:16:04 UTC
SUMMARY
There is an issue with mice on KDE Plasma 5.27.3 in X11 when using xf86-input-libinput 1.3.0. Connected mice have their sensitivity changed (might be a DPI change), this change results in either higher or lower sensitivity. The connected mice also have mouse acceleration turned on, even when though the mouse is configured with a "flat" acceleration profile.

This may be limited to higher polling rate "gaming" mice (500+ Hz), but this is unconfirmed.

Some community discussions that might shed more light:
https://old.reddit.com/r/EndeavourOS/comments/12chils/mouse_sensitivity_issue_after_yesterdays_update/
https://old.reddit.com/r/kde/comments/12cp02s/issue_with_xf86inputlibinput_130_on_kde_plasma_x11/


STEPS TO REPRODUCE
1. Install KDE Plasma on an Arch Linux based OS (e.g. EndeavourOS).
2. Login in X11 mode.
3. Configure KDE Plasma mouse settings to: Sensitivity 5/10, flat acceleration profile.
4. Optional: Also configure the gaming mouse in its own software.
5. Update system to the latest versions, including xf86-input-libinput to 1.3.0-1.
6. Optional: In case xf86-input-libinput version 1.3.0-1 is already installed out of the box, use the downgrade command to downgrade to version 1.2.1-1 in order to compare.

OBSERVED RESULT
1. Mouse acceleration turned on, no way to turn off. Setting is still "flat" acceleration profile.
2. Higher or lower mouse sensitivity/DPI.

EXPECTED RESULT
1. "Flat" acceleration profile is respected.
2. Mouse sensitivity/DPI is the same as on xf86-input-libinput 1.2.1.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma:
(available in About System)
KDE Plasma Version: 5.27.3
KDE Frameworks Version: 5.104.0
Qt Version: 5.15.8
Comment 1 Jake 2023-04-07 09:16:46 UTC
With a 125 Hz mouse I also experience the issue, so probably not related to polling.

It seems to be caused by the recent addition of a custom accel profile and changed interface, which is now also exposed by xf86-input-libinput. Check on the slave pointer id, for example:
```
>$ xinput list
>...
>⎜   ↳ Logitech MX Master 3                      id=17   [slave  pointer  (2)]

With 1.2.1 it had only 2 values (adaptive, flat):
>$ xinput list-props 17 | grep 'Accel Profile Enabled'
>        libinput Accel Profile Enabled (295):   0, 1
>        libinput Accel Profile Enabled Default (296):   1, 0

KDE set it correctly the the second/flat.

With 1.3.0 there are 3 values (adaptive, flat, custom):
>$ xinput list-props 17 | grep 'Accel Profile Enabled'
>       libinput Accel Profile Enabled (295):   1, 0, 0
>       libinput Accel Profile Enabled Default (296):   1, 0, 0

No matter what is selected in KDE it always stays on the first/adaptive profile.
Another workaround is to set it with xinput, then it behaves flat like before:
>$ xinput set-prop 17 'libinput Accel Profile Enabled' 0 1 0
Comment 2 fijxu 2023-04-08 03:50:15 UTC
I can confirm this issue, selecting either "Flat" or "Adaptive" doesn't change the mouse acceleration. In this new version of `xf86-input-libinput` they added another `profile` which is the `LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM` (at `./src/xf86libinput.c` line `5590` in the source code) adding a third value to the libinput acceleration profile settings and somewhat breaking KDE Plasma Mouse settings.
Comment 3 Dominic 2023-04-10 23:26:19 UTC
Having same issue here, issue is present on X11, but not on wayland. Tested on both Logitech and Razer mice, same issue of a dramatic increase in sensitivity.
Comment 4 fijxu 2023-04-10 23:54:29 UTC
A temporal fix can be seen here, it applies for all distros.

https://wiki.archlinux.org/title/Mouse_acceleration#with_libinput
Comment 5 subhuman2222 2023-04-15 07:54:57 UTC
I can confirm the issue, I use openSUSE TW. After an upgrade operation, seeing the same behaivour, mouse accel is forced. I rolled back my system for now.
Comment 6 subhuman2222 2023-04-15 07:55:17 UTC
*** This bug has been confirmed by popular vote. ***
Comment 7 Fabian Vogt 2023-04-15 13:55:58 UTC
I updated libinput to 1.23.0 and xf86-input-libinput to 1.3.0 on Tumbleweed and I can't reproduce the issue here. Both Flat and Adaptive profiles work as expected. Changing the setting makes it immediately effective and it's also applied on login.

My suspicion was that having more profiles available than the KCM backend expects means that it's possible that multiple profiles could be enabled simultaneously, but for that to happen, the new profile would have to be enabled already. According to comment 1 this is not the case though.
Comment 8 duha.bugs 2023-04-15 14:48:08 UTC
(In reply to Fabian Vogt from comment #7)
> I updated libinput to 1.23.0 and xf86-input-libinput to 1.3.0 on Tumbleweed
> and I can't reproduce the issue here. Both Flat and Adaptive profiles work
> as expected. Changing the setting makes it immediately effective and it's
> also applied on login.

Did you use X11 or Wayland?


I can confirm the bug for both Arch and Tumbleweed using X11, Wayland works correctly.
Comment 9 Fabian Vogt 2023-04-15 14:51:06 UTC
Does changing the profile work after using "xinput set-prop"?

(In reply to duha.bugs from comment #8)
> (In reply to Fabian Vogt from comment #7)
> > I updated libinput to 1.23.0 and xf86-input-libinput to 1.3.0 on Tumbleweed
> > and I can't reproduce the issue here. Both Flat and Adaptive profiles work
> > as expected. Changing the setting makes it immediately effective and it's
> > also applied on login.
> 
> Did you use X11 or Wayland?
>  
> I can confirm the bug for both Arch and Tumbleweed using X11, Wayland works
> correctly.

I set up a new user account specifically for testing this in an X11 session.
Comment 10 duha.bugs 2023-04-15 15:22:45 UTC
(In reply to Fabian Vogt from comment #9)
> Does changing the profile work after using "xinput set-prop"?


After unplugging+replugging my mouse or rebooting using my Arch on X11:

Cannot change accel profile using the KDE Gui:

xinput list-props {1..50} 2>/dev/null | grep -F 'libinput Accel Profile Enabled ('

       > libinput Accel Profile Enabled (295):   1, 0, 0
       > libinput Accel Profile Enabled (295):   1, 0, 0


xinput list

> ⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
> ⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
> ⎜   ↳ DARFON QPAD wired keyboard Mouse        	id=14	[slave  pointer  (2)]
> ⎜   ↳ Logitech G403 Prodigy Gaming Mouse Keyboard	id=9	[slave  pointer  (2)]
> ⎜   ↳ DARFON QPAD wired keyboard Consumer Control	id=15	[slave  pointer  (2)]
> ⎜   ↳ Logitech G403 Prodigy Gaming Mouse      	id=16	[slave  pointer  (2)]
> ⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
>    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
>    ↳ Power Button                            	id=6	[slave  keyboard (3)]
>    ↳ Power Button                            	id=7	[slave  keyboard (3)]
>    ↳ DARFON QPAD wired keyboard              	id=11	[slave  keyboard (3)]
>    ↳ DARFON QPAD wired keyboard Keyboard     	id=12	[slave  keyboard (3)]
>    ↳ DARFON QPAD wired keyboard Wireless Radio Control	id=13	[slave  keyboard (3)]
>    ↳ DARFON QPAD wired keyboard Consumer Control	id=17	[slave  keyboard (3)]
>    ↳ Wacom Bamboo Connect Pen                	id=8	[slave  keyboard (3)]
>    ↳ Logitech G403 Prodigy Gaming Mouse Keyboard	id=10	[slave  keyboard (3)]

    xinput --set-prop 16 'libinput Accel Profile Enabled' 0, 1

Flat profile works now and I can use the KDE Gui to change between flat or adaptive profile until reboot or mouse replugging

xinput list-props {1..50} 2>/dev/null | grep -F 'libinput Accel Profile Enabled ('

> libinput Accel Profile Enabled (295):   1, 0, 0
> libinput Accel Profile Enabled (295):   0, 1


Will also test on Tumbleweed and with a new user, but I think its the same
Comment 11 Nate Graham 2023-04-17 16:46:11 UTC
*** Bug 468550 has been marked as a duplicate of this bug. ***
Comment 12 Nate Graham 2023-04-19 17:45:58 UTC
Git commit 2a1ea4d02bc3fd90bf63099ba6752eb23808dff7 by Nate Graham, on behalf of Ilia Kats.
Committed on 19/04/2023 at 17:43.
Pushed by ngraham into branch 'Plasma/5.27'.

KCM/mouse: enable compatibility with x11-libinput 1.3

The new version of libinput added an additional mouse acceleration
profile, so our checks were too restrictive and settings were not
applied.

M  +2    -2    kcms/mouse/backends/x11/x11_libinput_dummydevice.cpp

https://invent.kde.org/plasma/plasma-desktop/commit/2a1ea4d02bc3fd90bf63099ba6752eb23808dff7
Comment 13 Nate Graham 2023-04-19 17:51:00 UTC
Git commit 441ae442970905f5d7d5fa4d0ce666f63808738d by Nate Graham, on behalf of Ilia Kats.
Committed on 19/04/2023 at 17:47.
Pushed by ngraham into branch 'master'.

KCM/mouse: enable compatibility with x11-libinput 1.3

The new version of libinput added an additional mouse acceleration
profile, so our checks were too restrictive and settings were not
applied.
(cherry picked from commit 2a1ea4d02bc3fd90bf63099ba6752eb23808dff7)

M  +2    -2    kcms/mouse/backends/x11/x11_libinput_dummydevice.cpp

https://invent.kde.org/plasma/plasma-desktop/commit/441ae442970905f5d7d5fa4d0ce666f63808738d
Comment 14 Heimen Stoffels 2023-04-22 15:16:53 UTC
While I can't reproduce the switching profiles bug, the DPI definitely is different and the cursor less stable with the adaptive profile since libinput 1.3.0 on Wayland. Hoping this fix will also fix my issue…
Comment 15 Martin 2023-07-08 17:16:20 UTC
I've just installed 5.27.5 and I experienced this issue.

I used Jake's advice and used xinput set-prop on my mouse to change back to the default settings

    $ xinput list-props 12 | grep 'Accel Profile Enabled'

this shows:

        libinput Accel Profile Enabled (294):   0, 1, 0
        libinput Accel Profile Enabled Default (295):   1, 0, 0

After running the following command the mouse sensitivity feels like it used to

    $ xinput set-prop 12 'libinput Accel Profile Enabled' 1 0 0

libinput I'm using is xf86-input-libinput-1.3.0
Comment 16 Nate Graham 2023-08-03 14:29:06 UTC
Hello Martin,

It's not clear that the issue you're experiencing is the same bug, especially since you've used non-KDE tools to manipulate the settings.

If you're convinced that this is a KDE bug, please submit a new bug report with clear Steps To Reproduce, and also mention whether you're using Wayland or X11.

Thanks!
Comment 17 Martin 2023-08-03 14:46:52 UTC
(In reply to Nate Graham from comment #16)
> Hello Martin,
> 
> It's not clear that the issue you're experiencing is the same bug,
> especially since you've used non-KDE tools to manipulate the settings.
> 
> If you're convinced that this is a KDE bug, please submit a new bug report
> with clear Steps To Reproduce, and also mention whether you're using Wayland
> or X11.
> 
> Thanks!

I noticed a changed mouse sensitivity after upgrading my KDE Plasma. I searched and found this bug report and from here I got the idea of using `xinput set-prop` command to fix it. Though I have to run it after every boot and also when I switch to tty and back or another X instance the mouse sensitivty gets reset so I have to re-run `xinput set-prop`.

I'm on X11, would running xinput set-prop have an effect if I was running Wayland?

When I start X11 using another DE (WindowMaker) the mouse sensitivity is as it's always been. It's only on this new version of KDE Plasma that mouse sensitivity is changed.
Previous version I had was 5.26 (not sure about the patch version, 2nd December 2022).
Comment 18 Nikos Chantziaras 2023-08-03 15:27:00 UTC
(In reply to Martin from comment #17)
> I noticed a changed mouse sensitivity after upgrading my KDE Plasma. I
> searched and found this bug report and from here I got the idea of using
> `xinput set-prop` command to fix it. Though I have to run it after every
> boot and also when I switch to tty and back or another X instance the mouse
> sensitivty gets reset so I have to re-run `xinput set-prop`.

I've put the following in a .conf file inside /etc/X11/xorg.conf.d/ to disable acceleration:

Section "InputClass"
        Identifier "My Mouse"
        Driver "libinput"
        MatchIsPointer "yes"
        Option "AccelProfile" "flat"
        Option "AccelSpeed" "0"
EndSection

If you already have a section for your mouse, you should instead modify that instead of creating a new one.
Comment 19 Martin 2023-08-03 16:37:38 UTC
(In reply to Nikos Chantziaras from comment #18)
> I've put the following in a .conf file inside /etc/X11/xorg.conf.d/ to
> disable acceleration:
> 
> [..]

Huh, cheers for that. It made me realise I was actually using "adaptive" profile originally. Though not sure how it was set.

I'm guessing that after upgrading to 5.27.5 it was set to "flat" in systemsettings. Though only when using Plasma, for Windowmaker it stayed set to adaptive. I'll have to investigate that.

Anyways, apologies  for the noise. Clearly the issue is on my side.

Thank you all and take care.