Message ID | 20170127171318.2596-4-benjamin.tissoires@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Jan 27 2017 or thereabouts, Samuel Thibault wrote: > Hello, > > Benjamin Tissoires, on Fri 27 Jan 2017 18:13:17 +0100, wrote: > > When switching back from Gnome, the VT is not aware of the > > current state of the LEDs. So if Gnome changes them, the > > kernel still bellieves they are off, and it won't turn them > > off when switching to a new TTY. > > I'm not getting that issue, please detail which graphical stack you are > using (Xorg/Wayland? input-libinput?) Well, libinput won't have anything to do here, and the issue applies on Gnome and gdm with both Xorg and Wayland. Given that you don't have the issue, I had a feeling that it might be logind interfering (given that it revokes the input file descriptor). So I tested a startx from root, and indeed the issue is not present in that case. I'll check with the systemd guys if this is something that comes from them and if this can be fixable. Cheers, Benjamin > > Samuel -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c index ca1d614..410b21e 100644 --- a/drivers/tty/vt/keyboard.c +++ b/drivers/tty/vt/keyboard.c @@ -137,6 +137,8 @@ static unsigned char ledioctl; static bool caps_as_controlllock; static bool task_caps_as_controlllock; +static int saved_cur_kbd_console = -1; + /* * Notifier list for console keyboard events */ @@ -1482,6 +1484,12 @@ static void kbd_event(struct input_handle *handle, unsigned int event_type, /* We are called with interrupts disabled, just take the lock */ spin_lock(&kbd_event_lock); + /* reset the led state on console switch */ + if (saved_cur_kbd_console != fg_console) { + ledstate = -1U; + saved_cur_kbd_console = fg_console; + } + if (event_type == EV_MSC && event_code == MSC_RAW && HW_RAW(handle->dev)) kbd_rawcode(value); if (event_type == EV_KEY)
When switching between consoles, the LEDs state is correctly assigned, as long as the kernel manages the console. When switching back from Gnome, the VT is not aware of the current state of the LEDs. So if Gnome changes them, the kernel still bellieves they are off, and it won't turn them off when switching to a new TTY. To keep the LEDs status in sync with the actual modifiers, simply force a reset of the LEDs when we detect a vt change. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> --- drivers/tty/vt/keyboard.c | 8 ++++++++ 1 file changed, 8 insertions(+)