FUNCTION: void cfmakeraw ( termios* t )
FUNCTION: int cfsetspeed ( termios* t, speed_t s )
+! See /usr/include/bits/termios.h
CONSTANT: TCSANOW 0
CONSTANT: TCSADRAIN 1
CONSTANT: TCSAFLUSH 2
! lflags
CONSTANT: ISIG 0o0000001
CONSTANT: ICANON 0o0000002
-CONSTANT: XCASE 0o0000004
+CONSTANT: XCASE 0o0000004
CONSTANT: ECHO 0o0000010
CONSTANT: ECHOE 0o0000020
CONSTANT: ECHOK 0o0000040
CONSTANT: PENDIN 0o0040000
CONSTANT: IEXTEN 0o0100000
+! c_cc characters
+CONSTANT: VINTR 0
+CONSTANT: VQUIT 1
+CONSTANT: VERASE 2
+CONSTANT: VKILL 3
+CONSTANT: VEOF 4
+CONSTANT: VTIME 5
+CONSTANT: VMIN 6
+CONSTANT: VSWTC 7
+CONSTANT: VSTART 8
+CONSTANT: VSTOP 9
+CONSTANT: VSUSP 10
+CONSTANT: VEOL 11
+CONSTANT: VREPRINT 12
+CONSTANT: VDISCARD 13
+CONSTANT: VWERASE 14
+CONSTANT: VLNEXT 15
+CONSTANT: VEOL2 16
+
M: linux lookup-baud ( n -- n )
H{
{ 0 0o0000000 }
: serial-fd ( serial -- fd )
stream>> in>> handle>> fd>> ;
+: get-fd-termios ( fd -- serial )
+ termios <struct> [ tcgetattr io-error ] keep ;
+
: set-termios ( serial -- )
- [
- serial-fd
- termios <struct> [ tcgetattr io-error ] keep
- ] keep termios<< ;
+ [ serial-fd get-fd-termios ] keep termios<< ;
: configure-termios ( serial -- )
dup termios>>