cec: be a bit more verbose when initialising
authorLars Op den Kamp <lars@opdenkamp.eu>
Sun, 4 Dec 2011 20:21:57 +0000 (21:21 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Sun, 4 Dec 2011 20:21:57 +0000 (21:21 +0100)
src/lib/CECProcessor.cpp
src/lib/CECProcessor.h
src/lib/implementations/SLCommandHandler.cpp
src/testclient/main.cpp

index dfdb737da3aeab2f126600bc6bebe11a29d6e514..8e761b10e4b3edaf50fc633b475a9e568556be1e 100644 (file)
@@ -154,14 +154,18 @@ bool CCECProcessor::Start(const char *strPort, uint16_t iBaudRate /* = 38400 */,
     if (SetAckMask(m_logicalAddresses.AckMask()) &&
         SetHDMIPort(m_iBaseDevice, m_iHDMIPort, true))
     {
+      m_controller->AddLog(CEC_LOG_ERROR, "processor thread started");
       m_busScan = new CCECBusScan(this);
       m_busScan->CreateThread(true);
       return true;
     }
+    else
+    {
+      m_controller->AddLog(CEC_LOG_ERROR, "failed to initialise the processor");
+    }
   }
-  else
-    m_controller->AddLog(CEC_LOG_ERROR, "could not create a processor thread");
 
+  m_controller->AddLog(CEC_LOG_ERROR, "could not create a processor thread");
   return false;
 }
 
@@ -401,7 +405,7 @@ bool CCECProcessor::SetHDMIPort(cec_logical_address iBaseDevice, uint8_t iPort,
     iPhysicalAddress += (uint16_t)(iPort * iPos);
     strLog.Format("checking physical address %4x", iPhysicalAddress);
     AddLog(CEC_LOG_DEBUG, strLog);
-    if (CheckPhysicalAddress(iPhysicalAddress))
+    if (PhysicalAddressInUse(iPhysicalAddress))
     {
       strLog.Format("physical address %4x is in use", iPhysicalAddress);
       AddLog(CEC_LOG_DEBUG, strLog);
@@ -409,6 +413,8 @@ bool CCECProcessor::SetHDMIPort(cec_logical_address iBaseDevice, uint8_t iPort,
     }
     else
     {
+      strLog.Format("physical address %4x is free", iPhysicalAddress);
+      AddLog(CEC_LOG_DEBUG, strLog);
       SetPhysicalAddress(iPhysicalAddress);
       bReturn = true;
     }
@@ -417,7 +423,7 @@ bool CCECProcessor::SetHDMIPort(cec_logical_address iBaseDevice, uint8_t iPort,
   return bReturn;
 }
 
-bool CCECProcessor::CheckPhysicalAddress(uint16_t iPhysicalAddress)
+bool CCECProcessor::PhysicalAddressInUse(uint16_t iPhysicalAddress)
 {
   for (unsigned int iPtr = 0; iPtr < 15; iPtr++)
   {
index 82dc1499f5f25573856a51577c80463627e44923..052dc993834a62d1b656ba30d33d4ec75580efd6 100644 (file)
@@ -126,7 +126,7 @@ namespace CEC
 
   private:
       void ScanCECBus(void);
-      bool CheckPhysicalAddress(uint16_t iPhysicalAddress);
+      bool PhysicalAddressInUse(uint16_t iPhysicalAddress);
       bool TryLogicalAddress(cec_logical_address address);
       bool FindLogicalAddressRecordingDevice(void);
       bool FindLogicalAddressTuner(void);
index 197db43fdef7cb6fcd9c6b6746b3a38c6086fae8..76007cc2f4f587c15c9ff58de7c31c131816cb31 100644 (file)
@@ -85,7 +85,8 @@ bool CSLCommandHandler::HandleVendorCommand(const cec_command &command)
   else if (command.parameters.size == 1 &&
       command.parameters[0] == SL_COMMAND_REQUEST_VENDOR_ID)
   {
-    TransmitLGVendorId(m_busDevice->GetProcessor()->GetLogicalAddresses().primary, CECDEVICE_BROADCAST);
+//    if (command.destination != CECDEVICE_BROADCAST)
+//      m_busDevice->GetProcessor()->m_busDevices[m_busDevice->GetProcessor()->GetLogicalAddresses().primary]->TransmitPowerState(command.initiator);
     return true;
   }
 
@@ -156,6 +157,10 @@ bool CSLCommandHandler::HandleCommand(const cec_command &command)
           m_bSkipNextVendorId = true;
           TransmitLGVendorId(m_busDevice->GetProcessor()->GetLogicalAddresses().primary, CECDEVICE_BROADCAST);
         }
+        else
+        {
+          m_bSkipNextVendorId = false;
+        }
         m_bSLEnabled = false;
       }
       bHandled = true;
index 0ac1c714633b225bf7b263d2491dfd8ab3afaaee..9d40c39dc1b7bc180659a81ce9086b77cb1b80ee 100644 (file)
@@ -997,6 +997,7 @@ int main (int argc, char *argv[])
 
   if (!g_bSingleCommand)
   {
+    FlushLog(parser);
     cout << "cec device opened" << endl;
 
     parser->PowerOnDevices(CECDEVICE_TV);