File tree 1 file changed +8
-10
lines changed
components/drivers/serial 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -1110,29 +1110,27 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
1110
1110
}
1111
1111
else
1112
1112
{
1113
+ _termio_to_termios (args , & tmp );
1113
1114
tio = & tmp ;
1114
1115
}
1115
1116
1116
1117
if (tio == RT_NULL ) return - RT_EINVAL ;
1117
1118
1118
- tio -> c_iflag = 0 ;
1119
- tio -> c_oflag = 0 ;
1120
- tio -> c_lflag = 0 ;
1121
-
1122
1119
/* update oflag for console device */
1123
1120
if (rt_console_get_device () == dev )
1124
- tio -> c_oflag = OPOST | ONLCR ;
1121
+ tio -> c_oflag |= (OPOST | ONLCR );
1122
+
1123
+ tio -> c_cflag &= ~(CSIZE | CSTOPB | PARODD | PARENB );
1125
1124
1126
1125
/* set cflag */
1127
- tio -> c_cflag = 0 ;
1128
1126
if (serial -> config .data_bits == DATA_BITS_5 )
1129
- tio -> c_cflag = CS5 ;
1127
+ tio -> c_cflag | = CS5 ;
1130
1128
else if (serial -> config .data_bits == DATA_BITS_6 )
1131
- tio -> c_cflag = CS6 ;
1129
+ tio -> c_cflag | = CS6 ;
1132
1130
else if (serial -> config .data_bits == DATA_BITS_7 )
1133
- tio -> c_cflag = CS7 ;
1131
+ tio -> c_cflag | = CS7 ;
1134
1132
else if (serial -> config .data_bits == DATA_BITS_8 )
1135
- tio -> c_cflag = CS8 ;
1133
+ tio -> c_cflag | = CS8 ;
1136
1134
1137
1135
if (serial -> config .stop_bits == STOP_BITS_2 )
1138
1136
tio -> c_cflag |= CSTOPB ;
You can’t perform that action at this time.
0 commit comments