From: "H. Peter Anvin" <hpa@zytor.com>
To: "Joshua C." <joshuacov@googlemail.com>
Cc: Bodo Eggert <7eggert@gmx.de>, linux-kernel@vger.kernel.org
Subject: Re: [RESUBMIT] [PATCH] Use BIOS Keyboard variable to set Numlock
Date: Wed, 29 Feb 2012 15:11:53 -0800 [thread overview]
Message-ID: <4F4EB0B9.2080906@zytor.com> (raw)
In-Reply-To: <CAKL7Q7o7udqrvKou=CSxuzJOuAJfemU4bizSsAtaebJZbBMRFQ@mail.gmail.com>
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.
next prev parent reply other threads:[~2012-02-29 23:12 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-27 19:23 [RESUBMIT] [PATCH] Use BIOS Keyboard variable to set Numlock Joshua C.
2012-02-27 21:09 ` H. Peter Anvin
2012-02-28 0:08 ` Joshua C.
2012-02-28 0:14 ` H. Peter Anvin
2012-02-28 0:27 ` H. Peter Anvin
2012-02-28 9:14 ` Joshua C.
2012-02-28 18:32 ` Bodo Eggert
2012-02-28 18:35 ` H. Peter Anvin
2012-02-29 11:43 ` Joshua C.
2012-02-29 17:54 ` Bodo Eggert
2012-02-29 18:16 ` H. Peter Anvin
2012-02-29 22:56 ` Joshua C.
2012-02-29 23:11 ` H. Peter Anvin [this message]
2012-02-29 23:51 ` Joshua C.
2012-03-01 0:13 ` H. Peter Anvin
2012-03-01 0:21 ` Joshua C.
2012-03-01 0:23 ` H. Peter Anvin
2012-03-01 0:28 ` Joshua C.
2012-03-01 19:42 ` Joshua C.
2012-03-01 20:54 ` H. Peter Anvin
2012-03-02 17:53 ` Joshua C.
2012-03-02 18:28 ` H. Peter Anvin
2012-03-02 21:21 ` Joshua C.
2012-03-02 21:32 ` H. Peter Anvin
[not found] ` <CAKL7Q7ru8NDW=2wVRjzkYnw5GMordFEUKGLBUon0-knH5fAsew@mail.gmail.com>
[not found] ` <20120304000031.58d23f65@pyramind.ukuu.org.uk>
[not found] ` <CAKL7Q7pzhg+_W65Ce2Kj9QRPrFmT2kTOdzY_TDEeQibgpERxTw@mail.gmail.com>
[not found] ` <4F6A045C.5090602@zytor.com>
[not found] ` <CAKL7Q7q_fOTovsBLDFqsC49dni_MDiioZjCCE-2DY4a0hqNPOA@mail.gmail.com>
2012-04-08 12:56 ` Joshua C.
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=4F4EB0B9.2080906@zytor.com \
--to=hpa@zytor.com \
--cc=7eggert@gmx.de \
--cc=joshuacov@googlemail.com \
--cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).