aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2020-09-11 10:41:37 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2020-09-11 10:41:37 +0200
commitc3bff22b2cdd9027a28421553d8a19a9df37ebaf (patch)
tree408895d9901462a1985abd57d45621c44f74aee9
parent7e8b5ce6318d6ba59a6947d0070d568c90afdf80 (diff)
cec-ctl: don't spam log with PA changes unless paused
When a thread is started to poll for EDID changes, then that thread was logging the new Physical Address whenever it changed, but that messed up the logging of e.g. --stress-test-power-cycle. So now only log PA changes if the main thread is paused since that's when nothing else is happening. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--utils/cec-ctl/cec-ctl.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index df79d785..8fe1c528 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -38,6 +38,7 @@ static struct timespec start_monotonic;
static struct timeval start_timeofday;
static bool ignore_la[16];
static const char *edid_path;
+static bool is_paused;
#define POLL_FAKE_OPCODE 256
static unsigned short ignore_opcode[257];
@@ -1756,15 +1757,9 @@ static void *thread_edid_poll(void *arg)
fd = open(edid_path, O_RDONLY);
if (fd < 0)
std::exit(EXIT_FAILURE);
- lseek(fd, 0, SEEK_SET);
- has_edid = read(fd, &dummy, 1) > 0;
- if (!has_edid)
- phys_addr = CEC_PHYS_ADDR_INVALID;
- else
- phys_addr = parse_phys_addr_from_edid(edid_path);
- doioctl(node, CEC_ADAP_S_PHYS_ADDR, &phys_addr);
- printf("Physical Address: %x.%x.%x.%x\n", cec_phys_addr_exp(phys_addr));
+ doioctl(node, CEC_ADAP_G_PHYS_ADDR, &phys_addr);
+ has_edid = phys_addr != CEC_PHYS_ADDR_INVALID;
for (;;) {
bool edid;
@@ -1780,8 +1775,9 @@ static void *thread_edid_poll(void *arg)
else
phys_addr = parse_phys_addr_from_edid(edid_path);
doioctl(node, CEC_ADAP_S_PHYS_ADDR, &phys_addr);
- printf("Physical Address: %x.%x.%x.%x\n",
- cec_phys_addr_exp(phys_addr));
+ if (is_paused)
+ printf("Physical Address: %x.%x.%x.%x\n",
+ cec_phys_addr_exp(phys_addr));
}
}
return NULL;
@@ -2725,6 +2721,7 @@ skip_la:
wait_for_msgs(node, monitor_time);
} else if (options[OptPhysAddrFromEDIDPoll]) {
printf("Press Ctrl-C to stop EDID polling.\n");
+ is_paused = true;
pause();
}
fflush(stdout);

Privacy Policy