Documentation ¶
Index ¶
- Constants
- Variables
- func Drain(fd uintptr) error
- func Flow(fd uintptr, action int) error
- func Flush(fd uintptr, queue Queue) error
- func GetWinSize(fd uintptr) (width int, height int, err error)
- func SendBreak(fd uintptr, duration int) error
- func SetWinSize(fd uintptr, width, height int) error
- type Queue
- type Termios
- func (tio *Termios) DrainAndSetAttr(fd uintptr) error
- func (tio *Termios) FlushAndSetAttr(fd uintptr) error
- func (tio *Termios) GetSpeed() (in int, out int)
- func (tio *Termios) MakeRaw() *Termios
- func (tio *Termios) SetAttr(fd uintptr) error
- func (tio *Termios) SetLock(fd uintptr) error
- func (tio *Termios) SetSpeed(_ int, speed int) error
Constants ¶
const ( // linux-specific c_cflag bits: CBAUD = uint32(unix.CBAUD) CBAUDEX = uint32(unix.CBAUDEX) )
Linux-specific bit meanings, from bits/termios.h
const ( // taken from bits/termios.h TCOOFF = 0 TCOON = 1 TCIOFF = 2 TCION = 3 )
Apparently missing from sys/unix
Variables ¶
var ( ErrNotImplemented = errors.New("not implemented") ErrInvalidAction = errors.New("invalid action") )
Functions ¶
func Drain ¶
Drain waits until all output written to the terminal referenced by fd has been transmitted to the terminal.
func Flow ¶
Flow manages the suspending of data transmission or reception on the terminal referenced by fd. The value of action must be one of the following:
TCOOFF Suspend output. TCOON Restart suspended output. TCIOFF Transmit a STOP character (the XOFF in XON/XOFF) TCION Transmit a START character (the XON).
func Flush ¶
Flush discards data written to the terminal but not transmitted, or received from the terminal but not read, depending on the queue.
InputQueue received but not read. OutputQueue written but not transmitted. AnyQueue both
func GetWinSize ¶
GetWinSize gets the current size of the terminal referred to by fd.
func SendBreak ¶
SendBreak transmits a continuous stream of zeros for between 0.25 and 0.5 seconds if duration is 0, or for the given number of deciseconds if not, if the terminal supports breaks.
Note this is TCSBRKP in tty_ioctl(4); this one seems saner than TCSBRK/tcsendbreak(3).
func SetWinSize ¶
SetWinSize sets the size of the terminal referred to by fd.
Types ¶
type Termios ¶
func GetLock ¶
GetLock gets the locking status of the termios structure of the given terminal. See tty_ioctl(4).
func (*Termios) DrainAndSetAttr ¶
DrainAndSetAttr sets the attributes of the given terminal from this termios structure, after all output written to fd has been transmitted. This option should be used when changing parameters that affect output. See tcsetattr(3).
func (*Termios) FlushAndSetAttr ¶
FlushAndSetAttr sets the attributes of the given terminal from this termios structure, “after all output written to fd has been transmitted, and all input that has been received but not read will be discarded before the change is made”. See tcsetattr(3).
func (*Termios) GetSpeed ¶
GetSpeed gets the stored baud rate.
NOTE linux doesn't support different speeds for in and out; everything is outSpeed
func (*Termios) MakeRaw ¶
MakeRaw returns a copy of the termios structure with the flags set to a state disabling all input and output processing, giving a “raw I/O path”. See cfmakeraw(3). Note the exact flags are platform-dependent.
Note also this does *not* apply it to a terminal; for that call one of the SetAttr methods on the returned struct.
func (*Termios) SetAttr ¶
SetAttr sets the attributes of the given terminal from this termios structure, immediately. See tcsetattr(3).