summaryrefslogtreecommitdiffhomepage
path: root/src/pty
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-07-13 04:10:43 -0400
committermidipix <writeonce@midipix.org>2016-07-21 03:47:27 -0400
commite4a3350202070c1ac22008cc14c71bd5654115fc (patch)
treec4be182e78fefab1b2c73c6a24260783a74158db /src/pty
parente21cdc9b96c16e48cee9aecc9d38a319c03b557f (diff)
downloadptycon-e4a3350202070c1ac22008cc14c71bd5654115fc.tar.bz2
ptycon-e4a3350202070c1ac22008cc14c71bd5654115fc.tar.xz
pty layer: ptyc_make_oven(): implementation and integration.
Diffstat (limited to 'src/pty')
-rw-r--r--src/pty/ptyc_pty_ctx.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/pty/ptyc_pty_ctx.c b/src/pty/ptyc_pty_ctx.c
index 19d586d..f903523 100644
--- a/src/pty/ptyc_pty_ctx.c
+++ b/src/pty/ptyc_pty_ctx.c
@@ -112,6 +112,67 @@ static int32_t ptyc_make_raw(nt_pty * hpty)
&ctlinfo,sizeof(ctlinfo));
}
+static int32_t ptyc_make_oven(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_cflag = TTY_CBAUD | TTY_CREAD | TTY_CS8 | TTY_HUPCL;
+ termios.c_iflag = TTY_ICRNL | TTY_BRKINT | TTY_IXON;
+ termios.c_lflag = TTY_ECHO
+ | TTY_ECHOCTL
+ | TTY_ECHOE
+ | TTY_ECHOK
+ | TTY_ECHOKE
+ | TTY_ICANON
+ | TTY_ISIG
+ | TTY_IEXTEN;
+
+ termios.c_oflag = TTY_OPOST
+ | TTY_ONLCR
+ | TTY_TAB0
+ | TTY_VT0
+ | TTY_BS0
+ | TTY_CR0
+ | TTY_FF0
+ | TTY_NL0;
+
+ 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;
@@ -145,6 +206,16 @@ int ptyc_alloc_pty(struct ptyc_driver_ctx * dctx)
return ptyc_set_status(
dctx,status);
+ if (cctx->drvflags & PTYC_DRIVER_DBG_RAW)
+ if ((status = ptyc_make_raw(cctx->hpts)))
+ return ptyc_set_status(
+ dctx,status);
+
+ if (cctx->drvflags & PTYC_DRIVER_DBG_OVEN)
+ if ((status = ptyc_make_oven(cctx->hpts)))
+ return ptyc_set_status(
+ dctx,status);
+
return ptyc_set_status(
dctx,NT_STATUS_SUCCESS);
}