Default keyboard LEDs
Subsystems (3)
PATCH 1/1 Default keyboard LEDs
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.
---
Actually, what would be perfect would be to use the configuration that the BIOS sets at boot by default. That is device-dependent, however.
drivers/char/keyboard.c renamed from drivers/char/keyboard.c.orig +5 -2
@@ -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 ;
include/linux/kbd_kern.h renamed from include/linux/kbd_kern.h.orig +1 -0
@@ -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..)
Documentation/kernel-parameters.txt renamed from Documentation/kernel-parameters.txt.orig +9 -0
@@ -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.
Quoted 9 lines · Samuel Thibault
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)
Quoted 10 lines · Jan Engelhardt, le Mon 14 Jan 2008 02:40:08 +0100, a écrit :
Quoted 8 lines · Samuel Thibault
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.
Quoted 3 lines
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
-
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Samuel Thibault
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.
Quoted 5 lines
Signed-off-by Samuel Thibault <[email protected]>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
Quoted 6 lines · H. Peter Anvin, le Sun 13 Jan 2008 19:50:34 -0800, a écrit :
Quoted 3 lines
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 :)
Quoted 15 lines
--------K-M00400017-------------------------- MEM 0040h:0017h - KEYBOARD - STATUS FLAGS 1
Size: BYTE
SeeAlso: MEM 0040h:0018h,INT 16/AH=02h,MEM 0040h:0096hBitfields 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
Quoted 3 lines
SeeAlso: #M0011,#00587
The same information is available through INT 16h, AH=02h.
Samuel
-
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html