diff options
author | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2022-03-03 09:37:30 +0100 |
---|---|---|
committer | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2022-03-03 09:37:30 +0100 |
commit | 467102b5f285d16c5facefb924f63c11de88569a (patch) | |
tree | 961186a26ddb825658d0d926da3f6e08c58b117e | |
parent | 40a51ea5538182d7c3856ece1c75c7ebca967a84 (diff) | |
download | v4l-utils-467102b5f285d16c5facefb924f63c11de88569a.tar.gz |
cec-ctl: fix timestamp log for HPD/5V changes
The timestamp format for HPD and 5V changes was slightly different
compared to CEC changes. Make them consistent to improve readability
of the logs.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r-- | utils/cec-ctl/cec-ctl.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp index 2866fc8a..20207842 100644 --- a/utils/cec-ctl/cec-ctl.cpp +++ b/utils/cec-ctl/cec-ctl.cpp @@ -471,19 +471,26 @@ static void log_event(struct cec_event &ev, bool show) { bool is_high = ev.event == CEC_EVENT_PIN_CEC_HIGH; bool is_initial = ev.flags & CEC_EVENT_FL_INITIAL_STATE; + bool is_pin_event = false; __u16 pa; if (ev.event != CEC_EVENT_PIN_CEC_LOW && ev.event != CEC_EVENT_PIN_CEC_HIGH && ev.event != CEC_EVENT_PIN_HPD_LOW && ev.event != CEC_EVENT_PIN_HPD_HIGH && ev.event != CEC_EVENT_PIN_5V_LOW && ev.event != CEC_EVENT_PIN_5V_HIGH) printf("\n"); + else + is_pin_event = true; if ((ev.flags & CEC_EVENT_FL_DROPPED_EVENTS) && show) printf("(warn: %s events were lost)\n", event2s(ev.event)); if (show) { - if (is_initial) + if (is_initial) { printf("Initial "); - else if (ev.event != CEC_EVENT_PIN_CEC_LOW && ev.event != CEC_EVENT_PIN_CEC_HIGH) - printf("%s: ", ts2s(ev.ts).c_str()); + } else if (ev.event != CEC_EVENT_PIN_CEC_LOW && ev.event != CEC_EVENT_PIN_CEC_HIGH) { + if (is_pin_event) + printf("%s: ", ts2s(ev.ts / 1000000000.0).c_str()); + else + printf("%s: ", ts2s(ev.ts).c_str()); + } } switch (ev.event) { |