cec: added GetDeviceVendorId()/cec_get_device_vendor_id()
[deb_libcec.git] / src / testclient / main.cpp
index 3117ee689d5564e20e30d71f06c361a948db5742..38f6b5bd8eaaba8832890680da9e27d7325a827f 100644 (file)
@@ -221,7 +221,10 @@ void show_console_help(void)
   "ver {addr}                get the CEC version of the specified device." << endl <<
   "[ver 0]                   get the CEC version of the TV" << endl <<
   endl <<
-  "lang {addr                get the menu language of the specified device." << endl <<
+  "ven {addr}                get the vendor ID of the specified device." << endl <<
+  "[ven 0]                   get the vendor ID of the TV" << endl <<
+  endl <<
+  "lang {addr}               get the menu language of the specified device." << endl <<
   "[lang 0]                  get the menu language of the TV" << endl <<
   endl <<
   "[mon] {1|0}               enable or disable CEC bus monitoring." << endl <<
@@ -391,6 +394,10 @@ int main (int argc, char *argv[])
   {
     flush_log(parser);
 
+    /* just ignore the command buffer and clear it */
+    cec_command dummy;
+    while (parser && parser->GetNextCommand(&dummy)) {}
+
     string input;
     getline(cin, input);
     cin.clear();
@@ -513,6 +520,21 @@ int main (int argc, char *argv[])
             }
           }
         }
+        else if (command == "ven")
+        {
+          CStdString strDev;
+          if (GetWord(input, strDev))
+          {
+            int iDev = atoi(strDev);
+            if (iDev >= 0 && iDev < 15)
+            {
+              uint64_t iVendor = parser->GetDeviceVendorId((cec_logical_address) iDev);
+              CStdString strLog;
+              strLog.Format("vendor id: %06x", iVendor);
+              cout << strLog.c_str() << endl;
+            }
+          }
+        }
         else if (command == "ver")
         {
           CStdString strDev;