aboutsummaryrefslogtreecommitdiffstats
path: root/utils/cec-compliance/cec-compliance.h
diff options
context:
space:
mode:
authorJohan Fjeldtvedt <jaffe1@gmail.com>2016-08-24 12:51:03 +0200
committerHans Verkuil <hans.verkuil@cisco.com>2016-10-10 09:24:43 +0200
commit20779622cabe7a1201f0debf735b37357ba0e6f9 (patch)
tree59a22fa745b48ebf7b468dd6e8668bc7a7a51b95 /utils/cec-compliance/cec-compliance.h
parent19d1f44e738db7162200c7632a070e5a00ea4070 (diff)
cec tools: exit if device is disconnected
If the CEC device is disconnected, ioctl will return ENODEV. This is checked for in cec-ctl (when monitoring), cec-follower and cec-compliance, to make these exit when the CEC device disappears. Signed-off-by: Johan Fjeldtvedt <jaffe1@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Diffstat (limited to 'utils/cec-compliance/cec-compliance.h')
-rw-r--r--utils/cec-compliance/cec-compliance.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/utils/cec-compliance/cec-compliance.h b/utils/cec-compliance/cec-compliance.h
index cb236fdc..d59ec1db 100644
--- a/utils/cec-compliance/cec-compliance.h
+++ b/utils/cec-compliance/cec-compliance.h
@@ -334,10 +334,15 @@ static inline bool transmit_timeout(struct node *node, struct cec_msg *msg,
unsigned timeout = 2000)
{
struct cec_msg original_msg = *msg;
+ int res;
msg->timeout = timeout;
- if (doioctl(node, CEC_TRANSMIT, msg) ||
- !(msg->tx_status & CEC_TX_STATUS_OK))
+ res = doioctl(node, CEC_TRANSMIT, msg);
+ if (res == ENODEV) {
+ printf("Device was disconnected.\n");
+ exit(1);
+ }
+ if (res || !(msg->tx_status & CEC_TX_STATUS_OK))
return false;
if (((msg->rx_status & CEC_RX_STATUS_OK) || (msg->rx_status & CEC_RX_STATUS_FEATURE_ABORT))

Privacy Policy