From 1fbdfce088a8d6489dbe862ff6d38d00aac5fe3f Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Wed, 9 Mar 2011 12:56:36 +0100 Subject: [PATCH] hokuyo: Show more information in error message --- src/hokuyo/hokuyo.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hokuyo/hokuyo.c b/src/hokuyo/hokuyo.c index 97864664..8201a53f 100644 --- a/src/hokuyo/hokuyo.c +++ b/src/hokuyo/hokuyo.c @@ -19,6 +19,9 @@ #include #include #include +#include +#include + #define HOKUYO_DEVICE "/dev/ttyACM0" // /dev/ttyACM0 #define COMPILE_TIME_ASSERT(cond, msg) \ @@ -39,7 +42,8 @@ int hokuyo_init(char *device) int ret; ret = urg_connect(&urg, device, 115200); if (ret < 0) { - fprintf(stderr, "hokuyo: urg_connect(%s) failed!\n", device); + error(0, errno, "hokuyo: urg_connect(%s) failed: %s errno", + device, urg_error(&urg)); urg_disconnect(&urg); return -1; } -- 2.39.2