diff --git a/.gitignore b/.gitignore index d183a413f..5bf6033a6 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,4 @@ build .ccls-cache compile_commands.json .aider* +.clang-format diff --git a/examples/gps/Kconfig b/examples/gps/Kconfig index c69d0549c..0d3ac3943 100644 --- a/examples/gps/Kconfig +++ b/examples/gps/Kconfig @@ -6,7 +6,7 @@ config EXAMPLES_GPS tristate "GPS example" default n - select GPSUTILS_MINMEA_LIB + depends on GNSSUTILS_MINMEA_LIB ---help--- Enable the gps test example diff --git a/examples/gps/gps_main.c b/examples/gps/gps_main.c index a79cd65c2..596efb5bd 100644 --- a/examples/gps/gps_main.c +++ b/examples/gps/gps_main.c @@ -54,13 +54,22 @@ int main(int argc, FAR char *argv[]) int cnt; char ch; char line[MINMEA_MAX_LENGTH]; + char *port = "/dev/ttyS1"; + + /* Get the GPS serial port argument. If none specified, default to ttyS1 */ + + if (argc > 1) + { + port = argv[1]; + } /* Open the GPS serial port */ - fd = open("/dev/ttyS1", O_RDONLY); + fd = open(port, O_RDONLY); if (fd < 0) { - printf("Unable to open file /dev/ttyS1\n"); + fprintf(stderr, "Unable to open file %s\n", port); + return 1; } /* Run forever */