Re: Magic Sysreg key problems.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday, 22. August 2012. 15.05.05 Joe Zeff wrote:
> On 08/22/2012 02:17 PM, jdow wrote:
> > Even with the reminders I've seen people keep forgetting that most
> > modern keyboards are two key roll-over keyboards. The keys are matrix
> > scanned in a fashion that any two keys pressed at the same time can
> > be detected but more than two keys pressed at the same time is very
> > iffy. You guys may be fighting an inherent keyboard problem rather
> > than an OS deficiency.
> 
> That may be why some of the instructions for this call for pressing
> Alt-SysRq (pause) Command, and why I've had best luck with pressing the
> keys one at a time and holding them down until all are pressed.

Umm, no, you are *supposed* to keep them pressed. The problem with two-key 
rollover keyboard is that it will not detect a third keypress until one of the 
previous two was released. And that is the dealbreaker in using the MagicSysRq 
functionality.

It is a good thing to understand how this sysrq thing actually works, and for 
that one needs to know how a keyboard actually works (on a fairly low level).

When a key is pressed, the press-scancode of that key is sent to the keyboard 
buffer. When the key is released, the release-scancode of that key is sent. 
Note that press-scancode and release-scancode are different things. If you 
press the key and keep it pressed, eventually the keyboard-repeat 
functionality kicks in, and the press-scancode starts being sent over and 
over. All keys on the keyboard work that way (and I mean *all*, bar maybe the 
"Fn" key on some laptops).

The press- and release-scancodes in the keyboard buffer are being interpreted 
by the kernel, translated via a table into keypress/keyrelease combinations, 
and then sent down to everything else, including X and stuff. Now, the kernel 
can react (independently of anything else) to some specific scancode 
combinations, before any other app even gets the idea that something was 
pressed on the keyboard. That's where the MagicSysRq functionality kicks in.

The trick is that this specific scancode combo that needs to be sent to the 
kernel needs to be convoluted enough so that it cannot occur accidentally. 
Therefore, it is a sequence of *press-scancodes*, corresponding to the 
combinations such as ctrl+alt+sysrq+b, and no release-scancodes in between. 
This means the following:

(1) you need to press the buttons in *that* particular *order* , one by one,
(2) you must not release any of them until all have been pressed,
(3) you must be fast enough so that keyboard-repeat doesn't kick in (most 
commonly this means faster than 1/4 of a second),
(4) your keyboard hardware must be able to detect four keys pressed in a row 
(without releasing any of them).

Various cheap keyboards cannot satisfy (4), various people are not fast enough 
for (3), and various instruction manuals do not emphasize (1) and (2) well-
enough.

In addition to this, note that left-ctrl/shift/alt have *different* scancodes 
than right-ctrl/shift/alt. I am not sure if the kernel is designed to watch 
out for all combinations (ll, lr, rl, rr), nor the interchange in order of 
ctrl and alt. So it is best to try out all combinations, to be certain.

Finally, the "b" key is where "b" is meant to be on a QWERTY keyboard. If you 
have a keyboard with a different layout (DVORAK for example), this key will 
likely be labbeled as something else, so watch out for that.

There is a nice table with all keys and their functions in sysrq mode here:

  http://en.wikipedia.org/wiki/Magic_SysRq_key

As a side note, I've also seen keyboards with a spacebar that has two "key"-
mechanisms beneath (on the left and right side), so that two different press-
scancodes are being sent when you press the spacebar, detecting whether you 
have pressed it from the left or right side. This was exploited in some 
pinball games, with options "kick the pinball machine with the left/right 
foot" were simulated by pressing the spacebar from the left or from the 
right... ;-)

If you want to experiment with scancodes and keycodes, read "man showkey" and 
try it out in the text terminal (outside X).

HTH, :-)
Marko


-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org


[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux