Hello! Mathieu Othacehe <[email protected]> skribis:
> Your recent patch is just revealing an issue we always had with this > Kmscon patch. Basically, without the "unlink" called you introduced, the > FIFO fd was added only to the first discovered input and the keyboard > layout was only applied to that very input. > > Conveniently, that input was always the main user keyboard I guess. The > attached patch fixes that issue by registering the FIFO on the first > input, but applying the keyboard layout to all the inputs. Oh, fun (indeed I tested on a laptop with an external USB keyboard). >>From 1a0fddd844ced62c802db0d6d133af45880435f0 Mon Sep 17 00:00:00 2001 > From: Mathieu Othacehe <[email protected]> > Date: Thu, 29 Apr 2021 11:11:32 +0200 > Subject: [PATCH] gnu: kmscon: Fix layout setup. > > Kmscon may discover multiple inputs, corresponding to multiple devices. This > means that the uxkb_dev_keymap_update function may be called multiple times, > and the FIFO is registered on each input poll loop. > > When a new layout is written on the FIFO by the installer, the first input > picking up the message, will apply the new layout. However, that input may not > be the input that the user is currently using. > > To fix it, register the FIFO on the first input poll loop, but apply the new > layout on all the inputs in the uxkb_keymap_update_handler function. > > * gnu/packages/patches/kmscon-runtime-keymap-switch.patch > (uxkb_keymap_update_handler): Apply the new layout to all the inputs. > (uxkb_dev_keymap_update): Register the FIFO fd only on the first input poll > loop. Tested in a VM: it switches layouts like crazy, doesn’t leak a single FD, and generally behaves as expected. Thumbs up! Thanks, Ludo’.
