aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2020-03-16 13:24:30 +0100
committerHans Verkuil <hans.verkuil@cisco.com>2020-03-16 13:24:30 +0100
commit0b239af2ca93726b63dfa9c64a8622644f898a25 (patch)
treed89f4c168a47bf4b846afb4d363b3e85033baa48
parent2157de9b324a82e3e252ebbc65aa123679b42e58 (diff)
cec-ctl: handle ENONET errors
If a cec ioctl returns ENONET (i.e. the CEC adapter is in the process of configuring itself), then wait 1 second and retry. This error was seen during a stress test run, but it is really not an error the first time you see this. If it happens again after a second then something is wrong and it is OK to return an error. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r--utils/cec-ctl/cec-ctl.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index bc05d5af..714a80b3 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -407,6 +407,18 @@ int cec_named_ioctl(int fd, const char *name,
if (options[OptTrace])
printf("\t\t%s returned %d (%s)\n",
name, retval, strerror(e));
+ if (retval == -1 && e == ENONET) {
+ /*
+ * The adapter is configuring itself,
+ * so wait a little bit and retry.
+ */
+ sleep(1);
+ retval = ioctl(fd, request, parm);
+ e = retval == 0 ? 0 : errno;
+ if (options[OptTrace])
+ printf("\t\t%s (repeat) returned %d (%s)\n",
+ name, retval, strerror(e));
+ }
return retval == -1 ? e : (retval ? -1 : 0);
}

Privacy Policy