Enhance UART handling and improve TUI input management
This commit is contained in:
+13
-2
@@ -12,7 +12,15 @@
|
||||
|
||||
void *uartListener(void *arg)
|
||||
{
|
||||
|
||||
char *uart_address = (char *)arg;
|
||||
int uart = open(uart_address, O_RDWR | O_NOCTTY | O_NDELAY);
|
||||
if (uart == -1)
|
||||
{
|
||||
perror("Failed to open UART");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
close(uart);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -27,12 +35,15 @@ int main(int argc, char const *argv[])
|
||||
getmaxyx(stdscr, y_max, x_max);
|
||||
if (x_max <= MIN_X_TERMINAL_SIZE || y_max <= MIN_Y_TERMINAL_SIZE)
|
||||
{
|
||||
endwin();
|
||||
clear();
|
||||
puts("Terminal is too small. Exiting...\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
noecho();
|
||||
noraw();
|
||||
cbreak();
|
||||
start_color();
|
||||
curs_set(0);
|
||||
|
||||
@@ -42,7 +53,7 @@ int main(int argc, char const *argv[])
|
||||
|
||||
uartDialog(uart_address, x_max, y_max);
|
||||
|
||||
pthread_create(&uart_thread, NULL, uartListener, NULL);
|
||||
pthread_create(&uart_thread, NULL, uartListener, uart_address);
|
||||
|
||||
//
|
||||
|
||||
|
||||
Reference in New Issue
Block a user