From: Michal Sojka Date: Wed, 9 Mar 2011 11:56:36 +0000 (+0100) Subject: hokuyo: Show more information in error message X-Git-Url: http://rtime.felk.cvut.cz/gitweb/eurobot/public.git/commitdiff_plain/1fbdfce088a8d6489dbe862ff6d38d00aac5fe3f hokuyo: Show more information in error message --- 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; }