Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion components/drivers/serial/dev_serial_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,17 @@ static int serial_fops_open(struct dfs_file *fd)
if ((fd->flags & O_ACCMODE) != O_WRONLY)
rt_device_set_rx_indicate(device, serial_fops_rx_ind);

flags |= RT_SERIAL_RX_BLOCKING | RT_SERIAL_TX_BLOCKING;

/* preserve RT_DEVICE_FLAG_STREAM if it was set before close */
if (device->open_flag & RT_DEVICE_FLAG_STREAM)
{
flags |= RT_DEVICE_FLAG_STREAM;
}

rt_device_close(device);
ret = rt_device_open(device, flags | RT_SERIAL_RX_BLOCKING | RT_SERIAL_TX_BLOCKING);
ret = rt_device_open(device, flags);

if (ret == RT_EOK)
{
serial = (struct rt_serial_device *)device;
Expand Down
Loading