no need to cache the physical address of the active source in the device map; the...
[deb_libcec.git] / src / lib / implementations / CECCommandHandler.cpp
index 3423c283b1960195a2ffb5f9bb3988ef2fe2b353..0e00e4c2ef0107e654538aa4d2555321b1a6ed20 100644 (file)
@@ -209,10 +209,12 @@ int CCECCommandHandler::HandleActiveSource(const cec_command &command)
   if (command.parameters.size == 2)
   {
     uint16_t iAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
-    m_processor->GetDevices()->SetActiveSource(iAddress);
-    CCECBusDevice *device = m_processor->GetDeviceByPhysicalAddress(iAddress);
+    CCECBusDevice *device = m_processor->GetDevice(command.initiator);
     if (device)
+    {
+      device->SetPhysicalAddress(iAddress);
       device->MarkAsActiveSource();
+    }
 
     m_processor->GetDevices()->SignalAll(command.opcode);
     return COMMAND_HANDLED;