[LEDE-DEV] [PATCH ugps 6/7] Show more useful error message if we can't open GPS device

Petr Štetiar ynezz at true.cz
Wed Jul 27 05:45:53 PDT 2016


Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
 nmea.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/nmea.c b/nmea.c
index 5a691b9..4d9cb90 100644
--- 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;
 	}
 
-- 
1.9.1




More information about the Lede-dev mailing list