cec: set to 'not present' on failed ack
authorLars Op den Kamp <lars@opdenkamp.eu>
Tue, 6 Dec 2011 15:53:38 +0000 (16:53 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Tue, 6 Dec 2011 15:53:38 +0000 (16:53 +0100)
src/lib/CECProcessor.cpp
src/testclient/main.cpp

index 52023e53f56cbae9e735314eb2883fba376cd90c..7f4f366c04776188628924418f3fb743ebb11689 100644 (file)
@@ -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;
 }
 
index 9d40c39dc1b7bc180659a81ce9086b77cb1b80ee..7837c12a6a970554a7b569a52e069a78065fd426 100644 (file)
@@ -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;