|
|
@@ -18,9 +18,7 @@
|
|
|
|
|
|
#include "uart.h"
|
|
|
#include <stdio.h>
|
|
|
-#include <stdlib.h>
|
|
|
#include <errno.h>
|
|
|
-#include <string.h>
|
|
|
#include <fcntl.h>
|
|
|
#include <unistd.h>
|
|
|
|
|
|
@@ -256,14 +254,13 @@ int uart_handle_open(uart_handle_st* handle)
|
|
|
}
|
|
|
else {
|
|
|
options.c_cc[VMIN] = 0; // 非阻塞读
|
|
|
- options.c_cc[VTIME] = 1; // 读等待0.1秒
|
|
|
+ options.c_cc[VTIME] = 0; // 读等待 VTIME * 0.1 秒
|
|
|
}
|
|
|
|
|
|
// 关闭特殊字符处理和输出处理
|
|
|
- // ISIG 禁用信号 (如 Ctrl+C 发送 SIGINT、Ctrl+Z 发送 SIGTSTP)。
|
|
|
options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
|
|
|
- options.c_lflag &= ~(ICANON | ECHO | ECHOE);
|
|
|
options.c_oflag &= ~OPOST;
|
|
|
+ options.c_iflag &= ~(INLCR | IGNCR | ICRNL);
|
|
|
|
|
|
// 应用配置
|
|
|
if (tcsetattr(fd, TCSANOW, &options) != 0)
|