Add usage message for UART address in main function

This commit is contained in:
2025-04-20 21:02:49 +02:00
parent f44bd795d5
commit 4ff9a7f03d
2 changed files with 11 additions and 3 deletions
BIN
View File
Binary file not shown.
+11 -3
View File
@@ -6,6 +6,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include <termios.h> #include <termios.h>
#include <string.h>
#include "users.h" #include "users.h"
#include "tui.h" #include "tui.h"
@@ -19,13 +20,19 @@ void *uartListener(void *arg)
perror("Failed to open UART"); perror("Failed to open UART");
return NULL; return NULL;
} }
close(uart); close(uart);
return NULL; return NULL;
} }
int main(int argc, char const *argv[]) int main(int argc, char const **argv)
{ {
if (argc != 1)
{
printf("Usage: %s <Address of RFID reader>\n", argv[0]);
return EXIT_FAILURE;
}
int y_max, x_max; int y_max, x_max;
char uart_address[51]; char uart_address[51];
pthread_t uart_thread; pthread_t uart_thread;
@@ -51,7 +58,8 @@ int main(int argc, char const *argv[])
erase(); erase();
refresh(); refresh();
uartDialog(uart_address, x_max, y_max); // uartDialog(uart_address, x_max, y_max);
strcpy(uart_address, argv[1]);
pthread_create(&uart_thread, NULL, uartListener, uart_address); pthread_create(&uart_thread, NULL, uartListener, uart_address);