aboutsummaryrefslogtreecommitdiffstats
path: root/utils/cec-follower/cec-processing.cpp
diff options
context:
space:
mode:
authorDeborah Brouwer <deborahbrouwer3563@gmail.com>2021-06-03 19:40:53 -0700
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2021-06-04 09:10:14 +0200
commit5fc4802a70a4b8414198b516458fa7c9d44562b1 (patch)
tree407a2d634bca226e5bfcfedec34266b4a089d1a2 /utils/cec-follower/cec-processing.cpp
parentc8d617cc229c5e2862bf54509405c83d3c16f89a (diff)
cec: add tests for Give Deck Status message
Test that a valid Deck Status message is received in response to Give Deck Status and that Give Deck Status automatic reporting can be turned on and off. Test that the follower returns Feature Abort for an invalid Give Deck Status operand. Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'utils/cec-follower/cec-processing.cpp')
-rw-r--r--utils/cec-follower/cec-processing.cpp41
1 files changed, 18 insertions, 23 deletions
diff --git a/utils/cec-follower/cec-processing.cpp b/utils/cec-follower/cec-processing.cpp
index 5b9db19f..3d2e4a2c 100644
--- a/utils/cec-follower/cec-processing.cpp
+++ b/utils/cec-follower/cec-processing.cpp
@@ -505,36 +505,31 @@ static void processMsg(struct node *node, struct cec_msg &msg, unsigned me)
break;
- /*
- Deck Control
-
- This is only a basic implementation.
-
- TODO: Device state should reflect whether we are playing,
- fast forwarding, etc.
- */
+ /* Deck Control */
case CEC_MSG_GIVE_DECK_STATUS:
- if (node->has_deck_ctl) {
- __u8 status_req;
+ if (!node->has_deck_ctl)
+ break;
- cec_ops_give_deck_status(&msg, &status_req);
- if (status_req < CEC_OP_STATUS_REQ_ON ||
- status_req > CEC_OP_STATUS_REQ_ONCE) {
- reply_feature_abort(node, &msg, CEC_OP_ABORT_INVALID_OP);
- return;
- }
- if (status_req != CEC_OP_STATUS_REQ_ONCE)
- node->state.deck_report_changes =
- status_req == CEC_OP_STATUS_REQ_ON;
- if (status_req == CEC_OP_STATUS_REQ_OFF)
- return;
+ __u8 status_req;
+ cec_ops_give_deck_status(&msg, &status_req);
+
+ switch (status_req) {
+ case CEC_OP_STATUS_REQ_ON:
+ node->state.deck_report_changes = true;
+ fallthrough;
+ case CEC_OP_STATUS_REQ_ONCE:
cec_msg_set_reply_to(&msg, &msg);
- cec_msg_deck_status(&msg, CEC_OP_DECK_INFO_STOP);
+ cec_msg_deck_status(&msg, node->state.deck_state);
transmit(node, &msg);
return;
+ case CEC_OP_STATUS_REQ_OFF:
+ node->state.deck_report_changes = false;
+ return;
+ default:
+ reply_feature_abort(node, &msg, CEC_OP_ABORT_INVALID_OP);
+ return;
}
- break;
case CEC_MSG_PLAY:
if (node->has_deck_ctl)
return;

Privacy Policy