3

I use two keypads (Koolertron AE-SMKD72 Type A), that I use as one split keyboard. But they are recognized as two separate keyboards, what causes some problems:

  • I use an alternative keyboard layout but have a program running that maps keys back to QWERTZ when I press Ctrl because I don't want to relearn shortcuts as Ctrl-c. This program doesn't work when I press Ctrl on the left and u on the right keyboard.
  • There is a bug in Gnome that causes the screen to freeze when typing quickly on two different keyboards.
  • There is only one keyboard listed in /dev/input/by-id (probably because they are named identically).

That's why I would prefer if Linux would consider both keyboards halves as a single keyboard.

Is it possible to merge two keyboards into a single input device? Or alternatively, is it possible to merge to USB ports into one in a way that the two devices appear to be only one?

ctrl-alt-delor
  • 27,473
  • 9
  • 58
  • 102
MaxGyver
  • 289
  • 2
  • 8

2 Answers2

1

Not easily, but if you can program, you can grab (prevent them from passing events to anything but your program) both /dev/input/eventX devices, read keypresses from either, and output them in a single user-defined input device (/dev/uinput).

C example programs on how to use those kernel APIs exist. Other languages are also possible.

dirkt
  • 31,679
  • 3
  • 40
  • 73
  • Actually that program grabs `/dev/input/eventX` and writes to `/dev/uinput`. But I prefer not to change that program because it's complicated (for someone not used to C). I would have to read from both event files in a loop and then sort by their timestamps. Joining the streams before reading could be so easy and logical and would (probably) help against that Gnome bug when typing on two different keyboards. – MaxGyver Jul 02 '19 at 16:36
  • If all you want is to use one layout without control and one layout with control, why don't you just make your own keyboard layout e.g. with `xmodmap`? No need to run a program, and as that is done on the X level, it will treat all the key events in the same way. **Edit** Ah, it's Wayland. I haven't done keyboard mapping on Wayland yet. – dirkt Jul 02 '19 at 17:28
  • Well, that program is designed to work also with Wayland but I don't (yet) use Wayland. As far as I know, I can't remap just Ctrl, Alt and Win combos with `xmodmap`. I would appreciate it if you show me, how to do it. That way, I didn't need sudo. – MaxGyver Jul 02 '19 at 18:09
1

Try to grab the keyboards /dev/input/eventX file events and pass it to /dev/uinput using fatkelp.

Install fatkelp using this command:

curl https://raw.githubusercontent.com/algames2019/fatkelp/main/installer.sh > installer.sh; chmod +x installer.sh; sudo ./installer.sh

Find the id of both keyboards

sudo fatkelp -l

Then pass it to /dev/uinput (do this on both keyboards)

sudo fatkelp -x id

Then detach both keyboards

xinput list               # list all devices (you can find id here)
xinput float id           # detach devices
Alken Rey
  • 11
  • 2