diff options
author | Kris Moore <kris@pcbsd.org> | 2016-03-10 07:43:07 -0500 |
---|---|---|
committer | Kris Moore <kris@pcbsd.org> | 2016-03-10 07:43:07 -0500 |
commit | e9b51aab0100ba3d916a3fffaf650317f99657fd (patch) | |
tree | 6aa80cd321fcebb435589f09b9d8c25bb2e7eb22 /desktop-utilities/lumina-terminal | |
parent | Now we can successfully read from the pty, needs cleanup on how we display (diff) | |
download | lumina-e9b51aab0100ba3d916a3fffaf650317f99657fd.tar.gz lumina-e9b51aab0100ba3d916a3fffaf650317f99657fd.tar.bz2 lumina-e9b51aab0100ba3d916a3fffaf650317f99657fd.zip |
Now we can send input back to the TTY
Diffstat (limited to 'desktop-utilities/lumina-terminal')
-rw-r--r-- | desktop-utilities/lumina-terminal/TerminalWidget.cpp | 3 | ||||
-rw-r--r-- | desktop-utilities/lumina-terminal/TtyProcess.cpp | 6 | ||||
-rw-r--r-- | desktop-utilities/lumina-terminal/TtyProcess.h | 2 |
3 files changed, 9 insertions, 2 deletions
diff --git a/desktop-utilities/lumina-terminal/TerminalWidget.cpp b/desktop-utilities/lumina-terminal/TerminalWidget.cpp index d9e6c3f7..939b9711 100644 --- a/desktop-utilities/lumina-terminal/TerminalWidget.cpp +++ b/desktop-utilities/lumina-terminal/TerminalWidget.cpp @@ -61,7 +61,6 @@ void TerminalWidget::UpdateText(){ qDebug() << "Reading all data"; char buffer[64]; ssize_t rtot = read(sn->socket(),&buffer,64); - qDebug()<<(quint8)buffer[0]<<(quint8)buffer[1]<<(quint8)buffer[2]<<(quint8)buffer[3]; buffer[rtot]='\0'; qDebug() << "Process Data:" << QString(buffer); this->insertPlainText(QString(buffer)); @@ -96,7 +95,7 @@ void TerminalWidget::keyPressEvent(QKeyEvent *ev){ } QByteArray ba; ba.append(txt); //avoid any byte conversions qDebug() << "Forward Input:" << txt << ev->key(); - PROC->write(ba); + PROC->writeTTY(ba); } void TerminalWidget::mousePressEvent(QMouseEvent *ev){ diff --git a/desktop-utilities/lumina-terminal/TtyProcess.cpp b/desktop-utilities/lumina-terminal/TtyProcess.cpp index bafdb0ef..e0375410 100644 --- a/desktop-utilities/lumina-terminal/TtyProcess.cpp +++ b/desktop-utilities/lumina-terminal/TtyProcess.cpp @@ -46,12 +46,18 @@ bool TTYProcess::startTTY(int &retfd, QString prog, QStringList args){ childProc = tmp; this->setFileName( ptsname(FD) ); retfd = FD; + ttyfd = FD; qDebug() << " - PTY:" << ptsname(FD); return this->open(QIODevice::ReadWrite | QIODevice::Unbuffered); //return true; } } +void TTYProcess::writeTTY(QByteArray output){ + int written = ::write(ttyfd, output.data(), output.size()); + qDebug() << "Wrote:" << written; +} + // === PRIVATE === pid_t TTYProcess::LaunchProcess(int& fd, char *prog, char **child_args){ //Returns: -1 for errors, positive value (file descriptor) for the master side of the TTY to watch diff --git a/desktop-utilities/lumina-terminal/TtyProcess.h b/desktop-utilities/lumina-terminal/TtyProcess.h index 4631b922..38cca5a4 100644 --- a/desktop-utilities/lumina-terminal/TtyProcess.h +++ b/desktop-utilities/lumina-terminal/TtyProcess.h @@ -32,9 +32,11 @@ public: ~TTYProcess(); bool startTTY(int &retfd, QString prog, QStringList args = QStringList()); + void writeTTY(QByteArray output); private: pid_t childProc; + int ttyfd; //==================================== // C Library function for setting up the PTY |