Harold, (are you still around?)

OK, I know it's been a while, but I think I might have figured it out;

If you look in Windows' Keyboard Control-Panel applet, you can set the
Repeat Delay and the Repeat Rate for the keyboard...

If on computerA you press a key and then let go of the key, that might
get sent in a stream to distant computerB as a keydown followed by a
keyup, but it is entirely possible that the two key messages might wind
up in two adjacent packets in the tcp stream. If the second packet is
lost for some reason, tcp will retransmit it, but not before a small
time interval passes. 

So on the computerB, the first fragment of the keyboard stream arrives
and is injected into the local keyboard input stream: keydown. Windows
starts a timer in case you hold the key down.

During this time, the next packet (the one with the keyup) in tcp's
sliding-window is lost, but it takes a while before one of the endpoints
detects this and the lost packet is retransmitted.

While we wait for the retransmission, the keydown timer that was started
on computerB goes off and Windows starts repeating the key at the rate
programmed in the control panel applet.

Eventually, tcp delivers the missing keyup to computerB, and Windows
kills the key-repeat timer which was injecting the 'stuck' key.

This seems to correspond to what I was experiencing.

For a system that is being operated remotely over a high-latency link
and is also under heavy CPU load, it is not hard to imagine this might
be what is happening.

So in the end, there is no bug in cygwin per-se, rather it is the
behaviour of Windows' own keyboard driver timer programming (and the way
netmeeting captures input) that was most likely causing the problem.

Before you ask: No, I have not been obsessing about this problem for
four years, I googled 'debouncing' for unrelated research and saw the
original discussion thread for this problem, re-read it and suddenly it
seemed like I saw a possible answer.

Sort of funny, really.


From: Harold L Hunt II <huntharo at msu dot edu>
  * To: cygwin-xfree at cygwin dot com
  * Date: Tue, 04 Mar 2003 17:55:59 -0500
>Heh... yes, I am sure that we will eventually understand this bug, but
I >spent long enough in the debugger on this one that I don't ever want
to >look at it again :)

Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/

Reply via email to