LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] Default keyboard LEDs
@ 2008-01-14 0:52 Samuel Thibault
2008-01-14 1:40 ` Jan Engelhardt
2008-01-14 3:50 ` H. Peter Anvin
0 siblings, 2 replies; 5+ messages in thread
From: Samuel Thibault @ 2008-01-14 0:52 UTC (permalink / raw)
To: linux-input; +Cc: linux-kernel
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Default keyboard LEDs
2008-01-14 0:52 [PATCH] Default keyboard LEDs Samuel Thibault
@ 2008-01-14 1:40 ` Jan Engelhardt
2008-01-14 10:24 ` Samuel Thibault
2008-01-14 3:50 ` H. Peter Anvin
1 sibling, 1 reply; 5+ messages in thread
From: Jan Engelhardt @ 2008-01-14 1:40 UTC (permalink / raw)
To: Samuel Thibault; +Cc: linux-input, linux-kernel
On Jan 14 2008 00:52, Samuel Thibault wrote:
>
>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.
Apart from openvt being able to find the first unused tty,
what is openvt good for? (Read: I could just as well run
`bash </dev/tty8 >/dev/tty8 2>/dev/tty8`)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Default keyboard LEDs
2008-01-14 1:40 ` Jan Engelhardt
@ 2008-01-14 10:24 ` Samuel Thibault
0 siblings, 0 replies; 5+ messages in thread
From: Samuel Thibault @ 2008-01-14 10:24 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: linux-input, linux-kernel
Jan Engelhardt, le Mon 14 Jan 2008 02:40:08 +0100, a écrit :
> On Jan 14 2008 00:52, Samuel Thibault wrote:
> >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.
>
> Apart from openvt being able to find the first unused tty,
> what is openvt good for? (Read: I could just as well run
> `bash </dev/tty8 >/dev/tty8 2>/dev/tty8`)
But it is a burden (you forgot '&' btw ;) ). Also, openvt properly sets
the controlling tty, can run a login shell, etc...
Anyway, be it openvt or bash, the LED issue exists :)
Samuel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Default keyboard LEDs
2008-01-14 0:52 [PATCH] Default keyboard LEDs Samuel Thibault
2008-01-14 1:40 ` Jan Engelhardt
@ 2008-01-14 3:50 ` H. Peter Anvin
2008-01-14 10:27 ` Samuel Thibault
1 sibling, 1 reply; 5+ messages in thread
From: H. Peter Anvin @ 2008-01-14 3:50 UTC (permalink / raw)
To: Samuel Thibault, linux-input, linux-kernel
Samuel Thibault wrote:
> 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.
>
It is, but it can be read out either by INT calls at initialization
time, or by reading out the byte at physical address 0x417:
--------K-M00400017--------------------------
MEM 0040h:0017h - KEYBOARD - STATUS FLAGS 1
Size: BYTE
SeeAlso: MEM 0040h:0018h,INT 16/AH=02h,MEM 0040h:0096h
Bitfields for keyboard status flags 1:
Bit(s) Description (Table M0010)
7 INSert active
6 Caps Lock active
5 Num Lock active
4 Scroll Lock active
3 either Alt pressed
2 either Ctrl pressed
1 Left Shift pressed
0 Right Shift pressed
SeeAlso: #M0011,#00587
The same information is available through INT 16h, AH=02h.
-hpa
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Default keyboard LEDs
2008-01-14 3:50 ` H. Peter Anvin
@ 2008-01-14 10:27 ` Samuel Thibault
0 siblings, 0 replies; 5+ messages in thread
From: Samuel Thibault @ 2008-01-14 10:27 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: linux-input, linux-kernel
H. Peter Anvin, le Sun 13 Jan 2008 19:50:34 -0800, a écrit :
> >Actually, what would be perfect would be to use the configuration that
> >the BIOS sets at boot by default. That is device-dependent, however.
> >
>
> It is, but it can be read out either by INT calls at initialization
> time, or by reading out the byte at physical address 0x417:
I should have said "arch-dependent".
I didn't mean it wasn't possible, but just it'd probably be better that
driver experts do it, not me :)
> --------K-M00400017--------------------------
> MEM 0040h:0017h - KEYBOARD - STATUS FLAGS 1
> Size: BYTE
> SeeAlso: MEM 0040h:0018h,INT 16/AH=02h,MEM 0040h:0096h
>
> Bitfields for keyboard status flags 1:
> Bit(s) Description (Table M0010)
> 7 INSert active
> 6 Caps Lock active
> 5 Num Lock active
> 4 Scroll Lock active
> 3 either Alt pressed
> 2 either Ctrl pressed
> 1 Left Shift pressed
> 0 Right Shift pressed
> SeeAlso: #M0011,#00587
>
> The same information is available through INT 16h, AH=02h.
Samuel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-01-14 10:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-14 0:52 [PATCH] Default keyboard LEDs Samuel Thibault
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
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).