Bug 177889

Summary: add ability to configure multiple keyboards
Product: [Applications] systemsettings Reporter: Marcus Better <marcus>
Component: kcm_keyboardAssignee: Andriy Rysin <arysin>
Status: CONFIRMED ---    
Severity: wishlist CC: atescomp, bluedzins, chealer, dev, heri+kde, myusualnickname, nate, resch.max, shafff
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Marcus Better 2008-12-16 09:48:15 UTC
Version:            (using KDE 4.1.3)
OS:                Linux
Installed from:    Debian testing/unstable Packages

It is common to have several keyboards, for example a laptop with an USB keyboard that is sometimes connected. The keyboards typically have different layouts. But kxkb does not differentiate between different devices, so only one keyboard layout can be selected.

kxkb should permit separate configuration of each keyboard device (like setxkbmap does with the -device option).

It should also work with the input device hotplugging capabilities of the X server, where input devices can be added and removed on the fly.
Comment 1 Maciej Pilichowski 2010-05-24 20:21:06 UTC
See also:
https://bugs.kde.org/show_bug.cgi?id=164274
Comment 2 Andriy Rysin 2011-01-05 04:57:17 UTC
*** Bug 262053 has been marked as a duplicate of this bug. ***
Comment 3 Dennis Schridde 2011-01-05 08:42:25 UTC
Copied from bug #262053:
Product:	systemsettings
Component:	kcm_keyboard

I have two keyboards, one with language A printed on it, the other with
language B on it. I would like to set the first to layout A and the latter to
layout B.
X.Org / XInput seems to support that, looking at xorg.conf examples.

P.S: The bugtracker component "kcm_keyboard" has the help text "Keyboard
configuration module (repeat speed, NumLock, click volume, **keyboard
layouts**)" (emphasis by me), while kcm_keyboard_layout ("Keyboard Layouts
configuration module") also exists. This is confusing.
Comment 4 Max Resch 2013-03-24 13:31:30 UTC
*** This bug has been confirmed by popular vote. ***
Comment 5 Keven L. Ates 2019-07-22 04:46:39 UTC
No movement since 2013.

This seems to be a simple addition to the "KDE Keyboard Control Module". For that matter, "Mouse", "KDE Joystick Control Module", and "Touchpad KCM" as well. Odd that they have wildly different documented names in their help.

I propose a dropdown or tab listing the related objects in each module as presented in /dev/input/ directory (or /proc/bus/input/devices file)...or however KDE is getting and coordinating the device names and types.

The biggest problem is restoring devices of same type. They may not be guaranteed to have the same prior event #, so order may not be preserved. Some solutions:
1. Bluetooth devices can have unique names.
2. Serial numbers? I don't know if every device has or can report a serial number.
Comment 6 Keven L. Ates 2019-07-22 05:16:43 UTC
The /proc/bus/input/devices file list these entries which might help to uniquely identify devices:
1. Name
2. Phys
3. Sysfs
4. Uniq
Sometimes the Phys and Uniq look like they are using MAC, other times not or not used at all. Phys always has something.

However, for my systems, I always see at least two keyboards (when I really only have one): one named by manufacturer AND a second "AT Translated Set 2 keyboard". What is KDE actually using as the keyboard device?  Is the "AT Translated Set 2 keyboard" the default?
Comment 7 Philippe Cloutier 2019-07-22 12:25:48 UTC
Keven, if you're on a laptop, that must be the built-in keyboard, connected via PS2.

That being said, as a first step which would leave very little from this issue, it would be sufficient to use a model identifier like a USB id, in particular if different variants of the same keyboard have different USB id-s. Unfortunately that doesn't seem to be the case for my Microsoft Natural Ergonomics 4000:
          bCountryCode            0 Not supported
Comment 8 myusualnickname@gmail.com 2024-04-28 00:59:13 UTC
This also has security implications. Plugging in a dongle can p0wn a system. A dongle can appear as a usb thumb drive and a HID device.

I propose that a second keyboard should start with a very limited input method(maybe two keys work), and a captcha should be completed to enable the keyboard.

This requires some low level digging, maybe down to  QT or xkb or kernel hid support, but this is highly related to that.

I am very interested in helping further this. if anybody can tell me what libraries to start looking at, I'll research.
Comment 9 Philippe Cloutier 2024-04-28 15:04:44 UTC
I fail to see how that relates to the issue tracked here.
Comment 10 Keven L. Ates 2024-04-28 18:58:10 UTC
I believe the security concerns are out of scope.  It is natural for a "docked" laptop to have two keyboards.  Inline keyboard taps are generally more of a security concern and would likely show as a single device anyway.  Also, hacker devices could masquerade as any device.  So, IMHO, this is chasing a lost cause.