aboutsummaryrefslogtreecommitdiffstats
path: root/utils/cec-compliance
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2018-10-16 12:43:47 +0200
committerHans Verkuil <hverkuil@xs4all.nl>2018-10-16 12:43:47 +0200
commitc4cc439bf2ac37aa7f89bd070e0d603b21263972 (patch)
tree5f725f93b4e7919bf414ce1d2d57494583b6fa18 /utils/cec-compliance
parenteed80e3000e43a5c57b73d20c9900a3176bdf591 (diff)
cec-compliance: check core messages when remote is in standby
Check if the remote CEC device can handle the CEC core messages when in standby. And check that what is returned is equal to the value returned when the device was on. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'utils/cec-compliance')
-rw-r--r--utils/cec-compliance/cec-compliance.cpp23
-rw-r--r--utils/cec-compliance/cec-compliance.h14
-rw-r--r--utils/cec-compliance/cec-test-power.cpp10
-rw-r--r--utils/cec-compliance/cec-test.cpp40
4 files changed, 65 insertions, 22 deletions
diff --git a/utils/cec-compliance/cec-compliance.cpp b/utils/cec-compliance/cec-compliance.cpp
index 0d146b18..f311a0d7 100644
--- a/utils/cec-compliance/cec-compliance.cpp
+++ b/utils/cec-compliance/cec-compliance.cpp
@@ -955,11 +955,15 @@ static void topology_probe_device(struct node *node, unsigned i, unsigned la)
cec_msg_give_device_vendor_id(&msg, true);
ok = !transmit_timeout(node, &msg) || timed_out_or_abort(&msg);
printf("\t\tVendor ID : ");
- if (ok)
+ if (ok) {
printf("%s\n", status2s(msg).c_str());
- else
+ node->remote[i].vendor_id = CEC_VENDOR_ID_NONE;
+ } else {
printf("0x%02x%02x%02x\n",
msg.msg[2], msg.msg[3], msg.msg[4]);
+ node->remote[i].vendor_id = (msg.msg[2] << 16) |
+ (msg.msg[3] << 8) | msg.msg[4];
+ }
cec_msg_init(&msg, la, i);
cec_msg_give_osd_name(&msg, true);
@@ -968,20 +972,16 @@ static void topology_probe_device(struct node *node, unsigned i, unsigned la)
if (ok) {
printf("%s\n", status2s(msg).c_str());
} else {
- char osd_name[15];
-
- cec_ops_set_osd_name(&msg, osd_name);
- printf("'%s'\n", osd_name);
+ cec_ops_set_osd_name(&msg, node->remote[i].osd_name);
+ printf("'%s'\n", node->remote[i].osd_name);
}
cec_msg_init(&msg, la, i);
cec_msg_get_menu_language(&msg, true);
if (transmit_timeout(node, &msg) && !timed_out_or_abort(&msg)) {
- char language[4];
-
- cec_ops_set_menu_language(&msg, language);
- language[3] = 0;
- printf("\t\tMenu Language : %s\n", language);
+ cec_ops_set_menu_language(&msg, node->remote[i].language);
+ printf("\t\tMenu Language : %s\n",
+ node->remote[i].language);
}
cec_msg_init(&msg, la, i);
@@ -1019,6 +1019,7 @@ static void topology_probe_device(struct node *node, unsigned i, unsigned la)
return;
node->remote[i].rc_profile = *rc_profile;
node->remote[i].dev_features = *dev_features;
+ node->remote[i].all_device_types = all_device_types;
node->remote[i].has_arc_rx =
(*dev_features & CEC_OP_FEAT_DEV_SOURCE_HAS_ARC_RX) != 0;
node->remote[i].has_arc_tx =
diff --git a/utils/cec-compliance/cec-compliance.h b/utils/cec-compliance/cec-compliance.h
index eed21d77..91439fab 100644
--- a/utils/cec-compliance/cec-compliance.h
+++ b/utils/cec-compliance/cec-compliance.h
@@ -123,9 +123,13 @@ struct remote {
bool unrecognized_op[256];
unsigned prim_type;
__u16 phys_addr;
+ char osd_name[15];
+ char language[4];
__u8 cec_version;
__u8 rc_profile;
__u8 dev_features;
+ __u8 all_device_types;
+ __u32 vendor_id;
bool has_osd;
bool has_power_status;
bool has_image_view_on;
@@ -169,6 +173,7 @@ struct remote_subtest {
const char *name;
const __u16 la_mask;
int (*const test_fn)(struct node *node, unsigned me, unsigned la, bool interactive);
+ bool needs_pa;
};
#define PRESUMED_OK 1
@@ -383,6 +388,15 @@ void testAdapter(struct node &node, struct cec_log_addrs &laddrs,
// CEC core tests
int testCore(struct node *node);
+int core_unknown(struct node *node, unsigned me, unsigned la, bool interactive);
+int core_abort(struct node *node, unsigned me, unsigned la, bool interactive);
+int system_info_polling(struct node *node, unsigned me, unsigned la, bool interactive);
+int system_info_phys_addr(struct node *node, unsigned me, unsigned la, bool interactive);
+int system_info_version(struct node *node, unsigned me, unsigned la, bool interactive);
+int system_info_get_menu_lang(struct node *node, unsigned me, unsigned la, bool interactive);
+int system_info_give_features(struct node *node, unsigned me, unsigned la, bool interactive);
+int vendor_specific_commands_id(struct node *node, unsigned me, unsigned la, bool interactive);
+int device_osd_transfer_give(struct node *node, unsigned me, unsigned la, bool interactive);
// CEC processing
int testProcessing(struct node *node, unsigned me);
diff --git a/utils/cec-compliance/cec-test-power.cpp b/utils/cec-compliance/cec-test-power.cpp
index e0772cde..f520bfd9 100644
--- a/utils/cec-compliance/cec-test-power.cpp
+++ b/utils/cec-compliance/cec-test-power.cpp
@@ -544,6 +544,16 @@ static int standby_resume_wakeup_text_view_on(struct node *node, unsigned me, un
struct remote_subtest standby_resume_subtests[] = {
{ "Standby", CEC_LOG_ADDR_MASK_ALL, standby_resume_standby },
{ "Repeated Standby message does not wake up", CEC_LOG_ADDR_MASK_ALL, standby_resume_standby_toggle },
+ { "Standby: Feature aborts unknown messages", CEC_LOG_ADDR_MASK_ALL, core_unknown, true },
+ { "Standby: Feature aborts Abort message", CEC_LOG_ADDR_MASK_ALL, core_abort, true },
+ { "Standby: Polling Message", CEC_LOG_ADDR_MASK_ALL, system_info_polling, true },
+ { "Standby: Give Device Power Status", CEC_LOG_ADDR_MASK_ALL, power_status_give, true },
+ { "Standby: Give Physical Address", CEC_LOG_ADDR_MASK_ALL, system_info_phys_addr, true },
+ { "Standby: Give CEC Version", CEC_LOG_ADDR_MASK_ALL, system_info_version, true },
+ { "Standby: Give Device Vendor ID", CEC_LOG_ADDR_MASK_ALL, vendor_specific_commands_id, true },
+ { "Standby: Give OSD Name", CEC_LOG_ADDR_MASK_ALL, device_osd_transfer_give, true },
+ { "Standby: Get Menu Language", CEC_LOG_ADDR_MASK_ALL, system_info_get_menu_lang, true },
+ { "Standby: Give Device Features", CEC_LOG_ADDR_MASK_ALL, system_info_give_features, true },
{ "No wakeup on Active Source", CEC_LOG_ADDR_MASK_ALL, standby_resume_active_source_nowake },
{ "Wake up", CEC_LOG_ADDR_MASK_ALL, standby_resume_wakeup},
{ "Wake up TV on Image View On", CEC_LOG_ADDR_MASK_TV, standby_resume_wakeup_image_view_on },
diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp
index 0744ba71..e5ed000a 100644
--- a/utils/cec-compliance/cec-test.cpp
+++ b/utils/cec-compliance/cec-test.cpp
@@ -32,7 +32,7 @@ struct remote_test {
/* System Information */
-static int system_info_polling(struct node *node, unsigned me, unsigned la, bool interactive)
+int system_info_polling(struct node *node, unsigned me, unsigned la, bool interactive)
{
struct cec_msg msg = { };
@@ -50,7 +50,7 @@ static int system_info_polling(struct node *node, unsigned me, unsigned la, bool
return 0;
}
-static int system_info_phys_addr(struct node *node, unsigned me, unsigned la, bool interactive)
+int system_info_phys_addr(struct node *node, unsigned me, unsigned la, bool interactive)
{
struct cec_msg msg = { };
@@ -58,11 +58,12 @@ static int system_info_phys_addr(struct node *node, unsigned me, unsigned la, bo
cec_msg_give_physical_addr(&msg, true);
if (!transmit_timeout(node, &msg) || timed_out_or_abort(&msg))
return FAIL_CRITICAL;
-
+ fail_on_test(node->remote[la].phys_addr != ((msg.msg[2] << 8) | msg.msg[3]));
+ fail_on_test(node->remote[la].prim_type != msg.msg[4]);
return 0;
}
-static int system_info_version(struct node *node, unsigned me, unsigned la, bool interactive)
+int system_info_version(struct node *node, unsigned me, unsigned la, bool interactive)
{
struct cec_msg msg = {};
@@ -78,11 +79,12 @@ static int system_info_version(struct node *node, unsigned me, unsigned la, bool
/* This needs to be kept in sync with newer CEC versions */
fail_on_test(msg.msg[2] < CEC_OP_CEC_VERSION_1_3A ||
msg.msg[2] > CEC_OP_CEC_VERSION_2_0);
+ fail_on_test(node->remote[la].cec_version != msg.msg[2]);
return 0;
}
-static int system_info_get_menu_lang(struct node *node, unsigned me, unsigned la, bool interactive)
+int system_info_get_menu_lang(struct node *node, unsigned me, unsigned la, bool interactive)
{
struct cec_msg msg = {};
char language[4];
@@ -106,7 +108,7 @@ static int system_info_get_menu_lang(struct node *node, unsigned me, unsigned la
if (cec_msg_status_is_abort(&msg))
return PRESUMED_OK;
cec_ops_set_menu_language(&msg, language);
- language[3] = 0;
+ fail_on_test(strcmp(node->remote[la].language, language));
return 0;
}
@@ -126,7 +128,7 @@ static int system_info_set_menu_lang(struct node *node, unsigned me, unsigned la
return PRESUMED_OK;
}
-static int system_info_give_features(struct node *node, unsigned me, unsigned la, bool interactive)
+int system_info_give_features(struct node *node, unsigned me, unsigned la, bool interactive)
{
struct cec_msg msg = { };
@@ -165,6 +167,9 @@ static int system_info_give_features(struct node *node, unsigned me, unsigned la
if (!cec_has_tv(1 << la) && node->remote[la].has_rec_tv)
return fail("Only TVs shall set the Record TV Screen bit\n");
+ fail_on_test(node->remote[la].rc_profile != *rc_profile);
+ fail_on_test(node->remote[la].dev_features != *dev_features);
+ fail_on_test(node->remote[la].all_device_types != all_device_types);
return 0;
}
@@ -180,7 +185,7 @@ static struct remote_subtest system_info_subtests[] = {
/* Core behavior */
-static int core_unknown(struct node *node, unsigned me, unsigned la, bool interactive)
+int core_unknown(struct node *node, unsigned me, unsigned la, bool interactive)
{
struct cec_msg msg = { };
const __u8 unknown_opcode = 0xfe;
@@ -213,7 +218,7 @@ static int core_unknown(struct node *node, unsigned me, unsigned la, bool intera
return 0;
}
-static int core_abort(struct node *node, unsigned me, unsigned la, bool interactive)
+int core_abort(struct node *node, unsigned me, unsigned la, bool interactive)
{
struct cec_msg msg = {};
@@ -235,7 +240,7 @@ static struct remote_subtest core_subtests[] = {
/* Vendor Specific Commands */
-static int vendor_specific_commands_id(struct node *node, unsigned me, unsigned la, bool interactive)
+int vendor_specific_commands_id(struct node *node, unsigned me, unsigned la, bool interactive)
{
struct cec_msg msg = {};
@@ -248,6 +253,8 @@ static int vendor_specific_commands_id(struct node *node, unsigned me, unsigned
return REFUSED;
if (cec_msg_status_is_abort(&msg))
return PRESUMED_OK;
+ fail_on_test(node->remote[la].vendor_id !=
+ (__u32)((msg.msg[2] << 16) | (msg.msg[3] << 8) | msg.msg[4]));
return 0;
}
@@ -278,7 +285,7 @@ static int device_osd_transfer_set(struct node *node, unsigned me, unsigned la,
return PRESUMED_OK;
}
-static int device_osd_transfer_give(struct node *node, unsigned me, unsigned la, bool interactive)
+int device_osd_transfer_give(struct node *node, unsigned me, unsigned la, bool interactive)
{
struct cec_msg msg = { };
@@ -295,6 +302,9 @@ static int device_osd_transfer_give(struct node *node, unsigned me, unsigned la,
return REFUSED;
if (cec_msg_status_is_abort(&msg))
return PRESUMED_OK;
+ char osd_name[15];
+ cec_ops_set_osd_name(&msg, osd_name);
+ fail_on_test(strcmp(node->remote[la].osd_name, osd_name));
return 0;
}
@@ -1410,8 +1420,16 @@ void testRemote(struct node *node, unsigned me, unsigned la, unsigned test_tags,
for (unsigned i = 0; i < num_tests; i++) {
if ((tests[i].tags & test_tags) != tests[i].tags)
continue;
+
printf("\t%s:\n", tests[i].name);
for (unsigned j = 0; j < tests[i].num_subtests; j++) {
+ if (tests[i].subtests[j].needs_pa) {
+ struct cec_log_addrs laddrs = { };
+ doioctl(node, CEC_ADAP_G_LOG_ADDRS, &laddrs);
+
+ if (node->phys_addr == CEC_PHYS_ADDR_INVALID)
+ continue;
+ }
ret = tests[i].subtests[j].test_fn(node, me, la, interactive);
if (!(tests[i].subtests[j].la_mask & (1 << la)) && !ret) {
printf("\t %s: OK (Unexpected)\n",

Privacy Policy