Example #1
0
// Flush discards data received but not yet read (input queue), and/or
// data written but not yet transmitted (output queue), depending on
// the value of the qsel argument. Argument qsel must be one of the
// constants TCIFLUSH (flush input queue), TCOFLUSH (flush output
// queue), TCIOFLUSH (flush both queues). See also tcflush(3).
func Flush(fd int, qsel int) error {
	for {
		r, err := C.tcflush(C.int(fd), C.int(qsel))
		if r < 0 {
			// This is most-likely not possible, but
			// better be safe.
			if err == syscall.EINTR {
				continue
			}
			return err
		}
		return nil
	}
}
Example #2
0
// Discards data written to the port but not transmitted,
// or data received but not read
func (p *Port) Flush() error {
	_, err := C.tcflush(C.int(p.f.Fd()), C.TCIOFLUSH)
	return err
}
Example #3
0
func Flush(fd uintptr, queue int) (err error) {
	_, err = C.tcflush(C.int(fd), C.int(queue))
	return
}
Example #4
0
// FlushInput discards data written to a file descriptor but not read.
func FlushInput(fd int) error {
	_, err := C.tcflush((C.int)(fd), syscall.TCIFLUSH)
	return err
}
Example #5
0
// Sendbreak transmits a continuous stream of zero-valued
// bits for four-tenths of a second to the terminal referenced by fildes.
// The duration parameter is ignored in this implementation.
func Sendbreak(fd uintptr, duration int) error {
	//int	tcsendbreak(int, int);
	_, rv := C.tcflush(C.int(fd), C.int(duration))
	return rv

}
Example #6
0
// Flush discards any data written to the terminal referenced by fd
// which has not been transmitted to the terminal, or any data received
// from the terminal but not yet read, depending on the value of action.
func Flush(fd uintptr, queue_selector int) error {
	//int	tcflush(int, int);
	_, rv := C.tcflush(C.int(fd), C.int(queue_selector))
	return rv
}
Example #7
0
func (s *Serial) Flush() {
	if s.Opened {
		//		syscall.Syscall( syscall.SYS_IOCTL, uintptr(s.f.Fd()), uintptr(TCFLSH), uintptr(C.TCIOFLUSH) )
		C.tcflush(C.int(s.f.Fd()), C.TCIOFLUSH)
	}
}