This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:

Subject: cec-ctl: improve analysis while waiting for start bit
Author:  Hans Verkuil <hans.verk...@cisco.com>
Date:    Wed Mar 7 09:19:55 2018 +0100

If there was a bit error then the analyzer will wait for a start bit
to re-sync. While in that state check if the received pulse looks like
a data bit and log it accordingly. This streamlines the output and
makes it easier to parse such spurious data bits.

Signed-off-by: Hans Verkuil <hans.verk...@cisco.com>

 utils/cec-ctl/cec-pin.cpp | 47 ++++++++++++++++++++---------------------------
 1 file changed, 20 insertions(+), 27 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=93dc5f20727fede5097d67f8b9adabe4b8046d5b
diff --git a/utils/cec-ctl/cec-pin.cpp b/utils/cec-ctl/cec-pin.cpp
index 99f7fd1f33f7..ce713dc389c0 100644
--- a/utils/cec-ctl/cec-pin.cpp
+++ b/utils/cec-ctl/cec-pin.cpp
@@ -162,13 +162,7 @@ static void cec_pin_rx_start_bit_was_low(__u64 ev_ts, 
__u64 usecs, __u64 usecs_m
                state = CEC_ST_IDLE;
                return;
        }
-       if (usecs < CEC_TIM_START_BIT_LOW_MIN - CEC_TIM_MARGIN && show)
-               printf("%s: info: start bit: low time too short (%.2f < %.2f 
ms)\n",
-                       ts2s(ts).c_str(), usecs / 1000.0,
-                       CEC_TIM_START_BIT_LOW_MIN / 1000.0);
        if (usecs_min < CEC_TIM_START_BIT_LOW_MIN - CEC_TIM_MARGIN * 6) {
-               if (show)
-                       printf("\n");
                state = CEC_ST_IDLE;
                return;
        }
@@ -363,44 +357,43 @@ void log_event_pin(bool is_high, __u64 ev_ts, bool show)
                        return;
        }
        if (verbose && show) {
+               double delta = (ev_ts - last_change_ts) / 1000000.0;
+
+               if (!was_high && last_change_ts && state == 
CEC_ST_RECEIVE_START_BIT &&
+                   delta * 1000 >= CEC_TIM_START_BIT_LOW_MIN - CEC_TIM_MARGIN)
+                       printf("\n");
                printf("%s: ", ts2s(ts).c_str());
                if (last_change_ts && is_high && was_high &&
                    (ev_ts - last_1_to_0_ts) / 1000000 <= 10)
                        printf("1 -> 1 (was 1 for %.2f ms, period of previous 
%spulse %.2f ms)\n",
-                              (ev_ts - last_change_ts) / 1000000.0,
-                              state == CEC_ST_RECEIVE_START_BIT ? "start " : 
"",
+                              delta, state == CEC_ST_RECEIVE_START_BIT ? 
"start " : "",
                               (ev_ts - last_1_to_0_ts) / 1000000.0);
                else if (last_change_ts && is_high && was_high)
-                       printf("1 -> 1 (%.2f ms)\n",
-                              (ev_ts - last_change_ts) / 1000000.0);
+                       printf("1 -> 1 (%.2f ms)\n", delta);
                else if (was_high && state == CEC_ST_IDLE) {
                        if (bit_periods > 1 && bit_periods < 10)
                                printf("1 -> 0 (was 1 for %.2f ms, free signal 
time = %.1f bit periods)\n",
-                                      (ev_ts - last_change_ts) / 1000000.0, 
bit_periods);
+                                      delta, bit_periods);
                        else
-                               printf("1 -> 0 (was 1 for %.2f ms)\n",
-                                      (ev_ts - last_change_ts) / 1000000.0);
+                               printf("1 -> 0 (was 1 for %.2f ms)\n", delta);
                } else if (was_high && (ev_ts - last_1_to_0_ts) / 1000000 <= 10)
                        printf("1 -> 0 (was 1 for %.2f ms, period of previous 
%spulse %.2f ms)\n",
-                              (ev_ts - last_change_ts) / 1000000.0,
-                              state == CEC_ST_RECEIVE_START_BIT ? "start " : 
"",
+                              delta, state == CEC_ST_RECEIVE_START_BIT ? 
"start " : "",
                               (ev_ts - last_1_to_0_ts) / 1000000.0);
                else if (was_high)
-                       printf("1 -> 0 (was 1 for %.2f ms)\n",
-                              (ev_ts - last_change_ts) / 1000000.0);
+                       printf("1 -> 0 (was 1 for %.2f ms)\n", delta);
+               else if (last_change_ts && state == CEC_ST_RECEIVE_START_BIT &&
+                        delta * 1000 < CEC_TIM_START_BIT_LOW_MIN - 
CEC_TIM_MARGIN)
+                       printf("0 -> 1 (was 0 for %.2f ms, might indicate %d 
bit)\n", delta,
+                              delta * 1000 < CEC_TIM_DATA_BIT_1_LOW_MAX + 
CEC_TIM_MARGIN);
                else if (last_change_ts && state == CEC_ST_RECEIVE_START_BIT)
-                       printf("0 -> 1 (was 0 for %.2f ms)\n",
-                              (ev_ts - last_change_ts) / 1000000.0);
+                       printf("0 -> 1 (was 0 for %.2f ms)\n", delta);
                else if (last_change_ts &&
-                        (ev_ts - last_change_ts) / 1000 >=
-                         CEC_TIM_LOW_DRIVE_ERROR_MIN - CEC_TIM_MARGIN)
-                       printf("0 -> 1 (was 0 for %.2f ms, warn: indicates low 
drive)\n",
-                              (ev_ts - last_change_ts) / 1000000.0);
+                        delta * 1000 >= CEC_TIM_LOW_DRIVE_ERROR_MIN - 
CEC_TIM_MARGIN)
+                       printf("0 -> 1 (was 0 for %.2f ms, warn: indicates low 
drive)\n", delta);
                else if (last_change_ts)
-                       printf("0 -> 1 (was 0 for %.2f ms, indicates %d bit)\n",
-                              (ev_ts - last_change_ts) / 1000000.0,
-                              (ev_ts - last_change_ts) / 1000 <
-                               CEC_TIM_DATA_BIT_1_LOW_MAX + CEC_TIM_MARGIN);
+                       printf("0 -> 1 (was 0 for %.2f ms, indicates %d 
bit)\n", delta,
+                              delta * 1000 < CEC_TIM_DATA_BIT_1_LOW_MAX + 
CEC_TIM_MARGIN);
                else
                        printf("0 -> 1\n");
        } else if (!is_high && bit_periods > 1 && bit_periods < 10 && show) {

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to