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: fix pin analysis bug
Author:  Hans Verkuil <hans.verk...@cisco.com>
Date:    Thu Aug 3 23:56:45 2017 +0200

The transition between a NACKed byte and a start bit was not handled
correctly, cause incorrect 'low drive' errors.

Also fix a bug where the last bit of the pin recording file was not
processed.

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

 utils/cec-ctl/cec-ctl.cpp | 6 +++++-
 utils/cec-ctl/cec-pin.cpp | 6 +++---
 2 files changed, 8 insertions(+), 4 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=4e234b854f194eb118b476e0c76b56e4af89d5ff
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index ba185f9d136a..80ca016344e9 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -1634,6 +1634,7 @@ static void monitor(struct node &node, __u32 
monitor_time, const char *store_pin
 static void analyze(const char *analyze_pin)
 {
        FILE *fanalyze = fopen(analyze_pin, "r");
+       struct cec_event ev = { };
        unsigned long tv_sec, tv_nsec, tv_usec;
        unsigned version;
        unsigned log_addr_mask;
@@ -1682,7 +1683,6 @@ static void analyze(const char *analyze_pin)
        printf("Logical Address Mask: 0x%04x\n\n", log_addr_mask);
 
        while (fgets(s, sizeof(s), fanalyze)) {
-               struct cec_event ev = { };
                unsigned high;
 
                if (sscanf(s, "%lu.%09lu %d\n", &tv_sec, &tv_nsec, &high) != 3 
|| high > 1) {
@@ -1695,6 +1695,10 @@ static void analyze(const char *analyze_pin)
                line++;
        }
 
+       tv_sec++;
+       ev.ts = tv_sec * 1000000000ULL + tv_nsec;
+       log_event(ev);
+
        fclose(fanalyze);
        return;
 
diff --git a/utils/cec-ctl/cec-pin.cpp b/utils/cec-ctl/cec-pin.cpp
index 6b40339b9d8a..b6df381000d1 100644
--- a/utils/cec-ctl/cec-pin.cpp
+++ b/utils/cec-ctl/cec-pin.cpp
@@ -193,7 +193,7 @@ static void cec_pin_rx_data_bit_was_high(bool is_high, 
__u64 ev_ts, __u64 usecs,
                        s = find_cdc_opcode_name(byte);
                }
                printf("%10.06f: rx 0x%02x%s%s%s (%s) %s\n",
-                      (ev_ts / 1000 - usecs) / 1000000.0, byte,
+                      (ev_ts / 1000 - usecs - low_usecs + 
CEC_TIM_DATA_BIT_TOTAL) / 1000000.0, byte,
                       eom ? " EOM" : "", (bcast ^ bit) ? " NACK" : " ACK",
                       bcast ? " (broadcast)" : "",
                       ts2s(ev_ts - usecs * 1000).c_str(),
@@ -210,7 +210,7 @@ static void cec_pin_rx_data_bit_was_high(bool is_high, 
__u64 ev_ts, __u64 usecs,
                if ((!eom && ack) && low_usecs + usecs_min > 
CEC_TIM_DATA_BIT_TOTAL_MAX)
                        printf("%10.06f: data bit %d total time too long (%.2f 
ms)\n",
                                ts, rx_bit - 1, (low_usecs + usecs_min) / 
1000.0);
-               if (eom || is_high)
+               if (eom || is_high || low_usecs + usecs_min > 
CEC_TIM_DATA_BIT_TOTAL_MAX)
                        state = is_high ? CEC_ST_IDLE : 
CEC_ST_RECEIVE_START_BIT;
                if (state == CEC_ST_IDLE)
                        printf("\n");
@@ -322,6 +322,7 @@ void log_event_pin(bool is_high, __u64 ev_ts)
                if (is_high)
                        return;
        }
+       cec_pin_debug(ev_ts, (ev_ts - last_ts) / 1000, was_high, is_high);
        if (show_info) {
                printf("%10.06f: ", ts);
                if (last_change_ts && is_high && was_high)
@@ -342,7 +343,6 @@ void log_event_pin(bool is_high, __u64 ev_ts)
                if (!is_high)
                        last_1_to_0_ts = ev_ts;
        }
-       cec_pin_debug(ev_ts, (ev_ts - last_ts) / 1000, was_high, is_high);
        if (!is_high) {
                float usecs = (ev_ts - last_ts) / 1000;
                unsigned periods = usecs / CEC_TIM_DATA_BIT_TOTAL;

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

Reply via email to