summaryrefslogtreecommitdiffhomepage
path: root/src/pty
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-07-12 05:00:26 -0400
committermidipix <writeonce@midipix.org>2016-07-21 03:47:27 -0400
commit4219632f84a58b413477e2d82b5768a42036d7cd (patch)
tree68523931dc04a06d28f99c519e6cb481903fe5e1 /src/pty
parent640ed378d69292813ed5bfa55a4139a1734ed787 (diff)
downloadptycon-4219632f84a58b413477e2d82b5768a42036d7cd.tar.bz2
ptycon-4219632f84a58b413477e2d82b5768a42036d7cd.tar.xz
pty layer: set hptm's mode to raw.
Diffstat (limited to 'src/pty')
-rw-r--r--src/pty/ptyc_pty_ctx.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/pty/ptyc_pty_ctx.c b/src/pty/ptyc_pty_ctx.c
index 0338574..19d586d 100644
--- a/src/pty/ptyc_pty_ctx.c
+++ b/src/pty/ptyc_pty_ctx.c
@@ -6,6 +6,7 @@
#include <psxtypes/psxtypes.h>
#include <ntapi/ntapi.h>
+#include <ntapi/nt_termios.h>
#include <ptycon/ptycon.h>
#include "ptycon_driver_impl.h"
#include "ptycon_ioctl_impl.h"
@@ -50,6 +51,67 @@ static int32_t ptyc_pts_open(struct ptyc_common_ctx * cctx)
&cctx->hpts);
}
+static int32_t ptyc_make_raw(nt_pty * hpty)
+{
+ int32_t status;
+ nt_iosb iosb;
+ nt_tty_sigctl_info ctlinfo;
+ struct tty_termios termios;
+
+ ntapi->tt_aligned_block_memset(
+ &ctlinfo,0,sizeof(ctlinfo));
+
+ if ((status = ntapi->pty_ioctl(
+ hpty,
+ 0,0,0,
+ &iosb,
+ TTY_TCGETS,
+ &ctlinfo,sizeof(ctlinfo),
+ &ctlinfo,sizeof(ctlinfo))))
+ return status;
+
+ ntapi->tt_generic_memcpy(
+ &termios,
+ &ctlinfo.terminfo,
+ sizeof(termios));
+
+ termios.c_oflag &= ~TTY_OPOST;
+
+ termios.c_cflag &= ~(TTY_CSIZE | TTY_PARENB);
+ termios.c_cflag |= TTY_CS8;
+
+ termios.c_lflag &= ~(TTY_ECHO
+ | TTY_ECHONL
+ | TTY_ICANON
+ | TTY_ISIG
+ | TTY_IEXTEN);
+
+ termios.c_iflag &= ~(TTY_IGNBRK
+ | TTY_BRKINT
+ | TTY_PARMRK
+ | TTY_ISTRIP
+ | TTY_INLCR
+ | TTY_IGNCR
+ | TTY_ICRNL
+ | TTY_IXON);
+
+ ntapi->tt_aligned_block_memset(
+ &ctlinfo,0,sizeof(ctlinfo));
+
+ ntapi->tt_generic_memcpy(
+ &ctlinfo.terminfo,
+ &termios,
+ sizeof(termios));
+
+ return ntapi->pty_ioctl(
+ hpty,
+ 0,0,0,
+ &iosb,
+ TTY_TCSETS,
+ &ctlinfo,sizeof(ctlinfo),
+ &ctlinfo,sizeof(ctlinfo));
+}
+
int ptyc_alloc_pty(struct ptyc_driver_ctx * dctx)
{
int32_t status;
@@ -69,6 +131,10 @@ int ptyc_alloc_pty(struct ptyc_driver_ctx * dctx)
return ptyc_set_status(
dctx,status);
+ if ((status = ptyc_make_raw(cctx->hptm)))
+ return ptyc_set_status(
+ dctx,status);
+
if (!dctx->units[0]
&& !(cctx->drvflags & PTYC_DRIVER_DBG_OVEN)
&& !(cctx->drvflags & PTYC_DRIVER_DBG_RAW))