On Friday 24 August 2001 08:19, Sreeramkr wrote:
> Hi,
> I am trying to hook ctrl_alt_esc sequence and send a signal to an app
> which displays that these keys have been pressed then, send a soft irq
> to nonrtl kbd driver. I want to know how can
> I go about catching these scan codes in my rtl code. I mean the psuedo
> code. Coz, these will be sent as continuous scan codes and hence they
> are 3 interrupts.
For actual *sequences*; use a state machine, possibly in conjunction with
a LIFO stack. (Fundamental parser stuff. :-)
However, in this case, I don't think you're looking for a specific
sequence of events, but rather a state where three specific keys are held
down at the same time. (Or perhaps, that the esc key is pressed while
ctrl and alt are held down. Think about it; there's a distinct
difference.)
A key is down if you've received it's "down" scan code, but not it's "up"
scan code. So, you can just set up an array of flags; one for each key,
and update that array whenever you receive a scan code. Set the flag when
you get a "down" scan code, clear the flag when you get an "up" scan code.
(BTW, note that many keyboard generate "extended", multi-byte scan codes
for some keys. IIRC, this is the case with all XT and AT keyboards.)
Every time you receive the "down" scan code for ctrl, alt or escape, just
check the flags for all those keys - if they're all set, your condition
is met. (Don't check for *every* "down" code, because that would make it
look like you've hint ctrl+alt+esc again if you happen to press any other
key before releasing at least one of ctrl/alt/esc. No big deal, but it
doesn't hurt to do the Right Thing. :-)
//David Olofson --- Programmer, Reologica Instruments AB
.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
`----------------------------> http://www.linuxdj.com/maia -'
.- David Olofson -------------------------------------------.
| Audio Hacker - Open Source Advocate - Singer - Songwriter |
`--------------------------------------> [EMAIL PROTECTED] -'
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/