aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Fjeldtvedt <jaffe1@gmail.com>2016-07-21 17:45:13 +0200
committerHans Verkuil <hans.verkuil@cisco.com>2016-07-21 18:36:21 +0200
commit7a9767ad31b41ac0213dae35fd7a6a5692f01e50 (patch)
treeff47cb18f962b4a3adf7573e01d33dad635a29ed
parent4c3f1492e308c7f75b6fe9c85754a68e3000aa35 (diff)
cec-compliance: check that the DUT is powered on
A new subtest is added which checks the reported power status. If not in interactive mode, we assume that the device is on if the device doesn't support Give Device Power Status. In interactive mode we ask the user. Signed-off-by: Johan Fjeldtvedt <jaffe1@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r--utils/cec-compliance/cec-power.cpp18
-rw-r--r--utils/cec-compliance/cec-test.cpp6
2 files changed, 20 insertions, 4 deletions
diff --git a/utils/cec-compliance/cec-power.cpp b/utils/cec-compliance/cec-power.cpp
index c7aa725e..6455f06e 100644
--- a/utils/cec-compliance/cec-power.cpp
+++ b/utils/cec-compliance/cec-power.cpp
@@ -78,7 +78,7 @@ static int power_status_probe(struct node *node, unsigned me, unsigned la, bool
cec_msg_give_device_power_status(&msg, true);
fail_on_test(!transmit_timeout(node, &msg));
fail_on_test(timed_out(&msg));
- fail_on_test(cec_msg_status_is_abort(&msg) && !(la & CEC_LOG_ADDR_MASK_UNREGISTERED));
+ fail_on_test(cec_msg_status_is_abort(&msg) && la != CEC_LOG_ADDR_UNREGISTERED);
__u8 power_status;
cec_ops_report_power_status(&msg, &power_status);
@@ -86,11 +86,27 @@ static int power_status_probe(struct node *node, unsigned me, unsigned la, bool
info("\t\tPower Status: : %s\n", power_status2s(power_status));
node->remote[la].has_power_status = true;
+ node->remote[la].in_standby = power_status != CEC_OP_POWER_STATUS_ON;
+ return 0;
+}
+
+static int power_status_check_on(struct node *node, unsigned me, unsigned la, bool interactive)
+{
+ if (!util_interactive_ensure_power_state(node, me, la, interactive, CEC_OP_POWER_STATUS_ON) ||
+ (node->remote[la].in_standby && !interactive))
+ return FAIL_CRITICAL;
+ if (!node->remote[la].has_power_status) {
+ announce("Device didn't support Give Device Power Status.");
+ announce("Assuming that the device is powered on.");
+ return PRESUMED_OK;
+ }
+
return 0;
}
struct remote_subtest power_status_subtests[] = {
{ "Give Device Power Status", CEC_LOG_ADDR_MASK_ALL, power_status_probe },
+ { "Check that device is on", CEC_LOG_ADDR_MASK_ALL, power_status_check_on },
};
const unsigned power_status_subtests_size = ARRAY_SIZE(power_status_subtests);
diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp
index ef7638a3..5b660e1c 100644
--- a/utils/cec-compliance/cec-test.cpp
+++ b/utils/cec-compliance/cec-test.cpp
@@ -520,6 +520,9 @@ static struct remote_test tests[] = {
test_case("Core",
TAG_CORE,
core_subtests),
+ test_case_ext("Give Device Power Status feature",
+ TAG_POWER_STATUS,
+ power_status_subtests),
test_case("System Information feature",
TAG_SYSTEM_INFORMATION,
system_info_subtests),
@@ -532,9 +535,6 @@ static struct remote_test tests[] = {
test_case("OSD String feature",
TAG_OSD_DISPLAY,
osd_string_subtests),
- test_case_ext("Give Device Power Status feature",
- TAG_POWER_STATUS,
- power_status_subtests),
test_case("Remote Control Passthrough feature",
TAG_REMOTE_CONTROL_PASSTHROUGH,
rc_passthrough_subtests),

Privacy Policy