aboutsummaryrefslogtreecommitdiffstats
path: root/utils/cec-follower/cec-processing.cpp
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2020-09-08 16:16:44 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2020-09-08 16:16:44 +0200
commit364da216e3f8750b037fde0f83d64ced0f94a1aa (patch)
treea7d9c12bcbe4f512839b8e645028e3d9f7a20747 /utils/cec-follower/cec-processing.cpp
parent79918a591a9ad362f107795ee4046d39e6dfcb67 (diff)
cec-follower: add --standby and --toggle-power-status
Add the --standby option to start the follower with the device in Standby status. Add the --toggle-power-status <secs> option to let the follower toggle the emulated power status every <secs> seconds. This helps testing power status transtions. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'utils/cec-follower/cec-processing.cpp')
-rw-r--r--utils/cec-follower/cec-processing.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/utils/cec-follower/cec-processing.cpp b/utils/cec-follower/cec-processing.cpp
index 074e245d..e5021aa3 100644
--- a/utils/cec-follower/cec-processing.cpp
+++ b/utils/cec-follower/cec-processing.cpp
@@ -871,6 +871,7 @@ void testProcessing(struct node *node, bool wallclock)
unsigned me;
unsigned last_poll_la = 15;
__u8 last_pwr_state = current_power_state(node);
+ time_t last_pwr_status_toggle = time(NULL);
clock_gettime(CLOCK_MONOTONIC, &start_monotonic);
gettimeofday(&start_timeofday, NULL);
@@ -972,6 +973,15 @@ void testProcessing(struct node *node, bool wallclock)
last_pwr_state = pwr_state;
}
+ if (node->state.toggle_power_status && cec_has_tv(1 << me) &&
+ (time(NULL) - last_pwr_status_toggle > node->state.toggle_power_status)) {
+ last_pwr_status_toggle = time(NULL);
+ if (pwr_state & 1) // standby or to-standby
+ exit_standby(node);
+ else
+ enter_standby(node);
+ }
+
__u64 ts_now = get_ts();
unsigned poll_la = ts_to_s(ts_now) % 16;

Privacy Policy