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

Re: Multiple Keypress/release problems.



On Sun, Dec 30, 2001 at 01:40:51PM -0600, Steve Baker wrote:
> 
> I've been writing a simple split-screen two/three/four player game where each
> player uses a few of the keys on the keyboard to control a character in the game.
> I was checking key presses and releases to allow multiple keys to be held down
> at one time.
> 
> I find that the program doesn't see certain keys when certain combinations
> of others are depressed.  I've been using GLUT but I don't think this is
> GLUT-related because I can reproduce the problem in a simple X-term window.
> 
> You can try this right now in any text window:
> 
>     Press and hold 'a' and 'w' and then tap the 's' key repeatedly.
>     You'll notice that the 's' key doesn't produce an echo - neither
>    does the 'q' key.  Most other keys work just fine - only 'q' and
>    's' are blocked?!?
> 
> You can easily find other combinations that don't work.
> 
> Is this a Linux keyboard driver thing - or an X-windows issue or just a
> hardware limitation of the PC keyboard?  I've tried this both on my no-name
> ergonomic keyboard and on my laptop's keyboard - the effect is the same on
> each of them.
> 
> I've tried doing things like turning off the key-autorepeat - no effect.
> 
> So, my questions:
> 
> * Is there a software fix for this?
> 
> * Does anyone know the rules that determine which keys will work with which
>   key combinations?  Maybe I can work around it by picking just the right
>   set of keys.

This sort of thing always used to be a problem on 8-bit machines,
where the keyboard was matrix scanned - three keys forming an L in the
matrix would cause the fourth to complete the square to appear pressed
the whole time.

It's possible this is a similar effect caused by the way that keyboard
scans the keys. Have you tried some different keyboards to see if you
get different combinations of key fails?

I wouldn't imagine it would be a linux driver issue, the protocol is
fairly simple for the keyboard comms - it's a simple serial-like thing
IIRC. I wouldn't imagine it being an X11 thing either.



As a rule, on the 8bits, it always used to be keys nearby each other -
hence using things like the cursor keys for one player and Q,A,N,M for
the other to spread them out, so as long as the keys are reasonably
seperated, you ought to be OK.