lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 29 Feb 2012 15:11:53 -0800
From:	"H. Peter Anvin" <hpa@...or.com>
To:	"Joshua C." <joshuacov@...glemail.com>
CC:	Bodo Eggert <7eggert@....de>, linux-kernel@...r.kernel.org
Subject: Re: [RESUBMIT] [PATCH] Use BIOS Keyboard variable to set Numlock

Looks good, *except* that this will break the compile for all non-x86
architectures.  It might be worthwhile to factor out the
architecture-dependent bits for cleanliness.

	-hpa

On 02/29/2012 02:56 PM, Joshua C. wrote:
> diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
> index a605549..40a33bf 100644
> --- a/drivers/tty/vt/keyboard.c
> +++ b/drivers/tty/vt/keyboard.c
> @@ -24,6 +24,8 @@
> 
>  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> 
> +#include <asm/io.h>
> +#include <asm/setup.h>
>  #include <linux/consolemap.h>
>  #include <linux/module.h>
>  #include <linux/sched.h>
> @@ -52,19 +54,6 @@ extern void ctrl_alt_del(void);
> 
>  #define KBD_DEFMODE ((1 << VC_REPEAT) | (1 << VC_META))
> 
> -/*
> - * Some laptops take the 789uiojklm,. keys as number pad when NumLock is on.
> - * This seems a good reason to start with NumLock off. On HIL keyboards
> - * of PARISC machines however there is no NumLock key and everyone
> expects the keypad
> - * to be used for numbers.
> - */
> -
> -#if defined(CONFIG_PARISC) && (defined(CONFIG_KEYBOARD_HIL) ||
> defined(CONFIG_KEYBOARD_HIL_OLD))
> -#define KBD_DEFLEDS (1 << VC_NUMLOCK)
> -#else
> -#define KBD_DEFLEDS 0
> -#endif
> -
>  #define KBD_DEFLOCK 0
> 
>  void compute_shiftstate(void);
> @@ -1428,12 +1417,32 @@ static struct input_handler kbd_handler = {
>  	.id_table	= kbd_ids,
>  };
> 
> +/* Let the user decide if we should use the value from the BIOS. */
> +static int numlock = 1;
> +MODULE_PARM_DESC(numlock, "Should we use the NumLock state returned
> by the BIOS? \
> +				(1 = use BIOS Setting, 0 = don't use it)");
> +module_param_named(numlock, numlock, int, 0400);
> +
>  int __init kbd_init(void)
>  {
>  	int i;
>  	int error;
> 
> -        for (i = 0; i < MAX_NR_CONSOLES; i++) {
> +	/*
> +	* Some laptops take the 789uiojklm,. keys as number pad when NumLock is on.
> +	* This seems a good reason to start with NumLock off. On HIL keyboards
> +	* of PARISC machines however there is no NumLock key and everyone
> expects the keypad
> +	* to be used for numbers. That's why we start with NumLock off and
> ask the bios
> +	* for the correct state.
> +	*/
> +
> +	int KBD_DEFLEDS = 0 << VC_NUMLOCK;
> +
> +	/* Numlock status bit set? */
> +	if ((boot_params.kbd_status & 0x20) && numlock)
> +		KBD_DEFLEDS = 1 << VC_NUMLOCK;
> +
> +	for (i = 0; i < MAX_NR_CONSOLES; i++) {
>  		kbd_table[i].ledflagstate = KBD_DEFLEDS;
>  		kbd_table[i].default_ledflagstate = KBD_DEFLEDS;
>  		kbd_table[i].ledmode = LED_SHOW_FLAGS;


-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists