Skip to content

Commit d0f6066

Browse files
committed
simple_uart_term: describe things during listing
1 parent 8fc987c commit d0f6066

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

simple_uart_term.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <fcntl.h>
22
#include <stdio.h>
33
#include <stdlib.h>
4+
#include <string.h>
45
#include <sys/select.h>
56
#include <termios.h>
67
#include <unistd.h>
@@ -27,9 +28,13 @@ int main(int argc, char *argv[])
2728
case 'l': {
2829
char **names;
2930
ssize_t nuarts = simple_uart_list(&names);
31+
char description[256] = {0};
3032
printf("Found %zd ports\n", nuarts);
3133
for (ssize_t i = 0; i < nuarts; i++) {
32-
printf("Port %zd: %s\n", i, names[i]);
34+
printf("Port %zd: %s", i, names[i]);
35+
if (simple_uart_describe(names[i], description, sizeof(description)) == 0 && strlen(description) > 0)
36+
printf(" Description: %s", description);
37+
printf("\n");
3338
}
3439

3540
for (ssize_t i = 0; i < nuarts; i++) {

0 commit comments

Comments
 (0)