Re: Help writing device driver
From: Grant Edwards (grante_at_visi.com)
Date: 08/22/05
- Next message: Kasper Dupont: "Re: Help writing device driver"
- Previous message: michaelmossey_at_yahoo.com: "Re: Help writing device driver"
- In reply to: michaelmossey_at_yahoo.com: "Re: Help writing device driver"
- Next in thread: Kasper Dupont: "Re: Help writing device driver"
- Reply: Kasper Dupont: "Re: Help writing device driver"
- Reply: michaelmossey_at_yahoo.com: "Re: Help writing device driver"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 22 Aug 2005 21:14:32 -0000
On 2005-08-22, michaelmossey@yahoo.com <michaelmossey@yahoo.com> wrote:
>> X11 already deals with chords: a chord consists of zero or
>> more chording (aka "modifier") keys (e.g. shift, alt, ctrl, or
>> meta) and exactly one non-modifier key.
>
> Right. But I want to make "chords" out of multiple
> non-modifier keys.
No problem. The concept of "modifier" vs. "non-modifier" is
implemented in the X11 keyboard driver, not in the keyboard.
> The keyboard isn't designed to do this;
Isn't designed to do what? The keyboard sends key-down events
as the keys are pressed and key-up events when the keys are
released. That's all. What the key-down/key-up events mean is
up to software.
> but it turns out that several keyboards I tried behave
> sensibly when you push and hold several (non-modifier) keys at
> once: they transmit the keys in rapid sequence.
That's because there is no such thing as "at once". The
keyboard is run by a microprocessor and communicates through a
serial interface. It has to send the key-up/down events one at
a time in the order it detects them. What appears on the
screen after you've done that is a result of how the SW you're
running decided to interpret the key-down and key-up events
from the keys you pressed.
> At least, in X11 (and in Windows XP) when I'm in an app, I see a
> cluster of all the keys I pressed, not necessarily in a fixed order.
Right.
>>> It might not be able to track key releases.
>>
>> It does now.
>
> Right. I'm talking about when you hold multiple non-modifier
> keys: the release behavior might not be what I want. What I
> want is for each key to transmit release when it is truly
> released,
That's what it _does_ do. Here's output from the "xev" program
that shows the events received from the keyboard when I
"chorded" four keys: A+S+D+F:
KeyPress event, serial 27, synthetic NO, window 0x1e00001,
root 0x46, subw 0x0, time 8084531, (34,128), root:(1040,158),
state 0x0, keycode 41 (keysym 0x66, f), same_screen YES,
XLookupString gives 1 bytes: (66) "f"
XmbLookupString gives 1 bytes: (66) "f"
XFilterEvent returns: False
KeyPress event, serial 30, synthetic NO, window 0x1e00001,
root 0x46, subw 0x0, time 8084568, (34,128), root:(1040,158),
state 0x0, keycode 38 (keysym 0x61, a), same_screen YES,
XLookupString gives 1 bytes: (61) "a"
XmbLookupString gives 1 bytes: (61) "a"
XFilterEvent returns: False
KeyPress event, serial 30, synthetic NO, window 0x1e00001,
root 0x46, subw 0x0, time 8084571, (34,128), root:(1040,158),
state 0x0, keycode 40 (keysym 0x64, d), same_screen YES,
XLookupString gives 1 bytes: (64) "d"
XmbLookupString gives 1 bytes: (64) "d"
XFilterEvent returns: False
KeyPress event, serial 30, synthetic NO, window 0x1e00001,
root 0x46, subw 0x0, time 8084608, (34,128), root:(1040,158),
state 0x0, keycode 39 (keysym 0x73, s), same_screen YES,
XLookupString gives 1 bytes: (73) "s"
XmbLookupString gives 1 bytes: (73) "s"
XFilterEvent returns: False
KeyRelease event, serial 30, synthetic NO, window 0x1e00001,
root 0x46, subw 0x0, time 8084842, (34,128), root:(1040,158),
state 0x0, keycode 38 (keysym 0x61, a), same_screen YES,
XLookupString gives 1 bytes: (61) "a"
KeyRelease event, serial 30, synthetic NO, window 0x1e00001,
root 0x46, subw 0x0, time 8084883, (34,128), root:(1040,158),
state 0x0, keycode 41 (keysym 0x66, f), same_screen YES,
XLookupString gives 1 bytes: (66) "f"
KeyRelease event, serial 30, synthetic NO, window 0x1e00001,
root 0x46, subw 0x0, time 8084926, (34,128), root:(1040,158),
state 0x0, keycode 39 (keysym 0x73, s), same_screen YES,
XLookupString gives 1 bytes: (73) "s"
KeyRelease event, serial 30, synthetic NO, window 0x1e00001,
root 0x46, subw 0x0, time 8084932, (34,128), root:(1040,158),
state 0x0, keycode 40 (keysym 0x64, d), same_screen YES,
XLookupString gives 1 bytes: (64) "d"
Note that all four key-down events appeared temporally close
together -- I don't know what the timestamp units are, but the
key down events all happend withing about 30 ticks of each
other. About 300 ticks later, the key-up events arrive, and
they're all within about 90 ticks of each other. Apparently
I'm a little sloppy on my simultaneous key releasing.
> but since the keyboard is not designed to do that with
> multiple non-modifier keys held,
The keyboard is designed to do that. It already does that.
> I'm just saying I don't know what its behavior will be.
I'm just saying I do know what it's behavior will be: every key
sends a key-down event when it's pressed, and a key-up event
when it's released.
>>> Doing everything in Emacs lisp is almost a solution, but I
>>> would prefer to have an OS driver.
>>
>> Though it's similar in some ways, an X11 driver isn't really an
>> OS driver. That means the place to ask about such a thing is
>> probably in an X.org development list http://www.x.org/.
>
> Oh.. okay. Thanks for the tip.
--
Grant Edwards grante Yow! -- I love KATRINKA
at because she drives a
visi.com PONTIAC. We're going
awaynow. I fed the cat.
- Next message: Kasper Dupont: "Re: Help writing device driver"
- Previous message: michaelmossey_at_yahoo.com: "Re: Help writing device driver"
- In reply to: michaelmossey_at_yahoo.com: "Re: Help writing device driver"
- Next in thread: Kasper Dupont: "Re: Help writing device driver"
- Reply: Kasper Dupont: "Re: Help writing device driver"
- Reply: michaelmossey_at_yahoo.com: "Re: Help writing device driver"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|