aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2016-12-16 15:50:14 +0100
committerHans Verkuil <hans.verkuil@cisco.com>2016-12-16 15:50:14 +0100
commit56306915ecc2ebb5c9ef976d4d61e39a5fe5a82d (patch)
tree3511fca76b9ba9a0382ffaca617bf258800bc0ad
parent5dc0466b93c8f6aa133641cb00fd32f48ae164be (diff)
cec-compliance: fix recognized/unrecognized_op logic
First of all cec_msg_status_is_abort() can't be used with CEC_RECEIVE, instead check if the opcode is FEATURE_ABORT. Secondly, don't assume that when a transmitted message times out, it is not recognized. The reality is that the remote CEC device might be slow or temporarily unresponsive (happens frequently when going in or out of standby). So only mark an op as (un)recoginized if it is unambiguous. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r--utils/cec-compliance/cec-compliance.cpp52
1 files changed, 21 insertions, 31 deletions
diff --git a/utils/cec-compliance/cec-compliance.cpp b/utils/cec-compliance/cec-compliance.cpp
index 6c1662ec..4556ce72 100644
--- a/utils/cec-compliance/cec-compliance.cpp
+++ b/utils/cec-compliance/cec-compliance.cpp
@@ -803,44 +803,34 @@ int cec_named_ioctl(struct node *node, const char *name,
app_result = -1;
if (!retval) {
- /* TODO: The logic here might need to be re-evaluated.
-
- Currently a message is registered as recognized if
- - We receive a reply that is not Feature Abort with
- [Unrecognized Opcode] or [Undetermined]
- - We did not receive a reply, but also did not
- expect one (other than Feature Abort)
- - We manually receive (CEC_RECEIVE) and get a Feature Abort
- with reason different than [Unrecognized Opcode] or
- [Undetermined] */
+ __u8 la = cec_msg_initiator(msg);
+
+ /*
+ * TODO: The logic here might need to be re-evaluated.
+ *
+ * Currently a message is registered as recognized if
+ * - We receive a reply that is not Feature Abort with
+ * [Unrecognized Opcode] or [Undetermined]
+ * - We manually receive (CEC_RECEIVE) and get a Feature Abort
+ * with reason different than [Unrecognized Opcode] or
+ * [Undetermined]
+ */
if (request == CEC_TRANSMIT && msg->timeout > 0 &&
cec_msg_initiator(msg) != CEC_LOG_ADDR_UNREGISTERED &&
cec_msg_destination(msg) != CEC_LOG_ADDR_BROADCAST &&
- (msg->tx_status & CEC_TX_STATUS_OK)) {
- if (msg->rx_status & CEC_RX_STATUS_OK) {
- __u8 la = cec_msg_initiator(msg);
-
- if (cec_msg_status_is_abort(msg) &&
- (abort_reason(msg) == CEC_OP_ABORT_UNRECOGNIZED_OP ||
- abort_reason(msg) == CEC_OP_ABORT_UNDETERMINED))
- node->remote[la].unrecognized_op[opcode] = true;
- else
- node->remote[la].recognized_op[opcode] = true;
- }
- else {
- __u8 la = cec_msg_destination(msg);
-
- if (msg->reply > 0)
- node->remote[la].unrecognized_op[opcode] = true;
- else
- node->remote[la].recognized_op[opcode] = true;
- }
+ (msg->tx_status & CEC_TX_STATUS_OK) &&
+ (msg->rx_status & CEC_RX_STATUS_OK)) {
+ if (cec_msg_status_is_abort(msg) &&
+ (abort_reason(msg) == CEC_OP_ABORT_UNRECOGNIZED_OP ||
+ abort_reason(msg) == CEC_OP_ABORT_UNDETERMINED))
+ node->remote[la].unrecognized_op[opcode] = true;
+ else
+ node->remote[la].recognized_op[opcode] = true;
}
if (request == CEC_RECEIVE &&
cec_msg_initiator(msg) != CEC_LOG_ADDR_UNREGISTERED &&
- cec_msg_status_is_abort(msg)) {
- __u8 la = cec_msg_initiator(msg);
+ cec_msg_opcode(msg) == CEC_MSG_FEATURE_ABORT) {
__u8 abort_msg = msg->msg[2];
if (abort_reason(msg) == CEC_OP_ABORT_UNRECOGNIZED_OP ||

Privacy Policy