fixed: physical address was not printed correctly in CUSBCECAdapterCommunication...
[deb_libcec.git] / src / testclient / main.cpp
index dde998014b212078277dbe1d95d90bbcbc3608c6..964cf68384b1d224a881466164ffb09a38186b5e 100644 (file)
@@ -180,6 +180,7 @@ void EnableCallbacks(ICECAdapter *adapter)
   g_callbacks.CBCecLogMessage = &CecLogMessage;
   g_callbacks.CBCecKeyPress   = &CecKeyPress;
   g_callbacks.CBCecCommand    = &CecCommand;
+  g_callbacks.CBCecConfigurationChanged = NULL;
   adapter->EnableCallbacks(NULL, &g_callbacks);
 }
 
@@ -213,6 +214,7 @@ void ShowHelpCommandLine(const char* strExec)
       "  -b --base {int}             The logical address of the device to with this " << endl <<
       "                              adapter is connected." << endl <<
       "  -f --log-file {file}        Writes all libCEC log message to a file" << endl <<
+      "  -r --rom                    Read persisted settings from the EEPROM" << endl <<
       "  -sf --short-log-file {file} Writes all libCEC log message without timestamps" << endl <<
       "                              and log levels to a file." << endl <<
       "  -d --log-level {level}      Sets the log level. See cectypes.h for values." << endl <<
@@ -974,6 +976,11 @@ bool ProcessCommandLineArguments(int argc, char *argv[])
         }
         bReturn = false;
       }
+      else if (!strcmp(argv[iArgPtr], "--bootloader"))
+      {
+        LibCecBootloader();
+        bReturn = false;
+      }
       else if (!strcmp(argv[iArgPtr], "--single-command") ||
           !strcmp(argv[iArgPtr], "-s"))
       {
@@ -1008,6 +1015,13 @@ bool ProcessCommandLineArguments(int argc, char *argv[])
         }
         ++iArgPtr;
       }
+      else if (!strcmp(argv[iArgPtr], "-r") ||
+               !strcmp(argv[iArgPtr], "--rom"))
+      {
+        cout << "using settings from EEPROM" << endl;
+        g_config.bGetSettingsFromROM = 1;
+        ++iArgPtr;
+      }
       else
       {
         g_strPort = argv[iArgPtr++];
@@ -1022,12 +1036,12 @@ int main (int argc, char *argv[])
 {
   g_config.Clear();
   snprintf(g_config.strDeviceName, 13, "CECTester");
-  g_config.callbackParam      = NULL;
-  g_config.clientVersion      = CEC_CLIENT_VERSION_1_5_0;
-  g_callbacks.CBCecLogMessage = &CecLogMessage;
-  g_callbacks.CBCecKeyPress   = &CecKeyPress;
-  g_callbacks.CBCecCommand    = &CecCommand;
-  g_config.callbacks          = &g_callbacks;
+  g_config.callbackParam       = NULL;
+  g_config.clientVersion       = CEC_CLIENT_VERSION_1_5_0;
+  g_callbacks.CBCecLogMessage  = &CecLogMessage;
+  g_callbacks.CBCecKeyPress    = &CecKeyPress;
+  g_callbacks.CBCecCommand     = &CecCommand;
+  g_config.callbacks           = &g_callbacks;
 
   if (!ProcessCommandLineArguments(argc, argv))
     return 0;
@@ -1057,7 +1071,7 @@ int main (int argc, char *argv[])
   if (!g_bSingleCommand)
   {
     CStdString strLog;
-    strLog.Format("CEC Parser created - libcec version %d.%d", parser->GetLibVersionMajor(), parser->GetLibVersionMinor());
+    strLog.Format("CEC Parser created - libCEC version %s", parser->ToString((cec_server_version)g_config.serverVersion));
     cout << strLog.c_str() << endl;
 
     //make stdin non-blocking
@@ -1103,14 +1117,7 @@ int main (int argc, char *argv[])
   }
 
   if (!g_bSingleCommand)
-  {
-    PrintToStdOut("cec device opened");
-
-    parser->PowerOnDevices(CECDEVICE_TV);
-    parser->SetActiveSource();
-
     PrintToStdOut("waiting for input");
-  }
 
   while (!g_bExit && !g_bHardExit)
   {
@@ -1127,12 +1134,9 @@ int main (int argc, char *argv[])
       g_bExit = true;
 
     if (!g_bExit && !g_bHardExit)
-      CCondition::Sleep(50);
+      CEvent::Sleep(50);
   }
 
-  if (!g_bSingleCommand && !g_bHardExit)
-    parser->StandbyDevices(CECDEVICE_BROADCAST);
-
   parser->Close();
   UnloadLibCec(parser);