Bug 465957

Summary: Each keyboard and mouse in the system shown as both keyboard and mouse in settings
Product: [Applications] systemsettings Reporter: Gurenko Alex <agurenko>
Component: kcm_mouseAssignee: Plasma Bugs List <plasma-bugs>
Status: CONFIRMED ---    
Severity: normal CC: contact, nate
Priority: NOR    
Version: 5.27.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=488421
Latest Commit: Version Fixed In:
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.