From: Lars Op den Kamp Date: Thu, 26 Apr 2012 11:43:13 +0000 (+0200) Subject: cec-client: group up the output of the 'scan' command, and add the currently active... X-Git-Tag: upstream/2.2.0~1^2~29^2^2~24 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=040e2a141123a3b3c64033675e48a0db1518c4f1;p=deb_libcec.git cec-client: group up the output of the 'scan' command, and add the currently active source to the output --- diff --git a/src/testclient/main.cpp b/src/testclient/main.cpp index 723b917..011044e 100644 --- a/src/testclient/main.cpp +++ b/src/testclient/main.cpp @@ -813,14 +813,15 @@ bool ProcessCommandSCAN(ICECAdapter *parser, const string &command, string & UNU { if (command == "scan") { - PrintToStdOut("CEC bus information"); - PrintToStdOut("==================="); + CStdString strLog; + PrintToStdOut("requesting CEC bus information ..."); + + strLog.append("CEC bus information\n===================\n"); cec_logical_addresses addresses = parser->GetActiveDevices(); for (uint8_t iPtr = 0; iPtr < 16; iPtr++) { if (addresses[iPtr]) { - CStdString strLog; uint64_t iVendorId = parser->GetDeviceVendorId((cec_logical_address)iPtr); bool bActive = parser->IsActiveSource((cec_logical_address)iPtr); uint16_t iPhysicalAddress = parser->GetDevicePhysicalAddress((cec_logical_address)iPtr); @@ -842,10 +843,14 @@ bool ProcessCommandSCAN(ICECAdapter *parser, const string &command, string & UNU strLog.AppendFormat("power status: %s\n", parser->ToString(power)); if ((uint8_t)lang.device == iPtr) strLog.AppendFormat("language: %s\n", lang.language); - strLog.append("\n"); - PrintToStdOut(strLog); + strLog.append("\n\n"); } } + + cec_logical_address activeSource = parser->GetActiveSource(); + strLog.AppendFormat("currently active source: %s (%X)", parser->ToString(activeSource), (int)activeSource); + + PrintToStdOut(strLog); return true; }