[openfirmware] [commit] r2316 - dev/olpc/keyboard
repository service
svn at openfirmware.info
Tue Jun 28 18:57:22 CEST 2011
Author: wmb
Date: Tue Jun 28 18:57:21 2011
New Revision: 2316
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2316
Log:
OLPC keyboard selftest - poll the keyboard rapidly, but the ec-spi game keys only once every 20 ms. This solves the problem with EC starvation without causing loss of keyboard events. Tested on XO-1.5 and XO-1.75.
Modified:
dev/olpc/keyboard/selftest.fth
Modified: dev/olpc/keyboard/selftest.fth
==============================================================================
--- dev/olpc/keyboard/selftest.fth Tue Jun 28 00:27:51 2011 (r2315)
+++ dev/olpc/keyboard/selftest.fth Tue Jun 28 18:57:21 2011 (r2316)
@@ -617,6 +617,16 @@
then ( scancode )
;
+0 value button-poll-time
+: okay-to-poll? ( -- flag )
+ button-poll-time 0= get-msecs button-poll-time - 0>= or if
+ get-msecs d# 20 + to button-poll-time
+ true
+ else
+ false
+ then
+;
+
\ Returns the next button-related scancode byte.
: button-event? ( -- false | scancode true )
\ Handle the suffix of an e0-scancode sequence
@@ -625,14 +635,16 @@
exit ( -- scancode true )
then ( )
- \ If the pending-buttons change mask is 0, we don't have anymore
+ \ If the pending-buttons change mask is 0, we don't have any more
\ events to generate from the last time around, so reread the
\ game buttons and set pending-buttons to the ones that have
\ changed.
pending-buttons 0= if
- game-key@ ( new-buttons )
- dup last-buttons xor to pending-buttons ( new-buttons )
- to last-buttons ( )
+ okay-to-poll? if
+ game-key@ ( new-buttons )
+ dup last-buttons xor to pending-buttons ( new-buttons )
+ to last-buttons ( )
+ then
then
\ If there are bits set in pending-buttons, generate an event from
@@ -685,7 +697,6 @@
get-msecs last-timestamp - d# 10,000 >=
then
then ( exit? )
- d# 20 ms
until
begin get-data? while drop repeat
;
More information about the openfirmware
mailing list