Sysrq works too well (no need of alt)
Subsystems (4)
Hello,
I haven't investigated much yet, but I have the feeling that since 2.6.35-rc1 my "Print Screen/SysRq" key works only as SysRq: if I press it (normally assigned to take screenshot in gnome), nothing happens (no input event received in userspace) and no key on the keyboard works afterwards, until I press Alt. Actually the keys work, but behave as if the sysrq key was kept pressed (can be seen in dmesg, or by pressing "b").
Looking at the log, a potential culprit is commit 97f5f0cd8cd0a05449cbb77d1e6f02e026875802 (Input: implement SysRq as a separate input handler). Probably the logic of "have to press all the keys at the same time" changed to "have to press the keys one after each other". So pressing alt and later on pressing PrintScreen leads to a SysRq.
Does anybody else see this behaviour? Any suggestion on how to solve this bug? I'll try reverting the commit and report if it fixes the problem (the git revert fails so I've got to fix the conflict manually).
Cheers,
Eric
Op 08-06-10 11:33, Éric Piel schreef:
Quoted 14 lines
Hello,
I haven't investigated much yet, but I have the feeling that since 2.6.35-rc1 my "Print Screen/SysRq" key works only as SysRq: if I press it (normally assigned to take screenshot in gnome), nothing happens (no input event received in userspace) and no key on the keyboard works afterwards, until I press Alt. Actually the keys work, but behave as if the sysrq key was kept pressed (can be seen in dmesg, or by pressing "b").Looking at the log, a potential culprit is commit
97f5f0cd8cd0a05449cbb77d1e6f02e026875802(Input: implement SysRq as a separate input handler). Probably the logic of "have to press all the keys at the same time" changed to "have to press the keys one after each other". So pressing alt and later on pressing PrintScreen leads to a SysRq.
Quoted 3 lines
Does anybody else see this behaviour? Any suggestion on how to solve this bug? I'll try reverting the commit and report if it fixes the problem (the git revert fails so I've got to fix the conflict manually).
I can confirm this regression is due to 97f5f0cd8cd0a05449cbb77d1e6f02e026875802: the reverting patch below fixes it. And, as long as you don't press alt since boot, PrintScreen works fine. So it is likely due to not taking into account key releases.
Dmitry, do you have a better fix? I'll be happy to test it if needed.
Cheers,
Eric 8<---------------------------------------------------------
This reverts commit 97f5f0cd8cd0a05449cbb77d1e6f02e026875802. Trying to solve sysrq too easy
Conflicts:
drivers/char/keyboard.c
--- drivers/char/keyboard.c | 54 ++++++++++- drivers/char/sysrq.c | 243 ++++++----------------------------------------- include/linux/sysrq.h | 23 +++-- kernel/sysctl.c | 23 +---- 4 files changed, 99 insertions(+), 244 deletions(-)
drivers/char/keyboard.c +53 -1
@@ -40,6 +40,7 @@#include <linux/kbd_kern.h> #include <linux/kbd_diacr.h> #include <linux/vt_kern.h> +#include <linux/sysrq.h> #include <linux/input.h> #include <linux/reboot.h> #include <linux/notifier.h>
@@ -83,7 +84,8 @@ void compute_shiftstate(void);typedef void (k_handler_fn )(struct vc_data *vc,unsigned char value,char up_flag);static k_handler_fn K_HANDLERS ; -static k_handler_fn *k_handler[16 ] = {K_HANDLERS }; +k_handler_fn *k_handler[16 ] = {K_HANDLERS }; +EXPORT_SYMBOL_GPL (k_handler);#define FN_HANDLERS \ fn_null, fn_enter, fn_show_ptregs, fn_show_mem,\
@@ -147,6 +149,22 @@ static struct ledptr { unsigned char valid:1; } ledptrs[3 ]; +/* Simple translation table for the SysRq keys */ + +#ifdef CONFIG_MAGIC_SYSRQ +unsigned char kbd_sysrq_xlate[KEY_MAX +1 ] = +"\000\0331234567890-=\177\t" /* 0x00 - 0x0f */ +"qwertyuiop[]\r\000as" /* 0x10 - 0x1f */ +"dfghjkl;'`\000\\zxcv" /* 0x20 - 0x2f */ +"bnm,./\000*\000 \000\201\202\203\204\205" /* 0x30 - 0x3f */ +"\206\207\210\211\212\000\000789-456+1" /* 0x40 - 0x4f */ +"230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */ +"\r\000/" ;/* 0x60 - 0x6f */ +static int sysrq_down; +static int sysrq_alt_use; +#endif +static int sysrq_alt; +/* * Notifier list for console keyboard events */
@@ -1092,6 +1110,23 @@ static int emulate_raw(struct vc_data *vc, unsigned int keycode,put_queue (vc,0xf1 );break ; +// case KEY_SYSRQ: +// /* +// * Real AT keyboards (that's what we're trying +// * to emulate here emit 0xe0 0x2a 0xe0 0x37 when +// * pressing PrtSc/SysRq alone, but simply 0x54 +// * when pressing Alt+PrtSc/SysRq. +// */ +// if (sysrq_alt) { +// put_queue(vc, 0x54 | up_flag); +// } else { +// put_queue(vc, 0xe0); +// put_queue(vc, 0x2a | up_flag); +// put_queue(vc, 0xe0); +// put_queue(vc, 0x37 | up_flag); +// } +// break; +case KEY_SYSRQ :/* * Real AT keyboards (that's what we're trying
@@ -1171,6 +1206,8 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw) kbd = kbd_table + vc->vc_num; +if (keycode ==KEY_LEFTALT || keycode ==KEY_RIGHTALT ) + sysrq_alt = down ? keycode :0 ;#ifdef CONFIG_SPARC if (keycode ==KEY_STOP ) sparc_l1_a_state = down;
@@ -1185,6 +1222,21 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw)pr_warning ("can't emulate rawmode for keycode %d\n" , keycode); +#ifdef CONFIG_MAGIC_SYSRQ /* Handle the SysRq Hack */ +if (keycode ==KEY_SYSRQ && (sysrq_down || (down ==1 && sysrq_alt))) { +if (!sysrq_down) { + sysrq_down = down; + sysrq_alt_use = sysrq_alt; + } +return ; + } +if (sysrq_down && !down && keycode == sysrq_alt_use) + sysrq_down =0 ; +if (sysrq_down && down && !rep) { +handle_sysrq (kbd_sysrq_xlate[keycode], tty); +return ; + } +#endif #ifdef CONFIG_SPARC if (keycode ==KEY_A && sparc_l1_a_state) { sparc_l1_a_state = false;
drivers/char/sysrq.c +30 -213
348 lines not on this page · raw message
include/linux/sysrq.h +15 -8
@@ -39,34 +39,41 @@ struct sysrq_key_op {#ifdef CONFIG_MAGIC_SYSRQ +extern int sysrq_on (void ); + +/* +* Do not use this one directly: +*/ +extern int __sysrq_enabled; +/* Generic SysRq interface -- you may call it from any device driver, supplying * ASCII code of the key, pointer to registers and kbd/tty structs (if they * are available -- else NULL's). */ void handle_sysrq (int key,struct tty_struct *tty); +void __handle_sysrq (int key,struct tty_struct *tty,int check_mask);int register_sysrq_key (int key,struct sysrq_key_op *op);int unregister_sysrq_key (int key,struct sysrq_key_op *op);struct sysrq_key_op *__sysrq_get_key_op (int key); -int sysrq_toggle_support (int enable_mask); -#else -static inline void handle_sysrq (int key,struct tty_struct *tty) +static inline int sysrq_on (void ) { +return 0 ; } - -static inline int register_sysrq_key (int key,struct sysrq_key_op *op) +static inline int __reterr (void ) {return -EINVAL ; } - -static inline int unregister_sysrq_key (int key,struct sysrq_key_op *op) +static inline void handle_sysrq (int key,struct tty_struct *tty) { -return -EINVAL ; } +#define register_sysrq_key (ig,nore) __reterr() +#define unregister_sysrq_key (ig,nore) __reterr() +#endif #endif /* _LINUX_SYSRQ_H */
kernel/sysctl.c +1 -22
@@ -165,27 +165,6 @@ static int proc_taint(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos);#endif -#ifdef CONFIG_MAGIC_SYSRQ -static int __sysrq_enabled;/* Note: sysrq code ises it's own private copy */ - -static int sysrq_sysctl_handler (ctl_table *table,int write, -void __user *buffer,size_t *lenp, -loff_t *ppos) -{ -int error; - - error =proc_dointvec (table, write, buffer, lenp, ppos); -if (error) -return error; - -if (write) -sysrq_toggle_support (__sysrq_enabled); - -return 0 ; -} - -#endif -static struct ctl_table root_table[];static struct ctl_table_root sysctl_table_root;static struct ctl_table_header root_table_header = {
@@ -595,7 +574,7 @@ static struct ctl_table kern_table[] = { .data = &__sysrq_enabled, .maxlen = sizeof (int), .mode = 0644, - .proc_handler = sysrq_sysctl_handler, + .proc_handler = proc_dointvec, },#endif #ifdef CONFIG_PROC_SYSCTL
Signature · 6 lines
1.7.1 -- 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 21 lines · Éric Piel
Op 08-06-10 11:33, Éric Piel schreef:
Quoted 16 lines
Hello,
I haven't investigated much yet, but I have the feeling that since 2.6.35-rc1 my "Print Screen/SysRq" key works only as SysRq: if I press it (normally assigned to take screenshot in gnome), nothing happens (no input event received in userspace) and no key on the keyboard works afterwards, until I press Alt. Actually the keys work, but behave as if the sysrq key was kept pressed (can be seen in dmesg, or by pressing "b").Looking at the log, a potential culprit is commit
97f5f0cd8cd0a05449cbb77d1e6f02e026875802(Input: implement SysRq as a separate input handler). Probably the logic of "have to press all the keys at the same time" changed to "have to press the keys one after each other". So pressing alt and later on pressing PrintScreen leads to a SysRq.Quoted 3 lines
Does anybody else see this behaviour? Any suggestion on how to solve this bug? I'll try reverting the commit and report if it fixes the problem (the git revert fails so I've got to fix the conflict manually).
Quoted 7 lines
I can confirm this regression is due to
97f5f0cd8cd0a05449cbb77d1e6f02e026875802: the reverting patch below fixes it. And, as long as you don't press alt since boot, PrintScreen works fine. So it is likely due to not taking into account key releases.Dmitry, do you have a better fix? I'll be happy to test it if needed.
Not yet, but I see the effects you are describing... Stay tuned...
Thanks.
Signature · 5 lines
Dmitry -- 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 27 lines · Dmitry Torokhov
Quoted 26 lines · Éric Piel
Op 08-06-10 11:33, Éric Piel schreef:
Quoted 16 lines
Hello,
I haven't investigated much yet, but I have the feeling that since 2.6.35-rc1 my "Print Screen/SysRq" key works only as SysRq: if I press it (normally assigned to take screenshot in gnome), nothing happens (no input event received in userspace) and no key on the keyboard works afterwards, until I press Alt. Actually the keys work, but behave as if the sysrq key was kept pressed (can be seen in dmesg, or by pressing "b").Looking at the log, a potential culprit is commit
97f5f0cd8cd0a05449cbb77d1e6f02e026875802(Input: implement SysRq as a separate input handler). Probably the logic of "have to press all the keys at the same time" changed to "have to press the keys one after each other". So pressing alt and later on pressing PrintScreen leads to a SysRq.Quoted 3 lines
Does anybody else see this behaviour? Any suggestion on how to solve this bug? I'll try reverting the commit and report if it fixes the problem (the git revert fails so I've got to fix the conflict manually).
I can confirm this regression is due to
97f5f0cd8cd0a05449cbb77d1e6f02e026875802: the reverting patch below fixes it. And, as long as you don't press alt since boot, PrintScreen works fine. So it is likely due to not taking into account key releases.
Quoted 5 lines
Quoted 2 lines
Dmitry, do you have a better fix? I'll be happy to test it if needed.
Not yet, but I see the effects you are describing... Stay tuned...
Eric, could you tell me if the following fixes the problem for you?
Thanks!
Signature · 14 lines
Dmitry Input: sysrq - fix "stuck" SysRq mode This shoud fix the problem with SysRq mode staying half-way enabled and interfereing with normal PrtScrn operation after user presses ALT for the first time. Reported-by: Éric Piel <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]> --- drivers/char/sysrq.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
drivers/char/sysrq.c +6 -2
@@ -579,8 +579,12 @@ static bool sysrq_filter(struct input_handle *handle, unsigned int type,case KEY_RIGHTALT :if (value) sysrq_alt = code; -else if (sysrq_down && code == sysrq_alt_use) - sysrq_down = false; +else { +if (sysrq_down && code == sysrq_alt_use) + sysrq_down = false; + + sysrq_alt =0 ; + }break ;case KEY_SYSRQ :
--
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
Op 09-06-10 10:30, Dmitry Torokhov schreef:
Quoted 3 lines
Eric, could you tell me if the following fixes the problem for you?
Hi,
This patch fixes the problem here. Thanks a lot.
Eric
Quoted 14 lines · Éric Piel
Hello,
I haven't investigated much yet, but I have the feeling that since 2.6.35-rc1 my "Print Screen/SysRq" key works only as SysRq: if I press it (normally assigned to take screenshot in gnome), nothing happens (no input event received in userspace) and no key on the keyboard works afterwards, until I press Alt. Actually the keys work, but behave as if the sysrq key was kept pressed (can be seen in dmesg, or by pressing "b").Looking at the log, a potential culprit is commit
97f5f0cd8cd0a05449cbb77d1e6f02e026875802(Input: implement SysRq as a separate input handler). Probably the logic of "have to press all the keys at the same time" changed to "have to press the keys one after each other". So pressing alt and later on pressing PrintScreen leads to a SysRq.
Quoted 3 lines
Does anybody else see this behaviour? Any suggestion on how to solve this bug? I'll try reverting the commit and report if it fixes the problem (the git revert fails so I've got to fix the conflict manually).
Is this still a problem with 2.6.35-rc3?
Rafael
Op 19-06-10 23:16, Rafael J. Wysocki schreef:
Quoted 15 lines · Éric Piel
Quoted 14 lines
Hello,
I haven't investigated much yet, but I have the feeling that since 2.6.35-rc1 my "Print Screen/SysRq" key works only as SysRq: if I press it (normally assigned to take screenshot in gnome), nothing happens (no input event received in userspace) and no key on the keyboard works afterwards, until I press Alt. Actually the keys work, but behave as if the sysrq key was kept pressed (can be seen in dmesg, or by pressing "b").Looking at the log, a potential culprit is commit
97f5f0cd8cd0a05449cbb77d1e6f02e026875802(Input: implement SysRq as a separate input handler). Probably the logic of "have to press all the keys at the same time" changed to "have to press the keys one after each other". So pressing alt and later on pressing PrintScreen leads to a SysRq.
Quoted 5 lines
Quoted 3 lines
Does anybody else see this behaviour? Any suggestion on how to solve this bug? I'll try reverting the commit and report if it fixes the problem (the git revert fails so I've got to fix the conflict manually).
Is this still a problem with 2.6.35-rc3?
The bug is still in 2.6.35-rc3. The patch that fixes this regression is in the "for-linus" branch of the input tree, but I think Dmitry hasn't yet sent a pull request to Linus.
Eric
--
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 16 lines · Éric Piel
Op 19-06-10 23:16, Rafael J. Wysocki schreef:
Quoted 15 lines · Éric Piel
Quoted 14 lines
Hello,
I haven't investigated much yet, but I have the feeling that since 2.6.35-rc1 my "Print Screen/SysRq" key works only as SysRq: if I press it (normally assigned to take screenshot in gnome), nothing happens (no input event received in userspace) and no key on the keyboard works afterwards, until I press Alt. Actually the keys work, but behave as if the sysrq key was kept pressed (can be seen in dmesg, or by pressing "b").Looking at the log, a potential culprit is commit
97f5f0cd8cd0a05449cbb77d1e6f02e026875802(Input: implement SysRq as a separate input handler). Probably the logic of "have to press all the keys at the same time" changed to "have to press the keys one after each other". So pressing alt and later on pressing PrintScreen leads to a SysRq.
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
Does anybody else see this behaviour? Any suggestion on how to solve this bug? I'll try reverting the commit and report if it fixes the problem (the git revert fails so I've got to fix the conflict manually).
Is this still a problem with 2.6.35-rc3?
The bug is still in 2.6.35-rc3. The patch that fixes this regression is in the "for-linus" branch of the input tree, but I think Dmitry hasn't yet sent a pull request to Linus.
The fix should be in mainline now.
Signature · 5 lines
Dmitry -- 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