summaryrefslogtreecommitdiff
path: root/components/drivers/tty/pty.c
diff options
context:
space:
mode:
authorMan, Jianting (Meco) <[email protected]>2023-02-25 13:52:37 -0500
committerGitHub <[email protected]>2023-02-25 13:52:37 -0500
commit1acef4277b02e5084310ecd7028656ae535178f5 (patch)
tree03b6b6f0b3df75a1cef301e1e7b2b3d234213390 /components/drivers/tty/pty.c
parent759192f5f5af23ae360818483d35974ef5b91c78 (diff)
parente63e33a3c64327aef3556fa811df0a8ec1e0e7ee (diff)
Merge pull request #6981 from RT-Thread/masterserialX-dev
sync from master
Diffstat (limited to 'components/drivers/tty/pty.c')
-rw-r--r--components/drivers/tty/pty.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/components/drivers/tty/pty.c b/components/drivers/tty/pty.c
index 46a241a715..64e3a41df1 100644
--- a/components/drivers/tty/pty.c
+++ b/components/drivers/tty/pty.c
@@ -211,6 +211,12 @@ static int ptmx_open(struct dfs_fd *fd)
ret = ld->ops->open(fd);
}
+ rt_device_t device = (rt_device_t)fd->vnode->data;
+ if(fd->vnode->ref_count == 1)
+ {
+ ret = rt_device_open(device, fd->flags);
+ }
+
return ret;
}
#ifdef RT_USING_DEVICE_OPS
@@ -286,7 +292,8 @@ static int pts_register(struct tty_struct *ptm_drv, struct tty_struct *pts_drv,
extern struct termios tty_std_termios;
pts_drv->init_termios = tty_std_termios;
pts_drv->init_termios.c_cflag = B38400 | CS8 | CREAD;
- pts_drv->init_termios.c_lflag |= ICANON;
+ pts_drv->init_termios.c_lflag |= ECHO | ICANON;
+ pts_drv->init_termios.c_oflag |= ONLCR;
pts_drv->init_termios.__c_ispeed = 38400;
pts_drv->init_termios.__c_ospeed = 38400;