Skip to content

Commit b04da91

Browse files
polarvidmessigogogo
authored andcommitted
[smart/tty] skip configure of rt_serial on tty open (RT-Thread#9152)
Skip configure on open since all configs are copied from the current configuration on device. So we don't bother to set it back to device again. Changes: - test and skip configuration on open() of tty device Signed-off-by: Shell <smokewood@qq.com>
1 parent 52fd48f commit b04da91

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

components/drivers/serial/serial_tty.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,16 @@ static int serial_tty_param(struct lwp_tty *tp, struct termios *t)
298298
RT_ASSERT(softc);
299299
serial = softc->parent;
300300

301+
if (!tty_opened(tp))
302+
{
303+
/**
304+
* skip configure on open since all configs are copied from the current
305+
* configuration on device. So we don't bother to set it back to device
306+
* again.
307+
*/
308+
return RT_EOK;
309+
}
310+
301311
cfsetispeed(t, t->__c_ispeed);
302312
return rt_device_control(&(serial->parent), TCSETS, t);
303313
}

0 commit comments

Comments
 (0)