aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2020-04-07 11:05:15 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2020-04-07 11:05:15 +0200
commit77ca22998977824117fe0a1c1ee4ce34d413a8d0 (patch)
tree4d893a51749b9d25560e4209d8ec0cbd08f09bc0
parent5b4a5a96ebe5e1cc3aba5b084dc6ed9295c239a4 (diff)
cec-ctl: add physical address sanity checks
During the stress tests make sure the physical address is sane, i.e. never 0.0.0.0 and it is always the same. I.e. if it was 1.0.0.0 in one test iteration and in the next it is 2.0.0.0, then that's a fail. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--utils/cec-ctl/cec-ctl.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index 8943971d..b64a42b5 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -1261,6 +1261,7 @@ static void test_power_cycle(struct node &node, unsigned int max_tries,
unsigned tries;
unsigned secs;
__u16 pa, prev_pa;
+ __u16 display_pa = CEC_PHYS_ADDR_INVALID;
__u8 wakeup_la;
int ret;
@@ -1357,11 +1358,18 @@ static void test_power_cycle(struct node &node, unsigned int max_tries,
printf("%s: ", ts2s(current_ts()).c_str());
printf("Physical Address: %x.%x.%x.%x LA: %s\n",
cec_phys_addr_exp(pa), cec_la2s(from));
- if (pa == CEC_PHYS_ADDR_INVALID) {
+ if (pa == CEC_PHYS_ADDR_INVALID || !pa) {
printf("FAIL: invalid physical address\n");
exit(1);
}
prev_pa = pa;
+ if (display_pa == CEC_PHYS_ADDR_INVALID)
+ display_pa = pa;
+ if (pa != display_pa) {
+ printf("FAIL: physical address changed from %x.%x.%x.%x to %x.%x.%x.%x\n",
+ cec_phys_addr_exp(display_pa), cec_phys_addr_exp(pa));
+ exit(1);
+ }
secs = i <= 10 ? i : 10 + 10 * (i - 10);
printf("%s: ", ts2s(current_ts()).c_str());
printf("Sleep %u second%s\n", secs, secs == 1 ? "" : "s");
@@ -1447,6 +1455,11 @@ static void test_power_cycle(struct node &node, unsigned int max_tries,
printf("Physical Address: %x.%x.%x.%x\n",
cec_phys_addr_exp(pa));
}
+ if (pa != CEC_PHYS_ADDR_INVALID && pa != display_pa) {
+ printf("FAIL: physical address changed from %x.%x.%x.%x to %x.%x.%x.%x\n",
+ cec_phys_addr_exp(display_pa), cec_phys_addr_exp(pa));
+ exit(1);
+ }
printf("\n");
}
if (failures)
@@ -1466,6 +1479,7 @@ static void stress_test_power_cycle(struct node &node, unsigned cnt,
unsigned mod_usleep = 0;
unsigned wakeup_la;
__u16 pa, prev_pa;
+ __u16 display_pa = CEC_PHYS_ADDR_INVALID;
int ret;
if (max_sleep)
@@ -1553,10 +1567,17 @@ static void stress_test_power_cycle(struct node &node, unsigned cnt,
printf("%s: ", ts2s(current_ts()).c_str());
printf("Physical Address: %x.%x.%x.%x LA: %s\n",
cec_phys_addr_exp(pa), cec_la2s(from));
- if (pa == CEC_PHYS_ADDR_INVALID) {
+ if (pa == CEC_PHYS_ADDR_INVALID || !pa) {
printf("FAIL: invalid physical address\n");
exit(1);
}
+ if (display_pa == CEC_PHYS_ADDR_INVALID)
+ display_pa = pa;
+ if (pa != display_pa) {
+ printf("FAIL: physical address changed from %x.%x.%x.%x to %x.%x.%x.%x\n",
+ cec_phys_addr_exp(display_pa), cec_phys_addr_exp(pa));
+ exit(1);
+ }
if (cnt && iter == cnt)
break;
@@ -1575,6 +1596,11 @@ static void stress_test_power_cycle(struct node &node, unsigned cnt,
cec_phys_addr_exp(pa));
exit(1);
}
+ if (pa != CEC_PHYS_ADDR_INVALID && pa != display_pa) {
+ printf("FAIL: physical address changed from %x.%x.%x.%x to %x.%x.%x.%x\n",
+ cec_phys_addr_exp(display_pa), cec_phys_addr_exp(pa));
+ exit(1);
+ }
cec_msg_init(&msg, from, CEC_LOG_ADDR_TV);
/*

Privacy Policy