]> rtime.felk.cvut.cz Git - eurobot/public.git/commitdiff
hokuyo: Show more information in error message
authorMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 9 Mar 2011 11:56:36 +0000 (12:56 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 9 Mar 2011 11:56:36 +0000 (12:56 +0100)
src/hokuyo/hokuyo.c

index 97864664938c1a974b61a853d829e29820e99cc3..8201a53f8efa63cac6729f866b3cdb131b57f8f6 100644 (file)
@@ -19,6 +19,9 @@
 #include <unistd.h>
 #include <time.h>
 #include <signal.h>
+#include <error.h>
+#include <errno.h>
+
 #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;
        }