aboutsummaryrefslogtreecommitdiffstats
path: root/utils/cec-compliance
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2018-10-08 10:48:58 +0200
committerHans Verkuil <hans.verkuil@cisco.com>2018-10-08 10:48:58 +0200
commita94b3b1d6ab7a67ac2496e0f99c26b097922948d (patch)
tree8d9f699a584e6c10e65b1a284616ce5362db8255 /utils/cec-compliance
parent3f1c6b85a1a35cb353818cd45acb01b8ff1c3b62 (diff)
cec-compliance: retry poll in case of Arbitration Lost
Polling for remote devices can fail due to an Arbitration Lost condition. Check for this and retry if that was the reason why the poll failed. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Diffstat (limited to 'utils/cec-compliance')
-rw-r--r--utils/cec-compliance/cec-compliance.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/utils/cec-compliance/cec-compliance.cpp b/utils/cec-compliance/cec-compliance.cpp
index ad81d80e..0d146b18 100644
--- a/utils/cec-compliance/cec-compliance.cpp
+++ b/utils/cec-compliance/cec-compliance.cpp
@@ -874,6 +874,8 @@ retry:
static int poll_remote_devs(struct node *node)
{
+ unsigned retries = 0;
+
node->remote_la_mask = 0;
if (!(node->caps & CEC_CAP_TRANSMIT))
return 0;
@@ -882,10 +884,21 @@ static int poll_remote_devs(struct node *node)
struct cec_msg msg;
cec_msg_init(&msg, node->log_addr[0], i);
-
fail_on_test(doioctl(node, CEC_TRANSMIT, &msg));
- if (msg.tx_status & CEC_TX_STATUS_OK)
+
+ if (msg.tx_status & CEC_TX_STATUS_OK) {
node->remote_la_mask |= 1 << i;
+ retries = 0;
+ } else if (msg.tx_status & CEC_TX_STATUS_NACK) {
+ retries = 0;
+ } else {
+ if (!(msg.tx_status & CEC_TX_STATUS_ARB_LOST))
+ warn("retry poll due to unexpected status: %s\n",
+ status2s(msg).c_str());
+ retries++;
+ fail_on_test(retries > 10);
+ i--;
+ }
}
return 0;
}

Privacy Policy