Re: [PATCH] sysrq: allow user trigger sysrq by upper-case characterkey

From: Randy Dunlap
Date: Wed Mar 06 2013 - 14:30:55 EST


On 03/05/13 20:07, zhangwei(Jovi) wrote:
> See the help text output of /proc/sysrq-trigger:
>
> SysRq : HELP : loglevel(0-9) reBoot Crash terminate-all-tasks(E)
> memory-full-oom-kill(F) kill-all-tasks(I) ...
>
> Most command is referenced by responding upper-case character,
> this would hint user can trigger sysrq by upper-case character key,
> but that's wrong, sysrq only accept lower-case character currently.
>
> It's reasonable to let user trigger sysrq by upper-case character key.
>

Since the sysrq_key_table[] is basically full and we don't have a path (plan)
for how to expand it, would it be reasonable to map upper case characters
to different functions from their corresponding lower case characters,
or is that just too confusing?

The help text can be fixed:

SysRq: HELP : loglevel(0-9) reboot(b) crash(c) terminate-all-tasks(e)
memory-full-oom-kill(f) kill-all-tasks(i) ...


> Signed-off-by: zhnagwei(Jovi) <jovi.zhangwei@xxxxxxxxxx>
> ---
> drivers/tty/sysrq.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
> index 3687f0c..a88908e 100644
> --- a/drivers/tty/sysrq.c
> +++ b/drivers/tty/sysrq.c
> @@ -471,6 +471,8 @@ static int sysrq_key_table_key2index(int key)
> retval = key - '0';
> else if ((key >= 'a') && (key <= 'z'))
> retval = key + 10 - 'a';
> + else if ((key >= 'A') && (key <= 'Z'))
> + retval = key + 10 - 'A';
> else
> retval = -1;
> return retval;
>


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