From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.com>,
Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/4] tty/vt/keyboard: reset the LEDs state at each console change
Date: Fri, 27 Jan 2017 18:13:17 +0100 [thread overview]
Message-ID: <20170127171318.2596-4-benjamin.tissoires@redhat.com> (raw)
In-Reply-To: <20170127171318.2596-1-benjamin.tissoires@redhat.com>
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(+)
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)
--
2.9.3
next prev parent reply other threads:[~2017-01-27 17:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-27 17:13 [PATCH 0/4] TTY: fix Caps Lock LED Benjamin Tissoires
2017-01-27 17:13 ` [PATCH 1/4] tty/vt/keyboard: use defined macros for masks Benjamin Tissoires
2017-01-27 17:18 ` Samuel Thibault
2017-01-27 17:13 ` [PATCH 2/4] tty/vt/keyboard: Fix Caps Lock LED on major distributions Benjamin Tissoires
2017-01-27 17:25 ` Samuel Thibault
2017-01-27 17:29 ` Dmitry Torokhov
2017-01-27 17:13 ` Benjamin Tissoires [this message]
2017-01-27 17:31 ` [PATCH 3/4] tty/vt/keyboard: reset the LEDs state at each console change Samuel Thibault
2017-01-27 18:18 ` Benjamin Tissoires
2017-01-27 17:13 ` [PATCH 4/4] Input: leds - force the LED status after .probe() Benjamin Tissoires
2017-01-27 17:34 ` Samuel Thibault
2017-01-27 18:19 ` Benjamin Tissoires
2017-01-27 17:23 ` [PATCH 0/4] TTY: fix Caps Lock LED Samuel Thibault
2017-01-27 18:34 ` Benjamin Tissoires
2017-01-27 18:47 ` Samuel Thibault
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170127171318.2596-4-benjamin.tissoires@redhat.com \
--to=benjamin.tissoires@redhat.com \
--cc=dmitry.torokhov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=samuel.thibault@ens-lyon.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome