cec: added 'pa' command to cec-client, to change the physical address
authorLars Op den Kamp <lars@opdenkamp.eu>
Fri, 14 Oct 2011 09:15:10 +0000 (11:15 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Fri, 14 Oct 2011 09:15:10 +0000 (11:15 +0200)
src/testclient/main.cpp

index 1d9f4a9fb124c4eced1150cc2933fc78d70da865..cd83f10d48323566e6386a28a0346fc306956c8f 100644 (file)
@@ -180,6 +180,9 @@ void show_console_help(void)
   "la {logical_address}      change the logical address of the CEC adapter." << endl <<
   "[la 4]                    logical address 4" << endl <<
   endl <<
+  "pa {physical_address}     change the physical address of the CEC adapter." << endl <<
+  "[pa 10 00]                physical address 1.0.0.0" << endl <<
+  endl <<
   "[ping]                    send a ping command to the CEC adapter." << endl <<
   "[bl]                      to let the adapter enter the bootloader, to upgrade" << endl <<
   "                          the flash rom." << endl <<
@@ -325,6 +328,17 @@ int main (int argc, char *argv[])
             parser->SetLogicalAddress((cec_logical_address) atoi(strvalue.c_str()));
           }
         }
+        else if (command == "pa")
+        {
+          string strB1, strB2;
+          uint8_t iB1, iB2;
+          if (GetWord(input, strB1) && HexStrToInt(strB1, iB1) &&
+              GetWord(input, strB2) && HexStrToInt(strB2, iB2))
+          {
+            uint16_t iPhysicalAddress = ((uint16_t)iB1 << 8) + iB2;
+            parser->SetPhysicalAddress(iPhysicalAddress);
+          }
+        }
         else if (command == "ping")
         {
           parser->PingAdapter();