Ejemplo n.º 1
0
// GetOSpeed returns the output (transmitter) baudrate in Termios
// structure t as a numerical (integer) value in
// bits-per-second. Returns err == syscal.EINVAL if the baudrate in t
// cannot be decoded. See also getospeed(3).
func (t *Termios) GetOSpeed() (speed int, err error) {
	code := C.cfgetospeed(&t.t)
	speed, ok := stdSpeeds.Speed(spdCode(code))
	if !ok {
		return 0, syscall.EINVAL
	}
	return speed, nil
}
Ejemplo n.º 2
0
// Getospeed returns the output baud rate in the Termios
// structure referenced by src.
func Getospeed(src *Termios) (result C.speed_t) {
	result = C.cfgetospeed(&src.i)
	return
}
Ejemplo n.º 3
0
// Cfgetospeed returns the output baud rate stored in the termios structure.
func Cfgetospeed(attr *syscall.Termios) uint32 {
	solTermios := (*unix.Termios)(attr)
	return uint32(C.cfgetospeed((*C.termios_t)(unsafe.Pointer(solTermios))))
}