Skip to contentSkip to conversation

sysrq: allow user trigger sysrq by upper-case character key

PATCH In review zhangwei(Jovi) 3 participants 4 messages Mar 6, 2013 – Mar 7, 2013 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sysrq: allow user trigger sysrq by upper-case character key

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.

---
 drivers/tty/sysrq.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/tty/sysrq.c +2 -0
index 3687f0c..a88908e 100644
@@ -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;
Signature · 1 line
1.7.9.7
#1 lore raw
Quoted 11 lines · zhangwei(Jovi)

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) ...

Quoted 19 lines
---
 drivers/tty/sysrq.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/tty/sysrq.c +2 -0
index 3687f0c..a88908e 100644
@@ -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;
Signature · 1 line
~Randy
#2 lore raw
In reply to zhangwei(Jovi)
Quoted 21 lines · On Wed, 6 Mar 2013 12:07:34 +0800 "zhangwei(Jovi)" <[email protected]>…

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.

---
 drivers/tty/sysrq.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/tty/sysrq.c +0 -0
index 3687f0c..a88908e 100644

drivers/tty/sysrq.c static int sysrq_key_table_key2index(int key) · line 478

Quoted 8 lines
drivers/tty/sysrq.c +2 -0
@@ -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;

Then fix the help message ;)

We're already using 19 of the 26 letters and this change would rule out future use of the 26 upper-case letters.

I doubt if anyone is hurting from the inconsistent help message, really.

#3 lore raw
Quoted 34 lines · Andrew Morton
Quoted 21 lines · On Wed, 6 Mar 2013 12:07:34 +0800 "zhangwei(Jovi)" <[email protected]>…

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.

---
 drivers/tty/sysrq.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/tty/sysrq.c +0 -0
index 3687f0c..a88908e 100644

drivers/tty/sysrq.c static int sysrq_key_table_key2index(int key) · line 478

Quoted 8 lines
drivers/tty/sysrq.c +2 -0
@@ -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;

Then fix the help message ;)

Quoted 4 lines

We're already using 19 of the 26 letters and this change would rule out future use of the 26 upper-case letters.

I doubt if anyone is hurting from the inconsistent help message, really.

It's confusing, I always try to trigger sysrq by upper-case character after read help message.

I will resend patch to change the help message instead.

Thanks.

Quoted 1 line