diff options
| author | xqyjlj <[email protected]> | 2023-02-25 15:33:28 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-02-25 15:33:28 +0800 |
| commit | e50a7e3f854f9618e444e0be5020cc4c4d40e978 (patch) | |
| tree | 0f7b6dcca22c35549defaad5899b4b496c7e620f /components/drivers | |
| parent | 7763183074f2e4fe1720ab92450fde64a9205f18 (diff) | |
🐞 fix(components/drivers/tty/pty.c): fix ptmx not init (#6970)
* 🐞 fix(components/drivers/tty/tty.c): fix wrong log format
* 🐞 fix(components/drivers/tty/pty.c): fix ptmx not init
* ✨ feat(components/drivers/tty/pty.c): pts default use ECHO, ONLCR
* 🌈 style(components/drivers/tty/tty.c): format
Diffstat (limited to 'components/drivers')
| -rw-r--r-- | components/drivers/tty/pty.c | 9 | ||||
| -rw-r--r-- | components/drivers/tty/tty.c | 6 |
2 files changed, 11 insertions, 4 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; diff --git a/components/drivers/tty/tty.c b/components/drivers/tty/tty.c index 2a9380f55a..933d5f028b 100644 --- a/components/drivers/tty/tty.c +++ b/components/drivers/tty/tty.c @@ -200,7 +200,7 @@ int __tty_check_change(struct tty_struct *tty, int sig) if (!tty_pgrp) { - LOG_D(tty, "sig=%d, tty->pgrp == -1!\n", sig); + LOG_D("sig=%d, tty->pgrp == -1!\n", sig); } return ret; } @@ -275,7 +275,7 @@ static int tiocsctty(struct tty_struct *tty, int arg) if (current->leader && (current->session == tty->session)) { - return 0; + return 0; } /* @@ -284,7 +284,7 @@ static int tiocsctty(struct tty_struct *tty, int arg) */ if (!current->leader || current->tty) { - return -EPERM; + return -EPERM; } if (tty->session > 0) |
