unsigned TTYPort::GetBaudrate() const { struct termios attr; if (tcgetattr(fd, &attr) < 0) return 0; return speed_t_to_baud_rate(cfgetispeed(&attr)); }
unsigned TTYPort::GetBaudrate() const { assert(tty.IsDefined()); struct termios attr; if (!tty.GetAttr(attr)) return 0; return speed_t_to_baud_rate(cfgetispeed(&attr)); }