aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2017-02-16 12:20:45 +0100
committerHans Verkuil <hans.verkuil@cisco.com>2017-02-16 12:20:45 +0100
commit8d8a29521a3a202268def8c3e648376fb5f4047e (patch)
tree874916415c6a666416af4dbebad880743684d96b /utils
parent13d54896bb9d984e41cb13175ba84e64ee522ba2 (diff)
cec-compliance: add --timeout option
The default timeout for power-related messages is 60 seconds. Add the --timeout option to make this configurable. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/cec-compliance/cec-compliance.cpp7
-rw-r--r--utils/cec-compliance/cec-compliance.h1
-rw-r--r--utils/cec-compliance/cec-test-power.cpp8
-rw-r--r--utils/cec-compliance/cec-test.cpp8
4 files changed, 16 insertions, 8 deletions
diff --git a/utils/cec-compliance/cec-compliance.cpp b/utils/cec-compliance/cec-compliance.cpp
index 5abca109..f790f73a 100644
--- a/utils/cec-compliance/cec-compliance.cpp
+++ b/utils/cec-compliance/cec-compliance.cpp
@@ -51,6 +51,7 @@ enum Option {
OptNoWarnings = 'n',
OptRemote = 'r',
OptReplyThreshold = 'R',
+ OptTimeout = 't',
OptTrace = 'T',
OptVerbose = 'v',
OptInteractive = 'i',
@@ -108,12 +109,14 @@ bool show_info;
bool show_warnings = true;
unsigned warnings;
unsigned reply_threshold = 1000;
+unsigned long_timeout = 60;
static struct option long_options[] = {
{"device", required_argument, 0, OptSetDevice},
{"help", no_argument, 0, OptHelp},
{"no-warnings", no_argument, 0, OptNoWarnings},
{"remote", optional_argument, 0, OptRemote},
+ {"timeout", required_argument, 0, OptTimeout},
{"trace", no_argument, 0, OptTrace},
{"verbose", no_argument, 0, OptVerbose},
{"interactive", no_argument, 0, OptInteractive},
@@ -172,6 +175,7 @@ static void usage(void)
" -R, --reply-threshold=<timeout>\n"
" Warn if replies take longer than this threshold (default 1000ms)\n"
" -i, --interactive Interactive mode when doing remote tests\n"
+ " -t, --timeout=<secs> Set the standby/resume timeout to <secs>. Default is 60s.\n"
"\n"
" -A, --test-adapter Test the CEC adapter API\n"
" --test-core Test the core functionality\n"
@@ -1118,6 +1122,9 @@ int main(int argc, char **argv)
case OptReplyThreshold:
reply_threshold = strtoul(optarg, NULL, 0);
break;
+ case OptTimeout:
+ long_timeout = strtoul(optarg, NULL, 0);
+ break;
case OptNoWarnings:
show_warnings = false;
break;
diff --git a/utils/cec-compliance/cec-compliance.h b/utils/cec-compliance/cec-compliance.h
index 31449b46..d0494192 100644
--- a/utils/cec-compliance/cec-compliance.h
+++ b/utils/cec-compliance/cec-compliance.h
@@ -122,6 +122,7 @@ extern bool show_info;
extern bool show_warnings;
extern unsigned warnings;
extern unsigned reply_threshold;
+extern unsigned long_timeout;
struct remote {
bool recognized_op[256];
diff --git a/utils/cec-compliance/cec-test-power.cpp b/utils/cec-compliance/cec-test-power.cpp
index 43067341..0f320ed2 100644
--- a/utils/cec-compliance/cec-test-power.cpp
+++ b/utils/cec-compliance/cec-test-power.cpp
@@ -256,10 +256,10 @@ static bool wait_changing_power_status(struct node *node, unsigned me, unsigned
{
__u8 old_status;
- announce("Checking for power status change. This may take up to 60 s.");
+ announce("Checking for power status change. This may take up to %u s.", long_timeout);
if (!get_power_status(node, me, la, old_status))
return false;
- for (unsigned i = 0; i < 60 / SLEEP_POLL_POWER_STATUS; i++) {
+ for (unsigned i = 0; i < long_timeout / SLEEP_POLL_POWER_STATUS; i++) {
__u8 power_status;
if (!get_power_status(node, me, la, power_status)) {
@@ -285,8 +285,8 @@ static bool poll_stable_power_status(struct node *node, unsigned me, unsigned la
/* Some devices can use several seconds to transition from one power
state to another, so the power state must be repeatedly polled */
- announce("Waiting for new stable power status. This may take up to 60 s.");
- for (unsigned tries = 0; tries < 60 / SLEEP_POLL_POWER_STATUS; tries++) {
+ announce("Waiting for new stable power status. This may take up to %u s.", long_timeout);
+ for (unsigned tries = 0; tries < long_timeout / SLEEP_POLL_POWER_STATUS; tries++) {
__u8 power_status;
if (!get_power_status(node, me, la, power_status)) {
diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp
index 3d78bfd1..d68da5ef 100644
--- a/utils/cec-compliance/cec-test.cpp
+++ b/utils/cec-compliance/cec-test.cpp
@@ -477,17 +477,17 @@ static int routing_control_set_stream_path(struct node *node, unsigned me, unsig
__u16 phys_addr;
/* Send Set Stream Path with the remote physical address. We expect the
- source to eventually send Active Source. The timeout of 60 seconds is
- necessary because the device might have to wake up from standby.
+ source to eventually send Active Source. The timeout of long_timeout
+ seconds is necessary because the device might have to wake up from standby.
In CEC 2.0 it is mandatory for sources to send Active Source. */
if (is_tv(la, node->remote[la].prim_type))
interactive_info(true, "Please ensure that the device is in standby.");
- announce("Sending Set Stream Path and waiting for reply. This may take up to 60 s.");
+ announce("Sending Set Stream Path and waiting for reply. This may take up to %u s.", long_timeout);
cec_msg_init(&msg, me, la);
cec_msg_set_stream_path(&msg, node->remote[la].phys_addr);
msg.reply = CEC_MSG_ACTIVE_SOURCE;
- fail_on_test(!transmit_timeout(node, &msg, 60000));
+ fail_on_test(!transmit_timeout(node, &msg, long_timeout * 1000));
if (timed_out(&msg) && is_tv(la, node->remote[la].prim_type))
return NOTSUPPORTED;
if (timed_out(&msg) && node->remote[la].cec_version < CEC_OP_CEC_VERSION_2_0) {

Privacy Policy