diff --git a/include/tui.h b/include/tui.h index 2f2473f..457fb9f 100644 --- a/include/tui.h +++ b/include/tui.h @@ -8,6 +8,6 @@ #define MIN_X_TERMINAL_SIZE 80 #define MIN_Y_TERMINAL_SIZE 30 -char * uartDialog(int terminal_x, int terminal_y); +void uartDialog(char *uart_adress, int terminal_x, int terminal_y); #endif \ No newline at end of file diff --git a/output/main b/output/main index 6666d1a..8a6e964 100755 Binary files a/output/main and b/output/main differ diff --git a/src/main.c b/src/main.c index 247003a..116373f 100644 --- a/src/main.c +++ b/src/main.c @@ -5,13 +5,11 @@ #include #include #include -#include +#include #include "users.h" #include "tui.h" - - void *uartListener(void *arg) { @@ -21,7 +19,7 @@ void *uartListener(void *arg) int main(int argc, char const *argv[]) { int y_max, x_max; - char * uart_address; + char uart_address[51]; pthread_t uart_thread; initscr(); @@ -42,7 +40,7 @@ int main(int argc, char const *argv[]) erase(); refresh(); - uartDialog(x_max, y_max); + uartDialog(uart_address, x_max, y_max); pthread_create(&uart_thread, NULL, uartListener, NULL); diff --git a/src/tui.c b/src/tui.c index bb0e25b..ee257ba 100644 --- a/src/tui.c +++ b/src/tui.c @@ -3,7 +3,7 @@ #include #include -char *uartDialog(int terminal_x, int terminal_y) +void uartDialog(char *uart_adress, int terminal_x, int terminal_y) { char *prompt = "Please enter UART device address for RFID reader (probably /dev/ttyUSB0): "; char *header = "Enter UART Address"; @@ -85,7 +85,8 @@ char *uartDialog(int terminal_x, int terminal_y) refresh(); delwin(uartwin); refresh(); - return input; + strcpy(uart_adress, input); + break; } } }