aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2020-03-13 11:45:10 +0100
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2020-03-13 11:45:10 +0100
commit2157de9b324a82e3e252ebbc65aa123679b42e58 (patch)
treeb57c3f759185d94f04139c4f494e366c0ad0b01b
parent6ba235f7259281ab6326a1cc84c6231cbbfc1071 (diff)
cec-ctl: added polls suboption to --stress-test-power-cycle
By default this stress test tried to poll for a power state change for up to 50 seconds. This is too pessimistic and the default has been changed to 30 seconds. In addition a new <polls> suboption was added to change the number of polls, just like was done with the --test-power-cycle option. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--utils/cec-ctl/cec-ctl.1.in5
-rw-r--r--utils/cec-ctl/cec-ctl.cpp21
2 files changed, 16 insertions, 10 deletions
diff --git a/utils/cec-ctl/cec-ctl.1.in b/utils/cec-ctl/cec-ctl.1.in
index 94797edf..53fe2361 100644
--- a/utils/cec-ctl/cec-ctl.1.in
+++ b/utils/cec-ctl/cec-ctl.1.in
@@ -258,12 +258,13 @@ instead of from a file.
.TP
\fB\-\-test\-power\-cycle\fR [\fIpolls\fR=\fI<n>\fR][,\fIsleep\fR=\fI<secs>\fR]
This option tests the power cycle behavior of the display. It polls up to
-\fI<n>\fR times (default 15), waiting for a state changes. If that fails then it
+\fI<n>\fR times (default 15), waiting for a state change. If that fails then it
waits \fI<secs>\fR seconds (default 10) before retrying this.
.TP
-\fB\-\-stress\-test\-power\-cycle\fR \fIcnt\fR=\fI<count>\fR[,\fImax-sleep\fR=\fI<secs>\fR][,\fIseed\fR=\fI<seed>\fR][,\fIrepeats\fR=\fI<reps>\fR][,\fIsleep-before-on\fR=\fI<secs1>\fR][,\fIsleep-before-off\fR=\fI<secs2>\fR]
+\fB\-\-stress\-test\-power\-cycle\fR \fIcnt\fR=\fI<count>\fR[,\fIpolls\fR=\fI<n>\fR][,\fImax-sleep\fR=\fI<secs>\fR][,\fIseed\fR=\fI<seed>\fR][,\fIrepeats\fR=\fI<reps>\fR][,\fIsleep-before-on\fR=\fI<secs1>\fR][,\fIsleep-before-off\fR=\fI<secs2>\fR]
This option performs a stress test for a display: it power cycles the display \fI<count>\fR
times using the CEC Standby and Image View On commands. If \fI<count>\fR is 0, then never stop.
+It polls up to \fI<n>\fR times (default 30), waiting for a state change.
If \fI<secs>\fR is non-zero (0 is the default), then sleep for a random number of seconds
between 0 and \fI<secs>\fR before each <Standby> or <Image View On> message.
If \fI<seed>\fR is specified, then set the randomizer seed to that value instead of
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index 9745001a..bc05d5af 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -312,12 +312,13 @@ static void usage(void)
" Use - for stdin.\n"
" --test-power-cycle [polls=<n>][,sleep=<secs>]\n"
" Test power cycle behavior of the display. It polls up to\n"
- " <n> times (default 15), waiting for a state changes. If\n"
+ " <n> times (default 15), waiting for a state change. If\n"
" that fails it waits <secs> seconds (default 10) before\n"
" retrying this.\n"
- " --stress-test-power-cycle cnt=<count>[,max-sleep=<secs>][,seed=<seed>][,repeats=<reps>]\n"
+ " --stress-test-power-cycle cnt=<count>[,polls=<n>][,max-sleep=<secs>][,seed=<seed>][,repeats=<reps>]\n"
" [,sleep-before-on=<secs1>][,sleep-before-off=<secs2]\n"
" Power cycle display <count> times. If 0, then never stop.\n"
+ " It polls up to <n> times (default 30), waiting for a state change.\n"
" If <secs> is non-zero (0 is the default), then sleep for\n"
" a random number of seconds between 0 and <secs> before\n"
" each <Standby> or <Image View On> message.\n"
@@ -1099,12 +1100,11 @@ static bool wait_for_pwr_state(struct node &node, unsigned from, bool on)
return pwr == (on ? CEC_OP_POWER_STATUS_ON : CEC_OP_POWER_STATUS_STANDBY);
}
-static int init_power_cycle_test(struct node &node, unsigned repeats)
+static int init_power_cycle_test(struct node &node, unsigned repeats, unsigned max_tries)
{
struct cec_msg msg;
unsigned from;
unsigned tries;
- const unsigned max_tries = 30;
__u16 pa;
int ret;
@@ -1227,7 +1227,7 @@ static void test_power_cycle(struct node &node, unsigned int max_tries,
__u8 wakeup_la;
int ret;
- from = init_power_cycle_test(node, 2);
+ from = init_power_cycle_test(node, 2, max_tries);
for (unsigned iter = 0; iter <= 2 * 12; iter++) {
unsigned i = iter / 2;
@@ -1414,13 +1414,12 @@ static void test_power_cycle(struct node &node, unsigned int max_tries,
}
static void stress_test_power_cycle(struct node &node,
- unsigned cnt, unsigned max_sleep,
+ unsigned cnt, unsigned max_sleep, unsigned max_tries,
bool has_seed, unsigned seed, unsigned repeats,
double sleep_before_on, double sleep_before_off)
{
struct cec_log_addrs laddrs = { };
struct cec_msg msg;
- const unsigned max_tries = 50;
unsigned tries = 0;
unsigned iter = 0;
unsigned mod_usleep = 0;
@@ -1437,7 +1436,7 @@ static void stress_test_power_cycle(struct node &node,
if (mod_usleep)
printf("Randomizer seed: %u\n\n", seed);
- unsigned from = init_power_cycle_test(node, repeats);
+ unsigned from = init_power_cycle_test(node, repeats, max_tries);
srandom(seed);
@@ -1754,6 +1753,7 @@ int main(int argc, char **argv)
__u32 vendor_id = 0x000c03; /* HDMI LLC vendor ID */
unsigned int stress_test_pwr_cycle_cnt = 0;
unsigned int stress_test_pwr_cycle_max_sleep = 0;
+ unsigned int stress_test_pwr_cycle_polls = 30;
bool stress_test_pwr_cycle_has_seed = false;
unsigned int stress_test_pwr_cycle_seed = 0;
unsigned int stress_test_pwr_cycle_repeats = 0;
@@ -2165,6 +2165,7 @@ int main(int argc, char **argv)
"repeats",
"sleep-before-on",
"sleep-before-off",
+ "polls",
NULL
};
char *value, *subs = optarg;
@@ -2190,6 +2191,9 @@ int main(int argc, char **argv)
case 5:
stress_test_pwr_cycle_sleep_before_off = strtod(value, NULL);
break;
+ case 6:
+ stress_test_pwr_cycle_polls = strtoul(value, 0L, 0);
+ break;
default:
exit(1);
}
@@ -2554,6 +2558,7 @@ int main(int argc, char **argv)
if (options[OptStressTestPowerCycle])
stress_test_power_cycle(node, stress_test_pwr_cycle_cnt,
stress_test_pwr_cycle_max_sleep,
+ stress_test_pwr_cycle_polls,
stress_test_pwr_cycle_has_seed,
stress_test_pwr_cycle_seed,
stress_test_pwr_cycle_repeats,

Privacy Policy