LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: linux-input@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Default keyboard LEDs
Date: Mon, 14 Jan 2008 00:52:19 +0000	[thread overview]
Message-ID: <20080114005219.GA4296@implementation> (raw)

In many cases, one prefers to have e.g. the NumLock on by default.  In
many cases, one doesn't want to have it by default, e.g. on laptops.

Distributions actually have a very hard time trying to set this
correctly after the kernel boot, and that doesn't work for new consoles
that are created via the openvt(1) command anyway. This hence adds a
keyboard.default_leds boot parameter that permits to configure the
default keyboard LEDs.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

---

Actually, what would be perfect would be to use the configuration that
the BIOS sets at boot by default.  That is device-dependent, however.

--- linux/drivers/char/keyboard.c.orig	2008-01-14 00:26:12.000000000 +0000
+++ linux/drivers/char/keyboard.c	2008-01-14 00:33:03.000000000 +0000
@@ -67,6 +67,9 @@
 
 #define KBD_DEFLOCK 0
 
+unsigned char default_leds = KBD_DEFLEDS;
+module_param(default_leds, byte, S_IRUGO | S_IWUSR);
+
 void compute_shiftstate(void);
 
 /*
@@ -1405,8 +1408,8 @@
 	int error;
 
         for (i = 0; i < MAX_NR_CONSOLES; i++) {
-		kbd_table[i].ledflagstate = KBD_DEFLEDS;
-		kbd_table[i].default_ledflagstate = KBD_DEFLEDS;
+		kbd_table[i].ledflagstate = default_leds;
+		kbd_table[i].default_ledflagstate = default_leds;
 		kbd_table[i].ledmode = LED_SHOW_FLAGS;
 		kbd_table[i].lockstate = KBD_DEFLOCK;
 		kbd_table[i].slockstate = 0;
--- linux/include/linux/kbd_kern.h.orig	2008-01-14 00:32:36.000000000 +0000
+++ linux/include/linux/kbd_kern.h	2008-01-14 00:32:48.000000000 +0000
@@ -13,6 +13,7 @@
 extern char func_buf[];
 extern char *funcbufptr;
 extern int funcbufsize, funcbufleft;
+extern unsigned char default_leds;
 
 /*
  * kbd->xxx contains the VC-local things (flag settings etc..)
--- linux/Documentation/kernel-parameters.txt.orig	2008-01-14 00:38:40.000000000 +0000
+++ linux/Documentation/kernel-parameters.txt	2008-01-14 00:41:21.000000000 +0000
@@ -550,6 +550,15 @@
 			Set system-wide default UTF-8 mode for all tty's.
 			Default is 0 and by setting to 1, it enables UTF-8
 			mode for all newly opened or allocated terminals.
+	
+	keyboard.default_leds=
+			[KEYBOARD]
+			Format=<ledmask>
+			Mask of the leds to activate on consoles by default.
+			ScrollLock: 1
+			NumLock: 2
+			CapsLock: 4
+			KanaLock: 8
 
 	dhash_entries=	[KNL]
 			Set number of hash buckets for dentry cache.

             reply	other threads:[~2008-01-14  1:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-14  0:52 Samuel Thibault [this message]
2008-01-14  1:40 ` Jan Engelhardt
2008-01-14 10:24   ` Samuel Thibault
2008-01-14  3:50 ` H. Peter Anvin
2008-01-14 10:27   ` 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=20080114005219.GA4296@implementation \
    --to=samuel.thibault@ens-lyon.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH] Default keyboard LEDs' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).