aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Fjeldtvedt <jaffe1@gmail.com>2016-07-22 14:20:55 +0200
committerHans Verkuil <hans.verkuil@cisco.com>2016-07-22 14:37:07 +0200
commitda6e8deb3752f59c522227fdc4e6f4be302dc65c (patch)
tree1cdc2e2bce08ba2726b9813c021dc72e8e53ffc2
parent7838079e2084b4d30e72dab5ce32adc4a43f1137 (diff)
add test for Device Menu Control feature
This adds simple subtests for the Device Menu Control feature, and extends the follower to accept the relevant messages. Signed-off-by: Johan Fjeldtvedt <jaffe1@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r--utils/cec-compliance/cec-test.cpp42
-rw-r--r--utils/cec-follower/cec-follower.cpp1
-rw-r--r--utils/cec-follower/cec-follower.h1
-rw-r--r--utils/cec-follower/cec-processing.cpp22
4 files changed, 65 insertions, 1 deletions
diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp
index f6f2a285..1cb98cfa 100644
--- a/utils/cec-compliance/cec-test.cpp
+++ b/utils/cec-compliance/cec-test.cpp
@@ -516,6 +516,45 @@ static struct remote_subtest rc_passthrough_subtests[] = {
};
+/* Device Menu Control */
+
+static int dev_menu_ctl_request(struct node *node, unsigned me, unsigned la, bool interactive)
+{
+ struct cec_msg msg = {};
+
+ cec_msg_init(&msg, me, la);
+ cec_msg_menu_request(&msg, true, CEC_OP_MENU_REQUEST_QUERY);
+ fail_on_test(!transmit_timeout(node, &msg));
+ if (timed_out_or_abort(&msg))
+ return NOTSUPPORTED;
+ if (node->remote[la].cec_version >= CEC_OP_CEC_VERSION_2_0)
+ warn("The Device Menu Control feature is deprecated in CEC 2.0");
+
+ return 0;
+}
+
+static int dev_menu_ctl_status(struct node *node, unsigned me, unsigned la, bool interactive)
+{
+ struct cec_msg msg = {};
+
+ cec_msg_init(&msg, me, la);
+ cec_msg_menu_status(&msg, CEC_OP_MENU_STATE_ACTIVATED);
+ fail_on_test(!transmit_timeout(node, &msg));
+ if (cec_msg_status_is_abort(&msg))
+ return NOTSUPPORTED;
+ if (node->remote[la].cec_version >= CEC_OP_CEC_VERSION_2_0)
+ warn("The Device Menu Control feature is deprecated in CEC 2.0");
+
+ return 0;
+}
+static struct remote_subtest dev_menu_ctl_subtests[] = {
+ { "Menu Request", (__u16)~CEC_LOG_ADDR_MASK_TV, dev_menu_ctl_request },
+ { "Menu Status", CEC_LOG_ADDR_MASK_TV, dev_menu_ctl_status },
+ { "User Control Pressed", CEC_LOG_ADDR_MASK_ALL, rc_passthrough_user_ctrl_pressed },
+ { "User Control Released", CEC_LOG_ADDR_MASK_ALL, rc_passthrough_user_ctrl_released },
+};
+
+
/* Post-test checks */
static int post_test_check_recognized(struct node *node, unsigned me, unsigned la, bool interactive)
@@ -561,6 +600,9 @@ static struct remote_test tests[] = {
test_case("Remote Control Passthrough feature",
TAG_REMOTE_CONTROL_PASSTHROUGH,
rc_passthrough_subtests),
+ test_case("Device Menu Control feature",
+ TAG_DEVICE_MENU_CONTROL,
+ dev_menu_ctl_subtests),
test_case_ext("Dynamic Auto Lipsync feature",
TAG_DYNAMIC_AUTO_LIPSYNC,
dal_subtests),
diff --git a/utils/cec-follower/cec-follower.cpp b/utils/cec-follower/cec-follower.cpp
index 7fb566a7..4fd86fc1 100644
--- a/utils/cec-follower/cec-follower.cpp
+++ b/utils/cec-follower/cec-follower.cpp
@@ -648,6 +648,7 @@ int main(int argc, char **argv)
struct cec_log_addrs laddrs = { };
doioctl(&node, CEC_ADAP_G_LOG_ADDRS, &laddrs);
node.adap_la_mask = laddrs.log_addr_mask;
+ node.cec_version = laddrs.cec_version;
printf("\tLogical Address Mask : 0x%04x\n", laddrs.log_addr_mask);
printf("\tCEC Version : %s\n", version2s(laddrs.cec_version));
diff --git a/utils/cec-follower/cec-follower.h b/utils/cec-follower/cec-follower.h
index e68f1fa6..05e5d3b4 100644
--- a/utils/cec-follower/cec-follower.h
+++ b/utils/cec-follower/cec-follower.h
@@ -66,6 +66,7 @@ struct node {
unsigned adap_la_mask;
struct state state;
__u16 phys_addr;
+ __u8 cec_version;
bool has_arc_rx;
bool has_arc_tx;
bool has_aud_rate;
diff --git a/utils/cec-follower/cec-processing.cpp b/utils/cec-follower/cec-processing.cpp
index b1daf692..dff659f2 100644
--- a/utils/cec-follower/cec-processing.cpp
+++ b/utils/cec-follower/cec-processing.cpp
@@ -386,7 +386,8 @@ static void processMsg(struct node *node, struct cec_msg &msg, unsigned me)
return;
- /* Remote Control Passthrough (System Audio Control) */
+ /* Remote Control Passthrough
+ (System Audio Control, Device Menu Control) */
case CEC_MSG_USER_CONTROL_PRESSED: {
struct cec_op_ui_command rc_press;
@@ -482,6 +483,25 @@ static void processMsg(struct node *node, struct cec_msg &msg, unsigned me)
return;
+ /* Device Menu Control */
+
+ case CEC_MSG_MENU_REQUEST: {
+ if (node->cec_version < CEC_OP_CEC_VERSION_2_0 &&
+ !cec_has_tv(1 << me)) {
+ cec_msg_set_reply_to(&msg, &msg);
+ cec_msg_menu_status(&msg, CEC_OP_MENU_STATE_ACTIVATED);
+ transmit(node, &msg);
+ return;
+ }
+ break;
+ }
+ case CEC_MSG_MENU_STATUS:
+ if (node->cec_version < CEC_OP_CEC_VERSION_2_0 &&
+ cec_has_tv(1 << me))
+ return;
+ break;
+
+
/* Dynamic Auto Lipsync */
case CEC_MSG_REQUEST_CURRENT_LATENCY: {

Privacy Policy