xuqiang 10 hónapja
szülő
commit
453433db9f
1 módosított fájl, 2 hozzáadás és 5 törlés
  1. 2 5
      src/uart.c

+ 2 - 5
src/uart.c

@@ -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)