Bug 465957

Summary: Some keyboards are shown as mice
Product: [Applications] systemsettings Reporter: Gurenko Alex <agurenko>
Component: kcm_mouseAssignee: Plasma Bugs List <plasma-bugs-null>
Status: CONFIRMED ---    
Severity: normal CC: A.Fettouhi, bugseforuns, contact, evorster, farmboy0, jlp, kenkaboxii, nate
Priority: NOR    
Version First Reported In: 5.27.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=488421
https://bugs.kde.org/show_bug.cgi?id=495882
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Example
Example with few more devices
Plasma 6 still duplicates mice entries

Description Gurenko Alex 2023-02-17 18:49:54 UTC
Created attachment 156387 [details]
Example

SUMMARY

Each keyboard and mouse device is shown in a mouse configuration screen as both keyboard and mouse

STEPS TO REPRODUCE
1. Connect keyboard and mouse
2. Open System Settings -> Input Devices -> Mouse
3. Open Device drop down menu

OBSERVED RESULT

Keyboard is shown as keyboard and a mouse in the list and mouse is also listed as a keyboard and a mouse

EXPECTED RESULT

Only mouse-mouse device should be shown here

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora Linux 37
KDE Plasma Version: 5.27.0
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Comment 1 Gurenko Alex 2023-02-17 18:50:28 UTC
Created attachment 156388 [details]
Example with few more devices

Here is some more devices connected at the same time
Comment 2 Nate Graham 2023-02-17 23:30:10 UTC
Can you provide a list of each physical input device you own?

Also, are any of these wireless devices that share an RF receiver? e.g. a pair of keyboard + mouse that both use the same USB receiver.
Comment 3 Gurenko Alex 2023-02-18 15:46:44 UTC
(In reply to Nate Graham from comment #2)
> Can you provide a list of each physical input device you own?
> 
> Also, are any of these wireless devices that share an RF receiver? e.g. a
> pair of keyboard + mouse that both use the same USB receiver.

I'm sorry, can you clarify what kind of list would be helpful?

Those are all wired USB devices. I've tried plugging devices into my laptop and I see same behavior there too.
Comment 4 Nate Graham 2023-02-21 18:23:38 UTC
Like, can you tell me what physical mouse and keyboard devices you have plugged in at the time the bug occurs?
Comment 5 Gurenko Alex 2023-02-21 18:34:39 UTC
(In reply to Nate Graham from comment #4)
> Like, can you tell me what physical mouse and keyboard devices you have
> plugged in at the time the bug occurs?

My daily drivers right now are Corsair K70 rgb mk.2 (keyboard) and Logitech G102 mouse, on additional screenshot Razer Viper 8k and Razer DeathAdder V2 also connected.
Comment 6 Nate Graham 2023-02-21 21:21:46 UTC
Thanks! Can you paste the output of `lsusb` while these devices are plugged in?
Comment 7 Gurenko Alex 2023-02-21 21:29:23 UTC
$ lsusb
Bus 004 Device 003: ID 2109:0817 VIA Labs, Inc. USB3.0 Hub             
Bus 004 Device 002: ID 0424:5734 Microchip Technology, Inc. (formerly SMSC) USB5734
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 006: ID 1050:0407 Yubico.com Yubikey 4/5 OTP+U2F+CCID
Bus 002 Device 004: ID 2109:2817 VIA Labs, Inc. USB2.0 Hub             
Bus 002 Device 003: ID 041e:3272 Creative Technology, Ltd Pebble V3
Bus 002 Device 007: ID 0424:274b Microchip Technology, Inc. (formerly SMSC) Hub Controller
Bus 002 Device 005: ID 046d:085c Logitech, Inc. C922 Pro Stream Webcam
Bus 002 Device 002: ID 0424:2734 Microchip Technology, Inc. (formerly SMSC) USB2734
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 003: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 003 Device 002: ID 1462:7c84 Micro Star International MYSTIC LIGHT 
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 046d:c084 Logitech, Inc. G203 Gaming Mouse
Bus 001 Device 003: ID 1b1c:1b49 Corsair CORSAIR K70 RGB MK.2 Mechanical Gaming Keyboard
Bus 001 Device 002: ID 8087:0029 Intel Corp. AX200 Bluetooth
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Comment 8 Gurenko Alex 2024-03-04 11:51:07 UTC
Created attachment 166392 [details]
Plasma 6 still duplicates mice entries

On F40 with Plasma 6.0.0, keyboard seems okay, but the mice records are still duplicated

Operating System: Fedora Linux 40
KDE Plasma Version: 6.0.0
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.8.0-0.rc6.49.fc40.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 24 × AMD Ryzen 9 5900X 12-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: AMD Radeon RX 7900 XTX
Manufacturer: Micro-Star International Co., Ltd.
Product Name: MS-7C84
System Version: 1.0

I'll check on other devices
Comment 9 Nate Graham 2024-03-25 02:06:38 UTC
What's happening is that your devices are inappropriately reporting themselves as multiple mice. This might be a bug in the devices themselves, and it might be a bug in Libinput, but it's not the problem of our KCM. I'd recommend reporting it to Libinput, along with the output of `libinput list-devices` that shows the issue.
Comment 10 Gurenko Alex 2024-03-25 09:38:56 UTC
(In reply to Nate Graham from comment #9)
> What's happening is that your devices are inappropriately reporting
> themselves as multiple mice. This might be a bug in the devices themselves,
> and it might be a bug in Libinput, but it's not the problem of our KCM. I'd
> recommend reporting it to Libinput, along with the output of `libinput
> list-devices` that shows the issue.

Hi Nate, while true, devices do report themselves as multi-capable, I don't think that mouse kcm should show devices that are not mouse. Looks like currently there is patern search for capibilities for "pointer", hence Razer Razer DeathAdder V2 Keyboard also shown in a list, as it's reported as "keyboard pointer".

Device:           Razer Razer DeathAdder V2
Kernel:           /dev/input/event9
Group:            5
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 DeathAdder V2 Keyboard
Kernel:           /dev/input/event10
Group:            5
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 DeathAdder V2
Kernel:           /dev/input/event12
Group:            5
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

I'll check with libinput why keyboards are reported as pointers as well, thanks.
Comment 11 Nate Graham 2024-04-08 19:52:32 UTC
Yeah, looks like we can do some of this ourselves.
Comment 12 Bug Janitor Service 2024-04-08 20:02:31 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/2183
Comment 13 Nate Graham 2024-04-09 21:56:34 UTC
Git commit c35939966f964d90c25ad38ce26d343bfaf191a4 by Nate Graham.
Committed on 09/04/2024 at 21:56.
Pushed by ngraham into branch 'master'.

kcms/mouse: also filter mice that say they're keyboards

When enumerating devices to identify mice, the KCM already filters out
pointer devices that say they're touchpads. But it doesn't do so for
devices that say they're keyboards.

This is weird, but apparently a lot of gaming mice report themselves as
multiple devices with one being a keyboard that has only a couple of
buttons on it.

Let's filter these out so that we only see the mouse representation of
these devices in the KCM.
FIXED-IN: 6.1

M  +4    -0    kcms/mouse/backends/kwin_wl/kwin_wl_backend.cpp

https://invent.kde.org/plasma/plasma-desktop/-/commit/c35939966f964d90c25ad38ce26d343bfaf191a4
Comment 14 Bug Janitor Service 2024-04-25 17:01:44 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/2220
Comment 15 Nate Graham 2024-04-25 17:29:34 UTC
Unfortunately that approach had to be reverted as it regressed the ability to find weird gaming mice that report themselves exclusively as being both a mouse and a keyboard. Xaver and David E have a better idea though; see https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/2183#note_929752.

In the meantime, I'm re-opening this.
Comment 16 Nate Graham 2024-08-05 17:10:10 UTC
*** Bug 411709 has been marked as a duplicate of this bug. ***
Comment 17 Nate Graham 2024-08-05 17:10:20 UTC
*** Bug 491182 has been marked as a duplicate of this bug. ***
Comment 18 Nate Graham 2025-08-19 20:00:36 UTC
*** Bug 508347 has been marked as a duplicate of this bug. ***
Comment 19 André Fettouhi 2025-09-05 04:40:36 UTC
I just bought a Ducky X One Wireless keyboard (Nordic) and when I check System Settings -> Input Devices -> Mouse the keyboard is shown there. Under keyboard I just a generic 105 keys keyboard. The keyboard 109 keys btw.
Comment 20 Oliver Beard 2025-12-20 03:06:36 UTC
*** Bug 513597 has been marked as a duplicate of this bug. ***
Comment 21 Evert Vorster 2025-12-20 08:38:35 UTC
OK, popping up from the bug that I reported that is marked as duplicate here. 

The keyboard in my laptop, that I cannot change, is showing up as a mouse. 
With a name of "Asus keyboard"
It is not a mouse, and has no mouse-like features. 
No build-in pointer, nothing. It is a pure keyboard. 

I also have no mice with keyboard-like features.
What I do have is a bluetooth mouse (PERIMICE-819) and the touchpad of the laptop, both are distinct devices. 

With my keyboard being detected as a mouse, it breaks the feature where I can disable the touch pad on my laptop when there is a mouse connected. Accidental mouse clicks has been a huge pain on this laptop, and this is a feature I badly want. 

I see this bug has been open for nearing on to three years now. Who do I chat to to help resolve this one?
Comment 22 Evert Vorster 2025-12-20 10:24:00 UTC
Just a thought here. 

Does libinput _guarantee_ that they will correctly identify and forward the information from every single type of input device there is in the universe?

If not, then it may be an idea to allow the user to set/change type of input for the devices attached to their system, no matter what libinput says. Sort of a translation layer.
Comment 23 Nate Graham 2025-12-22 22:08:30 UTC
> Who do I chat to to help resolve this one?
Start with the maintainer of Libinput, Peter Hutterer. He's a very helpful fellow doing most of the Libinput maintenance for the past 10 years single-handedly. So as you might imagine, there's always "too much to do, and not enough people to do it".

See https://gitlab.freedesktop.org/libinput/libinput/-/issues/1174#note_3059551 for a starting point.
Comment 24 Evert Vorster 2025-12-23 05:51:33 UTC
Thanks for the input. I am already working with libinput to resolve the case of my hardware specifically. 

But, I feel a point has been missed here. 

What about hardware that can't or won't be supported by libinput?
What about the time that it takes for hardware to be properly supported?

You simply *can't* rely on an external library to do the right thing, always. 

You _need_ to have a catch-all where you can support changing stuff around. Some advanced mode where you can select: This device is NOT a mouse, or that device IS a mouse. 
Not so much for what input you get from the device, but for how KDE is treating the device, and which options it sets.

If KDE does not have this sort of thing, it will just be broken for a lot of people, and leave a bad impression.
If you point me at where this code lives I'll vibe-code an example of what I mean...

TL;DR: Input is core functionality, there should be fall backs for when things don't perform as expected.
Comment 25 Nate Graham 2025-12-30 18:52:45 UTC
> If KDE does not have this sort of thing, it will just be broken for a lot of people,
> and leave a bad impression.
If we do have that sort of thing, it will still be broken for a lot of people, and leave a bad impression.

Adventurous experts who go digging might find the setting that fixes it for them personally. Which is definitely good for them. But it won't help the overwhelming majority of people.

So, yes, it might be practical to offer that kind of configurability as a workaround for experts, but the proper fix for everyone will always have to be in the library.
Comment 26 Evert Vorster 2025-12-31 12:12:58 UTC
In my case, the library does not fix it, and it needs a patch in the kernel to quirk out this keyboard type. 
That will take some time to implement, and then will only work on my specific laptop type. 

When you compare the amount of work to fix this to just having a little check box in the device configuration that says "Ignore this device as a mouse", or this is NOT a mouse, this is something that can work for everyone with the same type of problem. 

I'm on a pretty poor internet connection right now, so I can't take a look at the source, but once I'm back on a proper connection I'll write a patch that does just that. :)
Comment 27 Nate Graham 2025-12-31 15:06:09 UTC
Cool, thanks a lot!