Show more useful error message if we can't open GPS device
[project/ugps.git] / nmea.c
diff --git a/nmea.c b/nmea.c
index 5a691b9..4d9cb90 100644 (file)
--- a/nmea.c
+++ b/nmea.c
@@ -30,6 +30,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
+#include <errno.h>
 
 #include <string.h>
 #include <termios.h>
@@ -314,7 +315,7 @@ nmea_open(char *dev, struct ustream_fd *s, speed_t speed)
 
        tty = open(dev, O_RDWR | O_NOCTTY | O_NONBLOCK);
        if (tty < 0) {
-               ERROR("%s: device open failed\n", dev);
+               ERROR("%s: device open failed: %s\n", dev, strerror(errno));
                return -1;
        }