aboutsummaryrefslogtreecommitdiffstats
path: root/utils/cec-compliance/cec-compliance.h
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2017-08-08 13:54:19 +0200
committerHans Verkuil <hans.verkuil@cisco.com>2017-08-08 15:42:23 +0200
commit9cda1128fff2cd50999fe7eeffbfc446cccfa477 (patch)
tree680e48524590d6fe6c728649b6f063993970bca8 /utils/cec-compliance/cec-compliance.h
parent82df1903d21bdf08a1ad5e0ab6cc6fa0c9190007 (diff)
cec-compliance: try to reconnect if the HPD is gone
The transmit_timeout() function will fail if the HPD is gone. This can happen when the remote TV switches inputs or goes into standby/wakes up. Some TVs also pull the HPD low when in standby, even though CEC still works. In that case you need to send an Image View On message. Modify the transmit_timeout() so that it waits for 3 seconds for the HPD to reappear. If it doesn't, then it sends an Image View On message and again waits for the HPD. If neither works, only then does it fail. 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.h57
1 files changed, 2 insertions, 55 deletions
diff --git a/utils/cec-compliance/cec-compliance.h b/utils/cec-compliance/cec-compliance.h
index d0494192..8eb6873c 100644
--- a/utils/cec-compliance/cec-compliance.h
+++ b/utils/cec-compliance/cec-compliance.h
@@ -343,61 +343,8 @@ static inline unsigned response_time_ms(const struct cec_msg *msg)
return 0;
}
-static inline bool transmit_timeout(struct node *node, struct cec_msg *msg,
- unsigned timeout = 2000)
-{
- struct cec_msg original_msg = *msg;
- __u8 opcode = cec_msg_opcode(msg);
- int res;
-
- msg->timeout = timeout;
- 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))
- && response_time_ms(msg) > reply_threshold)
- warn("Waited %4ums for reply to msg 0x%02x.\n", response_time_ms(msg), opcode);
-
- if (!cec_msg_status_is_abort(msg))
- return true;
-
- if (cec_msg_is_broadcast(&original_msg)) {
- fail("Received Feature Abort in reply to broadcast message\n");
- return false;
- }
-
- const char *reason;
-
- switch (abort_reason(msg)) {
- case CEC_OP_ABORT_UNRECOGNIZED_OP:
- case CEC_OP_ABORT_UNDETERMINED:
- return true;
- case CEC_OP_ABORT_INVALID_OP:
- reason = "Invalid operand";
- break;
- case CEC_OP_ABORT_NO_SOURCE:
- reason = "Cannot provide source";
- break;
- case CEC_OP_ABORT_REFUSED:
- reason = "Refused";
- break;
- case CEC_OP_ABORT_INCORRECT_MODE:
- reason = "Incorrect mode";
- break;
- default:
- reason = "Unknown";
- break;
- }
- info("Opcode %s was replied to with Feature Abort [%s]\n",
- opcode2s(&original_msg).c_str(), reason);
-
- return true;
-}
+bool transmit_timeout(struct node *node, struct cec_msg *msg,
+ unsigned timeout = 2000);
static inline bool transmit(struct node *node, struct cec_msg *msg)
{

Privacy Policy