cuart_[fsm]_test: Avoid hard-coded 'ttyUSB5'; use command line arg
Change-Id: I0b66ed7c037376e4a5a9283cb972012594bc35d2
diff --git a/ccid_host/cuart_fsm_test.c b/ccid_host/cuart_fsm_test.c
index 92f3437..1151b34 100644
--- a/ccid_host/cuart_fsm_test.c
+++ b/ccid_host/cuart_fsm_test.c
@@ -61,7 +61,14 @@
signal(SIGUSR1, &signal_handler);
- rc = card_uart_open(&g_cuart, "tty", "/dev/ttyUSB5");
+ if (argc < 2) {
+ fprintf(stderr, "You must specify the UART tty device as argument\n");
+ exit(2);
+ }
+
+ printf("Opening UART device %s\n", argv[1]);
+
+ rc = card_uart_open(&g_cuart, "tty", argv[1]);
if (rc < 0) {
perror("opening UART");
exit(1);
diff --git a/ccid_host/cuart_test.c b/ccid_host/cuart_test.c
index 0ed6614..e2b1ce2 100644
--- a/ccid_host/cuart_test.c
+++ b/ccid_host/cuart_test.c
@@ -58,8 +58,15 @@
uint8_t atr[64];
int rc;
+ if (argc < 2) {
+ fprintf(stderr, "You must specify the UART tty device as argument\n");
+ exit(2);
+ }
+
+ printf("Opening UART device %s\n", argv[1]);
+
g_cuart.handle_event = &handle_event;
- rc = card_uart_open(&g_cuart, "tty", "/dev/ttyUSB5");
+ rc = card_uart_open(&g_cuart, "tty", argv[1]);
if (rc < 0) {
perror("opening UART");
exit(1);