From: Lars Op den Kamp Date: Tue, 6 Dec 2011 15:53:38 +0000 (+0100) Subject: cec: set to 'not present' on failed ack X-Git-Tag: upstream/2.2.0~1^2~44^2~31 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=90ea9066b2b0d23b3c05e7267bfab4f2a1d4a6e2;p=deb_libcec.git cec: set to 'not present' on failed ack --- diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 52023e5..7f4f366 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -314,7 +314,7 @@ bool CCECProcessor::SetActiveSource(cec_device_type type /* = CEC_DEVICE_TYPE_RE if (type != CEC_DEVICE_TYPE_RESERVED) { - for (uint8_t iPtr = 0; iPtr < 16; iPtr++) + for (uint8_t iPtr = 0; iPtr <= 11; iPtr++) { if (m_logicalAddresses[iPtr] && m_busDevices[iPtr]->m_type == type) { @@ -680,8 +680,13 @@ bool CCECProcessor::Transmit(const cec_command &data) CCECAdapterMessage *output = new CCECAdapterMessage(data); bReturn = Transmit(output); - delete output; + /* set to "not present" on failed ack */ + if (output->is_error() && output->reply == MSGCODE_TRANSMIT_FAILED_ACK && + output->destination() != CECDEVICE_BROADCAST) + m_busDevices[output->destination()]->SetDeviceStatus(CEC_DEVICE_STATUS_NOT_PRESENT); + + delete output; return bReturn; } diff --git a/src/testclient/main.cpp b/src/testclient/main.cpp index 9d40c39..7837c12 100644 --- a/src/testclient/main.cpp +++ b/src/testclient/main.cpp @@ -609,7 +609,7 @@ bool ProcessCommandLAD(ICECAdapter *parser, const string &command, string &argum { cout << "listing active devices:" << endl; cec_logical_addresses addresses = parser->GetActiveDevices(); - for (uint8_t iPtr = 0; iPtr < 16; iPtr++) + for (uint8_t iPtr = 0; iPtr <= 11; iPtr++) if (addresses[iPtr]) cout << "logical address " << (int)iPtr << endl; return true;