From e4a3350202070c1ac22008cc14c71bd5654115fc Mon Sep 17 00:00:00 2001 From: midipix Date: Wed, 13 Jul 2016 04:10:43 -0400 Subject: pty layer: ptyc_make_oven(): implementation and integration. --- src/pty/ptyc_pty_ctx.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) (limited to 'src') 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); } -- cgit v1.2.3