| 1396 | ~PtyClient() { closeDevice(); } |
| 1397 | |
| 1398 | bool openDevice(const QString& path) |
| 1399 | { |
| 1400 | m_fd = ::open(path.toLocal8Bit().constData(), O_RDWR | O_NOCTTY | O_NONBLOCK); |
| 1401 | if (m_fd < 0) return false; |
| 1402 | struct termios tio; |
| 1403 | if (::tcgetattr(m_fd, &tio) == 0) { |
| 1404 | ::cfmakeraw(&tio); |
| 1405 | tio.c_cc[VMIN] = 0; |
| 1406 | tio.c_cc[VTIME] = 0; |
| 1407 | ::tcsetattr(m_fd, TCSANOW, &tio); |
| 1408 | } |
| 1409 | return true; |
| 1410 | } |
| 1411 | |
| 1412 | void closeDevice() { if (m_fd >= 0) { ::close(m_fd); m_fd = -1; } m_buf.clear(); } |
| 1413 |