From: Lars Op den Kamp Date: Fri, 14 Oct 2011 08:13:10 +0000 (+0200) Subject: cec: set initiator and destination first in cec_command::push_back(). fixes 'tx'... X-Git-Tag: upstream/2.2.0~1^2~234 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=b2da27686d4fa820f7f17d25a804450fa02f4dd2;p=deb_libcec.git cec: set initiator and destination first in cec_command::push_back(). fixes 'tx' command in cec-client --- diff --git a/include/cectypes.h b/include/cectypes.h index 196eed9..e5b7791 100644 --- a/include/cectypes.h +++ b/include/cectypes.h @@ -660,7 +660,12 @@ typedef struct cec_command void push_back(uint8_t data) { - if (!opcode_set) + if (initiator == CECDEVICE_UNKNOWN && destination == CECDEVICE_UNKNOWN) + { + initiator = (cec_logical_address) (data >> 4); + destination = (cec_logical_address) (data & 0xF); + } + else if (!opcode_set) { opcode_set = 1; opcode = (cec_opcode) data; diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 93f11e6..1b86820 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -439,7 +439,7 @@ bool CCECProcessor::ParseMessage(cec_adapter_message &msg) if (msg.size() >= 2) { logStr.AppendFormat(" initiator:%u destination:%u ack:%s %s", msg.initiator(), msg.destination(), msg.ack() ? "high" : "low", msg.eom() ? "eom" : ""); - m_currentframe.initiator = msg.initiator(); + m_currentframe.initiator = msg.initiator(); m_currentframe.destination = msg.destination(); m_currentframe.ack = msg.ack(); m_currentframe.eom = msg.eom(); diff --git a/src/testclient/main.cpp b/src/testclient/main.cpp index 817d267..33ee463 100644 --- a/src/testclient/main.cpp +++ b/src/testclient/main.cpp @@ -286,7 +286,7 @@ int main (int argc, char *argv[]) bytes.clear(); while (GetWord(input, strvalue) && HexStrToInt(strvalue, ivalue)) - bytes.push_back(ivalue); + bytes.push_back(ivalue); parser->Transmit(bytes); }