I believe I've identified a bug in the pen driver; with rapid tapping, the
events for earlier taps show up with the pen coordinates of later taps.

I've been working on the new version of Fitaly.  One of it's new features is
that putting the stylus down on a key and sliding it off the key capitalizes
that letter.  Saves hitting the shift key beforehand - it's quite nice and liked
by the users.

We've been plagued by a problem - now and then keys will be spuriously
capitalized.  Mostly it's been noticed at the end of a line, as Memopad
word-wraps for example.

During debugging, I discovered that we're actually getting events showing
*future* tap positions!   Since I don't think we've invented a time machine
(reminiscent of Jame's Hogan's "Thrice Upon a Time") I'm assuming that the
pen-up/down structures are corrupted *after* they're already enqueued.

Originally I was expecting a reentrancy-type problem, and that the pen events
were arriving out of chronological sequence.  This doesn't appear to be the
case; I get correct sequences of pen-down followed by pen-up.  It's just that
the pen-up position is wrong - and usually matches a pen-down or pen-up from a
later pen-tap.

I've verified the same behavior in other programs - in Dinkypad, if I tap slowly
("normally") then I'll get the expected dot at the tap point.   If I tap
rapidly, I'll get a line between the two - as if I'd put the pen down in the
first spot, slid it to the other, and lifted up.  Assumption:  the penUp event
of the first tap contains the position of the second tap point.

This is similar to what happens if you touch two spots simultaneously - for
example, using Dinkypad again, touch a pen down in one spot and *leave* it down.
Then touch a second spot.  You'll see a line drawn part-way between them.  When
you pick up the first pen, the line will be completed from that mid-way point to
the second pen.

To verify this is *not* what I'm inadvertantly doing, I built a mechanical jig
to do pen-taps in two different spots.  Basically, it's just a see-saw with a
pen at each "seat" and a frame to hold it over the Palm device.  By tipping it
back-and-forth I can simulate rapid pen-taps, and it *guarantees* that I'm not
touching both spots at the same time - one pen goes down and it *has* to lift
before the other pen goes down.  So I'm assured that I should be seeing
pen-down/pen-up/other-pen-down/other-pen-up.

Using this jig, it's easy to make rapid pen-taps, and indeed, Dinkypad *does*
draw a line between the points instead of showing dots at the taps.


I've logged a series of penDown and penUp events with the associated
coordinates.

These are printed (dumped to the serial port) at the point that Fitaly calls
EvtGetEvent.

The test I used was to zig-zag across the top two Fitaly rows - the keys are
arranged in a pattern:
        Z  V  C  H  W  K
        F  I  T  A  L  Y

I tried to tap as quickly as I could, going Z F V I C T...

Here's the results of the logs:


Read 'em this way:

d = down event, followed by coordinates from the event structure
'x' = character 'x' entered as a "keystroke"
u = up event, followed by coordinates from the event structure
* = capitalized letter (and will be followed by the letter, as 'X')

Here's one that worked fine - useful to see the typical normal coordinates...

d  30,  5 'z' u  29,  5
d  28, 15 'f' u  28, 15
d  42,  4 'v' u  42,  4
d  42, 21 'i' u  42, 21
d  56,  4 'c' u  56,  4
d  57, 19 't' u  57, 19
d  71,  2 'h' u  71,  2
d  69, 20 'a' u  69, 20
d  84,  4 'w' u  84,  4
d  83, 23 'l' u  83, 23
d  96,  4 'k' u  96,  4
d  99, 20 'y' u  99, 20


Now a failure...   You can see the "W" up-tap was at the *down* coordinate for
the NEXT character - ok, so maybe I did slide the pen; we'll excuse it this
time.   But the 'L' is *definitely* wrong - I know I didn't slide that far...
Now how did the pen-up positions for L and K both match Y's...

d  29,  6 'z' u  29,  6
d  31, 20 'f' u  31, 20
d  43,  7 'v' u  43,  7
d  40, 20 'i' u  40, 20
d  54,  7 'c' u  54,  7
d  55, 15 't' u  55, 18
d  70,  7 'h' u  70,  7
d  69, 19 'a' u  69, 19
d  81,  3 'w' u  83, 22* 'W'
d  83, 22 'l' u  98, 17* 'L'
d  94,  7 'k' u  98, 17* 'K'
d  98, 17 'y' u  98, 17


d  31,  6 'z' u  31,  6
d  27, 20 'f' u  28, 20
d  41,  3 'v' u  41,  3
d  40, 19 'i' u  40, 19
d  56,  4 'c' u  56,  4
d  56, 20 't' u  56, 20
d  66,  4 'h' u  66,  4
d  72, 20 'a' u  72, 20
d  83,  4 'w' u  83,  4
d  88, 20 'y' u  88, 20
d 101,  2 'k' u 101,  2
d  99, 18 'y' u  99, 18


Again, the pen-up coordinate is erroneously the pen-up for the following key.

d  29,  5 'z' u  29,  5
d  26, 23 'f' u  28, 21
d  44,  5 'v' u  44,  5
d  43, 17 'i' u  42, 20
d  59,  6 'c' u  59,  6
d  56, 19 't' u  57, 20
d  70,  4 'h' u  72, 19* 'H'
d  72, 17 'a' u  72, 19
d  84,  6 'w' u  84,  6
d  82, 19 'l' u  82, 19
d  98,  2 'k' u  98,  2
d  98, 14 'y' u  98, 14


d  28,  7 'z' u  28,  7
d  25, 23 'f' u  25, 23
d  38,  9 'v' u  38,  9
d  38, 21 'i' u  38, 21
d  57,  6 'c' u  57,  6
d  57, 23 't' u  57, 23
d  69,  4 'h' u  69,  4
d  68, 21 'a' u  68, 21
d  79,  3 'w' u  79,  3
d  81, 19 'l' u  81, 19
d  95,  6 'k' u  95,  6
d 101, 21 'y' u 101, 21


Here, the 'H' pen-up matches the 'A' pen-down.  But the 'A' pen-up is totally
wrong, and doesn't match any of the following keys!  And then the W L and K
pen-ups match the up and down for the Y

d  28,  5 'z' u  28,  5
d  27, 21 'f' u  27, 23
d  40,  8 'v' u  40,  8
d  40, 18 'i' u  40, 18
d  56,  6 'c' u  56,  6
d  55, 20 't' u  55, 20
d  71,  6 'h' u  68, 21* 'H'
d  68, 21 'a' u  96,  9* 'A'
d  83,  6 'w' u  97, 13* 'W'
d  82, 19 'l' u  97, 13* 'L'
d  94,  7 'k' u  97, 13
d  97, 13 'y' u  97, 13


Yet more weirdnesses...  pen-up A matches pen down L, but the pen-up for the
intervening W along with the L and K match the up/down for the Y

d  26,  6 'z' u  26,  6
d  25, 25 'f' u  26, 22
d  42,  6 'v' u  42,  6
d  43, 20 'i' u  43, 20
d  57,  7 'c' u  57,  7
d  59, 20 't' u  59, 20
d  69,  8 'h' u  71, 21* 'H'
d  71, 21 'a' u  84, 20* 'A'
d  80,  8 'w' u  99, 14* 'W'
d  84, 20 'l' u  99, 14* 'L'
d  97,  3 'k' u  99, 14* 'K'
d  99, 14 'y' u  99, 14


And several examples with a whole slew of wrong values...

d  30,  4 'z' u  30,  4
d  28, 18 'f' u  27, 20
d  39,  4 'v' u  39, 21* 'V'
d  39, 21 'i' u  57, 21* 'I'
d  57,  3 'c' u  72,  3* 'C'
d  57, 21 't' u  72, 21* 'T'
d  72,  3 'h' u  84, 20* 'H'
d  72, 21 'a' u  97, 18* 'A'
d  84,  4 'w' u  97, 18* 'W'
d  84, 20 'l' u  97, 18* 'L'
d  96,  5 'k' u  97, 18* 'K'
d  97, 18 'y' u  97, 18


d  29,  7 'z' u  29, 19* 'Z'
d  29, 19 'f' u  43, 18* 'F'
d  43,  3 'v' u  52, 19* 'V'
d  43, 18 'i' u  68,  5* 'I'
d  54,  0 'c' u  70, 17* 'C'
d  52, 19 't' u  81, 20* 'T'
d  69,  5 'h' u  98, 17* 'H'
d  70, 17 'a' u  98, 17* 'A'
d  78,  6 'w' u  98, 17* 'W'
d  81, 20 'l' u  98, 17* 'L'
d  96,  6 'k' u  98, 17* 'K'
d  98, 17 'y' u  98, 17


d  28,  6 'z' u  28, 20* 'Z'
d  28, 20 'f' u  37, 23* 'F'
d  38,  9 'v' u  57, 22* 'V'
d  37, 23 'i' u  78,  6* 'I'
d  54,  8 'c' u  84, 19* 'C'
d  57, 22 't' u  98, 17* 'T'
d  66,  4 'h' u  98, 17* 'H'
d  69, 20 'a' u  98, 17* 'A'
d  78,  6 'w' u  98, 17* 'W'
d  84, 19 'l' u  98, 17* 'L'
d  98,  1 'k' u  98, 17* 'K'
d  98, 17 'y' u  98, 17


d  30,  5 'z' u  30,  5
d  29, 22 'f' u  29, 22
d  41,  5 'v' u  41,  5
d  42, 21 'i' u  42, 21
d  53,  3 'c' u  53,  3
d  54, 21 't' u  54, 21
d  68,  4 'h' u  68,  4
d  70, 19 'a' u  70, 19
d  81,  2 'w' u  81,  2
d  82, 20 'l' u  82, 20
d  93,  6 'k' u  93,  6
d  96, 20 'y' u  96, 20


d  28,  5 'z' u  28, 21* 'Z'
d  28, 21 'f' u  40, 18* 'F'
d  39,  3 'v' u  55, 21* 'V'
d  40, 18 'i' u  81,  5* 'I'
d  54,  1 'c' u  93,  5* 'C'
d  55, 21 't' u  97, 21* 'T'
d  68,  2 'h' u  97, 21* 'H'
d  68, 17 'a' u  97, 21* 'A'
d  81,  5 'w' u  97, 21* 'W'
d  81, 21 'l' u  97, 21* 'L'
d  93,  5 'k' u  97, 21* 'K'
d  97, 21 'y' u  97, 21



And just to show it occurs in other sequences too...

d  55,  7 'c' u  65,  6* 'C'
d  65,  6 'h' u  68, 15* 'H'
d  54, 18 't' u  73, 32* 'T'
d  68, 15 'a' u  73, 32* 'A'
d  59, 33 'n' u  73, 32* 'N'
d  73, 32 'e' u  73, 32


d  69, 53 'm' u  69, 53
d  68, 47 'r' u  68, 47
d  66, 29 'e' u  66, 29
d  69, 13 'a' u  69, 13
d  70,  7 'h' u  70,  7


d  66, 57 'm' u  66, 57
d  67, 43 'r' u  67, 43
d  69, 31 'e' u  69, 31
d  68, 15 'a' u  68, 15
d  69,  6 'h' u  69,  6


d  70, 59 'm' u  69, 44* 'M'
d  69, 44 'r' u  68, 18* 'R'
d  69, 30 'e' u  68,  5* 'E'
d  68, 18 'a' u  68,  5* 'A'
d  68,  5 'h' u  68,  5


d  67, 56 'm' u  67, 43* 'M'
d  67, 43 'r' u  65, 19* 'R'
d  66, 31 'e' u  63,  1* 'E'
d  65, 19 'a' u  63,  1* 'A'
d  63,  2 'h' u  63,  1




I tried capturing the pen events prior to their being enqueued, but wasn't
successful.  It appears that the OS doesn't go through the traps to enqueue them
(which does make sense, but right now I wish it did...  :)
(I wanted to see if they had the same coordinates at enqueue time as when I get
them via EvtGetEvent...)

I've got a minor suspicion that something is taking time and triggering this
problem; normally Fitaly's response is quite fast (the key highlights on
pen-down and unhighlights on pen-up) and when the corrupted events occur I'll
see a slowed-down response.  It's slight; it may be me just fooling myself...

Anyone have any ideas on this?

Can someone at Palm take a look and see if they can confirm this behavior, and
possibly just maybe perhaps identify a pen driver bug?

And even better, give me a way to work around this?

- Al -

-- 
--  Alan Weiner  --  [EMAIL PROTECTED]  --  http://www.ajw.com


Reply via email to