Skip to content

Commit ece7b4f

Browse files
Old-DingRbb666
authored andcommitted
components: fix serial v2 rx indicate setup
1 parent 11d45f9 commit ece7b4f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

components/drivers/serial/dev_serial_v2.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,6 @@ static int serial_fops_open(struct dfs_file *fd)
8989
break;
9090
}
9191

92-
if ((fd->flags & O_ACCMODE) != O_WRONLY)
93-
rt_device_set_rx_indicate(device, serial_fops_rx_ind);
94-
9592
flags |= RT_SERIAL_RX_BLOCKING | RT_SERIAL_TX_BLOCKING;
9693

9794
/* preserve RT_DEVICE_FLAG_STREAM if it was set before close */
@@ -105,6 +102,9 @@ static int serial_fops_open(struct dfs_file *fd)
105102

106103
if (ret == RT_EOK)
107104
{
105+
if ((fd->flags & O_ACCMODE) != O_WRONLY)
106+
rt_device_set_rx_indicate(device, serial_fops_rx_ind);
107+
108108
serial = (struct rt_serial_device *)device;
109109
serial->is_posix_mode = RT_TRUE;
110110
}

0 commit comments

Comments
 (0)