aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeborah Brouwer <deborahbrouwer3563@gmail.com>2021-04-21 20:27:54 -0700
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2021-04-22 08:54:13 +0200
commit1ab369e80c6c313c15218f0b55174a81a8a82d19 (patch)
tree2d4d2ed2c4a75d2388a62454bc8ba07bb9246300
parent82a21f594712395d46145fb3ccc397047f74c99e (diff)
cec: add invalid operand test for Audio Rate Control messages
Add a test in cec-compliance that sends an Audio Rate Control message with an invalid operand. Check that it receives a Feature Abort reply due to the invalid operand. Add a response in cec-follower to Feature Abort due to an invalid operand. Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--utils/cec-compliance/cec-test-audio.cpp25
-rw-r--r--utils/cec-follower/cec-processing.cpp4
2 files changed, 29 insertions, 0 deletions
diff --git a/utils/cec-compliance/cec-test-audio.cpp b/utils/cec-compliance/cec-test-audio.cpp
index e1386dbb..bdbcd178 100644
--- a/utils/cec-compliance/cec-test-audio.cpp
+++ b/utils/cec-compliance/cec-test-audio.cpp
@@ -895,6 +895,25 @@ static int audio_rate_ctl_active_sensing(struct node *node, unsigned me, unsigne
return OK_PRESUMED;
}
+static int audio_rate_ctl_invalid(struct node *node, unsigned me, unsigned la, bool interactive)
+{
+ if (!node->remote[la].has_aud_rate)
+ return NOTAPPLICABLE;
+
+ struct cec_msg msg = {};
+
+ cec_msg_init(&msg, me, la);
+ cec_msg_set_audio_rate(&msg, 0xa); /* Invalid Audio Rate Control message operand */
+ fail_on_test(!transmit_timeout(node, &msg));
+ fail_on_test(timed_out(&msg));
+ fail_on_test(!cec_msg_status_is_abort(&msg));
+ if (abort_reason(&msg) != CEC_OP_ABORT_INVALID_OP) {
+ warn("Expected Feature Abort [Invalid operand]\n");
+ return FAIL;
+ }
+ return OK;
+}
+
const vec_remote_subtests audio_rate_ctl_subtests{
{
"Set Audio Rate",
@@ -908,4 +927,10 @@ const vec_remote_subtests audio_rate_ctl_subtests{
CEC_LOG_ADDR_MASK_TUNER | CEC_LOG_ADDR_MASK_AUDIOSYSTEM,
audio_rate_ctl_active_sensing,
},
+ {
+ "Audio Rate Invalid Operand",
+ CEC_LOG_ADDR_MASK_PLAYBACK | CEC_LOG_ADDR_MASK_RECORD |
+ CEC_LOG_ADDR_MASK_TUNER | CEC_LOG_ADDR_MASK_AUDIOSYSTEM,
+ audio_rate_ctl_invalid,
+ },
};
diff --git a/utils/cec-follower/cec-processing.cpp b/utils/cec-follower/cec-processing.cpp
index fc0d5df0..93db4059 100644
--- a/utils/cec-follower/cec-processing.cpp
+++ b/utils/cec-follower/cec-processing.cpp
@@ -814,6 +814,10 @@ static void processMsg(struct node *node, struct cec_msg &msg, unsigned me)
aud_rate_msg_interval_check(msg.rx_ts, node->state.last_aud_rate_rx_ts);
node->state.last_aud_rate_rx_ts = msg.rx_ts;
return;
+ default:
+ cec_msg_reply_feature_abort(&msg, CEC_OP_ABORT_INVALID_OP);
+ transmit(node, &msg);
+ break;
}
break;

Privacy Policy