summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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))