Distribution: Irrelevant, but it's Debian woody stable+testing Hardware Environment: Fujitsu Lifebook B142 Software Environment: Irrelevant Problem Description: The kernel keyboard driver and handler wrongly assume that SysRq (on PC) must be equivalent to Alt-PrintScreen. This is unfortunately a wrong assumption on my notebook's keyboard, which provides a [Fn]- key combo for SysRq. A bug in the keyboard driver atkbd.c makes the the kernel unable to distinguish PrintScreen (also provided by a [Fn]- key combo in my notebook) and SysRq. Both generate the same input_event's. What's worse: the sysrq handler deep inside the kernel also assumes that Alt must be pressed (and not yet released) when SysRq is pressed. So, it refuses to work unless I press Alt-SysRq. I consider this a bug. Steps to reproduce: Compile kernel with keyboard support (CONFIG_SERIO_I8042, CONFIG_KEYBOARD_ATKBD), either as module or built-in. Then, use the [Fn] key combos! e.g. modprobe evbug Now, press PrintScreen using the [Fn] key combo. dmesg shows: evbug.c: Connected device: "AT Translated Set 2 keyboard", isa0060/serio0/input0 evbug.c: Event. Dev: isa0060/serio0/input0, Type: 1, Code: 99, Value: 1 evbug.c: Event. Dev: isa0060/serio0/input0, Type: 0, Code: 0, Value: 0 evbug.c: Event. Dev: isa0060/serio0/input0, Type: 1, Code: 99, Value: 0 evbug.c: Event. Dev: isa0060/serio0/input0, Type: 0, Code: 0, Value: 0 NOTE: Code: 99 means SysRq!!! Pressing SysRq using the [Fn] key combo, dmesg shows the same things. Please don't ask me for the results of 'showkey -s'. It is faked by the input driver, and hence unreliable. I used the SERIO_USERDEV patch and did a "od -t x1 /dev/misc/isa0060/serio0" and got the following: Pressing PrintScreen: 0xe0 0x2a 0xe0 0x37 0xe0 0xb7 0xe0 0xaa Pressing SysRq: 0x54 0xd4 whereas showkey -s showed the same thing for PrintScreen whether I'm realling pressing PrintScreen or SysRq.
Created attachment 3030 [details] First half of the fix: removes the wrong assumption in atkbd.c This fixes atkbd.c, so that SysRq and PrintScreen now generated distinct events: Now, PrintScreen *correctly* generates: evbug.c: Event. Dev: isa0060/serio0/input0, Type: 1, Code: 55, Value: 1 evbug.c: Event. Dev: isa0060/serio0/input0, Type: 0, Code: 0, Value: 0 evbug.c: Event. Dev: isa0060/serio0/input0, Type: 1, Code: 55, Value: 0 evbug.c: Event. Dev: isa0060/serio0/input0, Type: 0, Code: 0, Value: 0 and SysRq *correctly* generates: evbug.c: Event. Dev: isa0060/serio0/input0, Type: 1, Code: 99, Value: 1 evbug.c: Event. Dev: isa0060/serio0/input0, Type: 0, Code: 0, Value: 0 evbug.c: Event. Dev: isa0060/serio0/input0, Type: 1, Code: 99, Value: 0 evbug.c: Event. Dev: isa0060/serio0/input0, Type: 0, Code: 0, Value: 0
Created attachment 3031 [details] Second half of bug fix: keyboard handler no longer require Alt to be pressed with SysRq This fixes the wrong assumption in the kernel's keyboard event handler, so that it no longer assumes that Alt (either one) must be pressed before SysRq can be pressed.
I'm sorry you can't use the fn+printscreen function on your LifeBook, but such is life. Is using Alt+printscreen such a big difference? On USB keyboards (and many others, too), there is no specific SysRq keycode, and thus the kernel magic-sysrq handler uses the alt-printscreen combination, to make it work on ALL keyboards. This is intentional. Further, keycode 99 is KEY_SYSRQ, as defined in input.h, and is used for the PrtScr/SysRq key. Keycode 55 is KEY_KPASTERISK. Keycodes are NOT the same as raw scancodes. So your patch won't be applied, because current behavior is intended and not a bug.