Author: wmb Date: 2009-09-10 10:40:07 +0200 (Thu, 10 Sep 2009) New Revision: 1358
Modified: dev/ps2mouse.fth Log: ps2mouse driver - last version's timeout was too long, also fixed a problem with the open-count logic.
Modified: dev/ps2mouse.fth =================================================================== --- dev/ps2mouse.fth 2009-09-10 08:21:31 UTC (rev 1357) +++ dev/ps2mouse.fth 2009-09-10 08:40:07 UTC (rev 1358) @@ -38,17 +38,15 @@
0 instance variable #retries : cmd? ( cmd -- error? ) - #retries off dup put-get-data ( cmd response ) begin ( cmd response ) case ( cmd response ) h# fa of drop false exit endof \ ACK h# fe of ( cmd ) \ RESEND - try again - 1 #retries +! ( cmd ) - #retries @ d# 300 > if ( cmd ) + -1 #retries +! ( cmd ) + #retries @ 0< if ( cmd ) drop true exit then ( cmd ) - 1 ms ( cmd ) dup put-get-data ( cmd response ) endof ( cmd response ) @@ -59,7 +57,7 @@ endcase ( cmd new-response ) again ; -: cmd ( cmd -- ) cmd? drop ; +: cmd ( cmd -- ) d# 20 #retries ! cmd? drop ;
\ : cmd ( cmd -- ) " put-get-data" $call-parent ?ack ;
@@ -292,6 +290,7 @@
: identify ( -- true | char false ) \ h# f2 ['] read1 catch dup if nip then + 3 #retries ! h# f2 cmd? if true exit then apex-timeout timed-read ; @@ -328,22 +327,21 @@ : open ( -- flag ) 1 set-port
- open-count 1+ to open-count + open-count 0<> if true exit then
- open-count 1 <> if true exit then - \ The "force" argument causes the open to succeed even if no mouse \ is present - my-args [char] , left-parse-string 2swap 2drop " force" $= if - true exit - then + my-args [char] , left-parse-string 2swap 2drop " force" $= 0= if
- find-mouse if false exit then + find-mouse if false exit then
- \ Reset the mouse and check the response codes - h# ff read2 0<> swap h# aa <> or if false exit then + \ Reset the mouse and check the response codes + h# ff read2 0<> swap h# aa <> or if false exit then
- remote-mode + remote-mode + then + + open-count 1+ to open-count true ; : close ( -- )