Author: wmb Date: 2007-09-29 21:12:46 +0200 (Sat, 29 Sep 2007) New Revision: 645
Modified: cpu/x86/pc/olpc/linuxserial.fth Log: linuxserial.fth - don't reopen serial device if it is already open.
Modified: cpu/x86/pc/olpc/linuxserial.fth =================================================================== --- cpu/x86/pc/olpc/linuxserial.fth 2007-09-28 01:18:30 UTC (rev 644) +++ cpu/x86/pc/olpc/linuxserial.fth 2007-09-29 19:12:46 UTC (rev 645) @@ -32,6 +32,7 @@ ;
: $open-serial ( dev$ -- ) \ e.g. " /dev/ttyS0" + serial-fd -1 <> if 2drop then $cstr 0 2 rot 8 syscall 3drop retval to serial-fd serial-fd 0< abort" Can't open serial device" raw 8n1 blocking @@ -46,7 +47,7 @@ line-name place ;
-: open-serial ( "devname" -- ) +: open-serial ( -- ) line-name c@ if line-name count else " /dev/ttyS0" then $open-serial ;