Show more useful error message if we can't open GPS device
authorPetr Štetiar <ynezz@true.cz>
Wed, 27 Jul 2016 12:45:53 +0000 (14:45 +0200)
committerJohn Crispin <john@phrozen.org>
Sun, 24 Jul 2016 04:13:03 +0000 (06:13 +0200)
Signed-off-by: Petr Štetiar <ynezz@true.cz>
nmea.c

diff --git a/nmea.c b/nmea.c
index 5a691b92b669f48751da85d1e343babd76afd480..4d9cb902eae294db159cadba59bb26d67be2f8b7 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;
        }