Make pty work
This commit is contained in:
parent
e164538b09
commit
f151ca6c1a
2
Makefile
2
Makefile
|
@ -3,7 +3,7 @@
|
|||
CC = cc
|
||||
CXX = c++
|
||||
CFLAGS = -g -O3 -Wall -std=c++0x -pthread
|
||||
LIBS = -lpthread
|
||||
LIBS = -lpthread -lutil
|
||||
LDFLAGS = -g
|
||||
|
||||
OBJECTS = AX25Control.o AX25Network.o \
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <termios.h>
|
||||
#include <pty.h>
|
||||
|
||||
|
||||
CPseudoTTYController::CPseudoTTYController(const std::string& device, unsigned int speed, bool assertRTS) :
|
||||
|
@ -48,9 +49,11 @@ bool CPseudoTTYController::open()
|
|||
{
|
||||
assert(m_fd == -1);
|
||||
|
||||
m_fd = ::posix_openpt(O_RDWR | O_NOCTTY | O_NDELAY);
|
||||
if (m_fd < 0) {
|
||||
LogError("Cannot open device - %s", m_device.c_str());
|
||||
int slavefd;
|
||||
char buf[300];
|
||||
int result = ::openpty(&m_fd, &slavefd, buf, NULL,NULL);
|
||||
if (result < 0) {
|
||||
LogError("Cannot open device - %s - Errno : %d", m_device.c_str(), errno);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue