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@xxxxxxxxx> --- utils/cec-compliance/cec-test-audio.cpp | 25 +++++++++++++++++++++++++ utils/cec-follower/cec-processing.cpp | 4 ++++ 2 files changed, 29 insertions(+) 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; -- 2.17.1