diff options
author | Hans Verkuil <hansverk@cisco.com> | 2018-02-27 13:49:16 +0100 |
---|---|---|
committer | Hans Verkuil <hansverk@cisco.com> | 2018-02-27 13:49:16 +0100 |
commit | c969495f2788837134ceda5b7a68bc0d4d10f8d0 (patch) | |
tree | b2e8a8d2b78ef9c1e8d4ce1f58ac27d4402715c0 | |
parent | beec9a8d3c02f695bc541549772ffaacf71c3ab1 (diff) |
cec-ctl: ACK vs NACK was inverted for broadcast msgs
How to interpret the ACK bit depends on whether it was a directed
or broadcast message. But the code has the order wrong:
bool ack = !(bcast ^ bit);
if (byte_cnt == 0) {
bcast = (byte & 0xf) == 0xf;
The 'ack' assignment should be done after the 'bcast =' assignment.
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
-rw-r--r-- | utils/cec-ctl/cec-pin.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/utils/cec-ctl/cec-pin.cpp b/utils/cec-ctl/cec-pin.cpp index 1e2e0a62..ea842b34 100644 --- a/utils/cec-ctl/cec-pin.cpp +++ b/utils/cec-ctl/cec-pin.cpp @@ -198,7 +198,6 @@ static void cec_pin_rx_data_bit_was_high(bool is_high, __u64 ev_ts, eom = bit; } else { std::string s; - bool ack = !(bcast ^ bit); if (byte_cnt == 0) { bcast = (byte & 0xf) == 0xf; @@ -209,6 +208,9 @@ static void cec_pin_rx_data_bit_was_high(bool is_high, __u64 ev_ts, } else if (cdc && byte_cnt == 4) { s = find_cdc_opcode_name(byte); } + + bool ack = !(bcast ^ bit); + if (show) printf("%s: rx 0x%02x%s%s%s%s%s\n", ts2s(ts).c_str(), byte, eom ? " EOM" : "", ack ? " ACK" : " NACK", |