update system audio mode when audio system devices are activated
[deb_libcec.git] / src / lib / implementations / CECCommandHandler.cpp
index b961878871e7f244f5bee9a673fc149b0b0a9e18..b742f49898001f437d64478d0e8b6f7593c7e4dc 100644 (file)
@@ -583,13 +583,6 @@ int CCECCommandHandler::HandleSetStreamPath(const cec_command &command)
         device->MarkAsActiveSource();
       return COMMAND_HANDLED;
     }
-    else
-    {
-      cec_logical_address previousSource = m_processor->GetActiveSource(false);
-      CCECBusDevice* device = m_processor->GetDevice(previousSource);
-      if (device && device->GetCurrentPhysicalAddress() != iStreamAddress)
-        device->MarkAsInactiveSource();
-    }
   }
 
   return CEC_ABORT_REASON_INVALID_OPERAND;
@@ -756,6 +749,9 @@ void CCECCommandHandler::UnhandledCommand(const cec_command &command, const cec_
   {
     LIB_CEC->AddLog(CEC_LOG_DEBUG, "sending abort with opcode %02x and reason '%s' to %s", command.opcode, ToString(reason), ToString(command.initiator));
     m_processor->TransmitAbort(command.destination, command.initiator, command.opcode, reason);
+
+    if (reason == CEC_ABORT_REASON_INVALID_OPERAND)
+      RequestEmailFromCustomer(command);
   }
 }
 
@@ -1234,6 +1230,14 @@ bool CCECCommandHandler::ActivateSource(bool bTransmitDelayedCommandsOnly /* = f
         if (playbackDevice && SendDeckStatusUpdateOnActiveSource())
           bActiveSourceFailed = !playbackDevice->TransmitDeckStatus(CECDEVICE_TV, false);
       }
+
+      // update system audio mode for audiosystem devices
+      if (bTvPresent && !bActiveSourceFailed)
+      {
+        CCECAudioSystem* audioDevice = m_busDevice->AsAudioSystem();
+        if (audioDevice)
+          bActiveSourceFailed = !audioDevice->TransmitSetSystemAudioMode(CECDEVICE_TV, false);
+      }
     }
 
     // retry later
@@ -1290,6 +1294,6 @@ void CCECCommandHandler::RequestEmailFromCustomer(const cec_command& command)
     m_logsRequested.insert(make_pair(command.opcode, commands));
   }
 
-  LIB_CEC->AddLog(CEC_LOG_NOTICE, "key with keycode '%s' is not mapped in libCEC. please send an email to support@pulse-eight.com with this keycode, and tell which key you pressed, and we'll add support for this key.", CCECTypeUtils::ToString(command).c_str());
+  LIB_CEC->AddLog(CEC_LOG_NOTICE, "Unmapped code detected. Please send an email to support@pulse-eight.com with the following details, and if you pressed a key, tell us which one you pressed, and we'll add support for this it.\nCEC command: %s\nVendor ID: %s (%06x)", ToString(command).c_str(), ToString(m_vendorId), m_vendorId);
 }