| 2107 | ~PtyClient() { if (m_fd >= 0) ::close(m_fd); } |
| 2108 | |
| 2109 | bool openDevice(const QString& path) |
| 2110 | { |
| 2111 | errno = 0; |
| 2112 | m_fd = ::open(path.toLocal8Bit().constData(), O_RDWR | O_NOCTTY | O_NONBLOCK); |
| 2113 | if (m_fd < 0) return false; |
| 2114 | struct termios tio; |
| 2115 | if (::tcgetattr(m_fd, &tio) == 0) { |
| 2116 | ::cfmakeraw(&tio); |
| 2117 | tio.c_cc[VMIN] = 0; |
| 2118 | tio.c_cc[VTIME] = 0; |
| 2119 | ::tcsetattr(m_fd, TCSANOW, &tio); |
| 2120 | } |
| 2121 | return true; |
| 2122 | } |
| 2123 | |
| 2124 | void send(const QString& cmd) |
| 2125 | { |