Ignore NXIO error otherwise this causes spam if network is empty or refclk not
authorGavin Lambert <gavinl@compacsort.com>
Tue, 14 Apr 2015 09:33:24 -0400
changeset 2618 3affe9cd0b66
parent 2617 559f2f9c5b08
child 2619 f2bc4000e47a
Ignore NXIO error otherwise this causes spam if network is empty or refclk not
selected yet, and syncing refclk time to master.
lib/master.c
--- a/lib/master.c	Sat May 31 15:37:33 2014 +1200
+++ b/lib/master.c	Tue Apr 14 09:33:24 2015 -0400
@@ -715,11 +715,16 @@
 
     ret = ioctl(master->fd, EC_IOCTL_REF_CLOCK_TIME, time);
     if (EC_IOCTL_IS_ERROR(ret)) {
-        fprintf(stderr, "Failed to get reference clock time: %s\n",
-                strerror(EC_IOCTL_ERRNO(ret)));
-    }
-
-    return ret;
+        ret = EC_IOCTL_ERRNO(ret);
+        if (ret != EIO && ret != ENXIO) {
+            // do not log if no refclk or no refclk time yet
+            fprintf(stderr, "Failed to get reference clock time: %s\n",
+                    strerror(ret));
+        }
+        return -ret;
+    }
+
+    return 0;
 }
 
 /****************************************************************************/