io.serial.linux: some useful extra termios constants

db4
Björn Lindqvist 2015-10-06 14:00:19 +02:00
parent 97de22755c
commit 8762d1c593
2 changed files with 25 additions and 5 deletions

View File

@ -33,6 +33,7 @@ FUNCTION: int tcsendbreak ( int i1, int i2 )
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
@ -110,7 +111,7 @@ CONSTANT: CRTSCTS 0o020000000000
! lflags
CONSTANT: ISIG 0o0000001
CONSTANT: ICANON 0o0000002
CONSTANT: XCASE 0o0000004
CONSTANT: XCASE 0o0000004
CONSTANT: ECHO 0o0000010
CONSTANT: ECHOE 0o0000020
CONSTANT: ECHOK 0o0000040
@ -124,6 +125,25 @@ CONSTANT: FLUSHO 0o0010000
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 }

View File

@ -22,11 +22,11 @@ IN: io.serial.linux
: 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>>