aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Fjeldtvedt <jaffe1@gmail.com>2016-07-22 12:20:17 +0200
committerHans Verkuil <hans.verkuil@cisco.com>2016-07-22 12:40:49 +0200
commit7bce19d3e6639fb76fda000113a67defb48ffecf (patch)
treeb7b5056106655246a0cbdf0af1ba2e709e93aa92
parentb46a501570b1cdb1a493997e465a5f4c0bfabb89 (diff)
cec-compliance: check power status before running tests
Probing the power status is now added to the topology discovery, and ensuring that the device is on is now done before starting the test run instead of as a subtest. Signed-off-by: Johan Fjeldtvedt <jaffe1@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r--utils/cec-compliance/cec-compliance.cpp20
-rw-r--r--utils/cec-compliance/cec-compliance.h2
-rw-r--r--utils/cec-compliance/cec-test-power.cpp22
-rw-r--r--utils/cec-compliance/cec-test.cpp15
4 files changed, 36 insertions, 23 deletions
diff --git a/utils/cec-compliance/cec-compliance.cpp b/utils/cec-compliance/cec-compliance.cpp
index 0cf9f7f2..15efd0a5 100644
--- a/utils/cec-compliance/cec-compliance.cpp
+++ b/utils/cec-compliance/cec-compliance.cpp
@@ -749,7 +749,25 @@ static void topology_probe_device(struct node *node, unsigned i, unsigned la)
cec_ops_set_menu_language(&msg, language);
language[3] = 0;
- printf("\t\tMenu Language: : %s\n", language);
+ printf("\t\tMenu Language : %s\n", language);
+ }
+
+ cec_msg_init(&msg, la, i);
+ cec_msg_give_device_power_status(&msg, true);
+ printf("\t\tPower Status : ");
+ if (!transmit_timeout(node, &msg) || timed_out_or_abort(&msg))
+ printf("%s\n", status2s(msg).c_str());
+ else {
+ __u8 pwr;
+
+ cec_ops_report_power_status(&msg, &pwr);
+ if (pwr >= 4)
+ printf("Invalid\n");
+ else {
+ node->remote[i].has_power_status = true;
+ node->remote[i].in_standby = pwr != CEC_OP_POWER_STATUS_ON;
+ printf("%s\n", power_status2s(pwr));
+ }
}
}
diff --git a/utils/cec-compliance/cec-compliance.h b/utils/cec-compliance/cec-compliance.h
index ee2309b0..cd6f39be 100644
--- a/utils/cec-compliance/cec-compliance.h
+++ b/utils/cec-compliance/cec-compliance.h
@@ -371,6 +371,8 @@ extern struct remote_subtest arc_subtests[];
extern const unsigned arc_subtests_size;
// cec-power.cpp
+bool util_interactive_ensure_power_state(struct node *node, unsigned me, unsigned la, bool interactive,
+ __u8 target_pwr);
extern struct remote_subtest standby_subtests[];
extern const unsigned standby_subtests_size;
extern struct remote_subtest one_touch_play_subtests[];
diff --git a/utils/cec-compliance/cec-test-power.cpp b/utils/cec-compliance/cec-test-power.cpp
index 6455f06e..b266fa3d 100644
--- a/utils/cec-compliance/cec-test-power.cpp
+++ b/utils/cec-compliance/cec-test-power.cpp
@@ -43,7 +43,7 @@ static bool get_power_status(struct node *node, unsigned me, unsigned la, __u8 &
return true;
}
-static bool util_interactive_ensure_power_state(struct node *node, unsigned me, unsigned la, bool interactive,
+bool util_interactive_ensure_power_state(struct node *node, unsigned me, unsigned la, bool interactive,
__u8 target_pwr)
{
interactive_info(true, "Please ensure that the device is in state %s.",
@@ -68,7 +68,7 @@ static bool util_interactive_ensure_power_state(struct node *node, unsigned me,
}
-/* Device Power Status */
+/* Give Device Power Status */
static int power_status_probe(struct node *node, unsigned me, unsigned la, bool interactive)
{
@@ -83,30 +83,12 @@ static int power_status_probe(struct node *node, unsigned me, unsigned la, bool
__u8 power_status;
cec_ops_report_power_status(&msg, &power_status);
fail_on_test(power_status >= 4);
- 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 5b660e1c..d7fd11f0 100644
--- a/utils/cec-compliance/cec-test.cpp
+++ b/utils/cec-compliance/cec-test.cpp
@@ -544,7 +544,7 @@ static struct remote_test tests[] = {
test_case_ext("Audio Return Channel feature",
TAG_ARC_CONTROL,
arc_subtests),
- test_case_ext("System Audio Control",
+ test_case_ext("System Audio Control feature",
TAG_SYSTEM_AUDIO_CONTROL,
sac_subtests),
test_case_ext("One Touch Play feature",
@@ -563,9 +563,20 @@ static const unsigned num_tests = sizeof(tests) / sizeof(struct remote_test);
void testRemote(struct node *node, unsigned me, unsigned la, unsigned test_tags,
bool interactive)
{
- printf("testing CEC local LA %d (%s) to remote LA %d (%s):\n\n",
+ printf("testing CEC local LA %d (%s) to remote LA %d (%s):\n",
me, la2s(me), la, la2s(la));
+ if (!util_interactive_ensure_power_state(node, me, la, interactive, CEC_OP_POWER_STATUS_ON))
+ return;
+ if (node->remote[la].in_standby && !interactive) {
+ announce("The remote device is in standby. It should be powered on when testing. Aborting.");
+ return;
+ }
+ if (!node->remote[la].has_power_status) {
+ announce("The device didn't support Give Device Power Status.");
+ announce("Assuming that the device is powered on.");
+ }
+
int ret = 0;
for (unsigned i = 0; i < num_tests; i++) {

Privacy Policy