aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Fjeldtvedt <jaffe1@gmail.com>2016-07-21 15:50:44 +0200
committerHans Verkuil <hans.verkuil@cisco.com>2016-07-21 16:15:06 +0200
commit3ba08fd00d4343b49788772bf324b09ce7badbea (patch)
treeadf2522845cd730118d2c34d8128eb03093edc6a
parent978de9b4067057fa7fe1d492d762317d854deee6 (diff)
cec-follower: warn when aborted message is re-sent too quickly
If a feature aborted message (with reason other than Unrecognized opcode), the initiator is recommended to wait at least 200 ms before retrying. We print a warning once if this happens. Signed-off-by: Johan Fjeldtvedt <jaffe1@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r--utils/cec-follower/cec-follower.h1
-rw-r--r--utils/cec-follower/cec-processing.cpp14
2 files changed, 15 insertions, 0 deletions
diff --git a/utils/cec-follower/cec-follower.h b/utils/cec-follower/cec-follower.h
index de081a2f..4fb37148 100644
--- a/utils/cec-follower/cec-follower.h
+++ b/utils/cec-follower/cec-follower.h
@@ -74,6 +74,7 @@ struct la_info {
__u64 ts;
struct {
unsigned count;
+ __u64 ts;
} feature_aborted[256];
};
diff --git a/utils/cec-follower/cec-processing.cpp b/utils/cec-follower/cec-processing.cpp
index e7e64693..5d6c6d35 100644
--- a/utils/cec-follower/cec-processing.cpp
+++ b/utils/cec-follower/cec-processing.cpp
@@ -202,6 +202,7 @@ static void reply_feature_abort(struct node *node, struct cec_msg *msg, __u8 rea
{
unsigned la = cec_msg_initiator(msg);
__u8 opcode = cec_msg_opcode(msg);
+ __u64 ts_now = get_ts();
if (reason == CEC_OP_ABORT_UNRECOGNIZED_OP) {
la_info[la].feature_aborted[opcode].count++;
@@ -213,6 +214,12 @@ static void reply_feature_abort(struct node *node, struct cec_msg *msg, __u8 rea
warn("Feature Abort [Unrecognized Opcode] to the same message.\n");
}
}
+ else if (la_info[la].feature_aborted[opcode].count) {
+ warn("Replying Feature Abort with abort reason different than [Unrecognized Opcode]\n");
+ warn("to message that has previously been replied Feature Abort to with [Unrecognized Opcode].\n");
+ }
+ else
+ la_info[la].feature_aborted[opcode].ts = ts_now;
cec_msg_reply_feature_abort(msg, reason);
transmit(node, msg);
@@ -743,7 +750,14 @@ void testProcessing(struct node *node)
__u8 from = cec_msg_initiator(&msg);
__u8 to = cec_msg_destination(&msg);
+ __u8 opcode = cec_msg_opcode(&msg);
+ if (la_info[from].feature_aborted[opcode].ts &&
+ ts_to_ms(get_ts() - la_info[from].feature_aborted[opcode].ts) < 200) {
+ warn("Received message %x from LA %d (%s) less than 200 ms after replying\n",
+ opcode, from, la2s(from));
+ warn("Feature Abort (not [Unrecognized Opcode]) to the same message.\n");
+ }
if (from != CEC_LOG_ADDR_UNREGISTERED && !la_info[from].ts)
dev_info("Logical address %d (%s) discovered.\n", from, la2s(from));
if (show_msgs) {

Privacy Policy