X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fdevices%2FCECBusDevice.cpp;h=83c9b4cd6140323f4ec9ea6defd23e74b4bafbd2;hb=a5a5f6f5437c662e7f8d8e52d32e5cddacc89784;hp=f3c429453225c1fe47dd860ca24bea7cf5bbd3ad;hpb=7db99d72cb826acf6ac761b7b27d3a639bb898c2;p=deb_libcec.git diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index f3c4294..83c9b4c 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -227,7 +227,9 @@ void CCECBusDevice::SetUnsupportedFeature(cec_opcode opcode) opcode == CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP || opcode == CEC_OPCODE_ABORT || opcode == CEC_OPCODE_FEATURE_ABORT || - opcode == CEC_OPCODE_NONE) + opcode == CEC_OPCODE_NONE || + opcode == CEC_OPCODE_USER_CONTROL_PRESSED || + opcode == CEC_OPCODE_USER_CONTROL_RELEASE) return; { @@ -391,12 +393,13 @@ bool CCECBusDevice::TransmitSetMenuLanguage(const cec_logical_address destinatio language = m_menuLanguage; } - char lang[3]; + char lang[4]; { CLockObject lock(m_mutex); lang[0] = language.language[0]; lang[1] = language.language[1]; lang[2] = language.language[2]; + lang[3] = (char)0; } MarkBusy(); @@ -1131,21 +1134,25 @@ void CCECBusDevice::SetActiveRoute(uint16_t iRoute) return; CCECBusDevice* newRoute = m_processor->GetDeviceByPhysicalAddress(iRoute, true); - if (newRoute && newRoute->IsHandledByLibCEC()) + if (newRoute) { - newRoute->ActivateSource(); - return; + // we were made the active source, send notification + if (newRoute->IsHandledByLibCEC()) + newRoute->ActivateSource(); + // another device was made active + else + newRoute->MarkAsActiveSource(); } - - CECDEVICEVEC devices; - m_processor->GetDevices()->GetChildrenOf(devices, this); - - for (CECDEVICEVEC::iterator it = devices.begin(); it != devices.end(); it++) + else { - if ((*it)->GetCurrentPhysicalAddress() == iRoute && (*it)->IsHandledByLibCEC()) - (*it)->ActivateSource(); - else if (!CCECTypeUtils::PhysicalAddressIsIncluded(iRoute, (*it)->GetCurrentPhysicalAddress())) - (*it)->MarkAsInactiveSource(); + // get the current active source and it's physical address + CCECBusDevice *device = m_processor->GetDevices()->GetActiveSource(); + uint16_t iPhysicalAddress(device ? device->GetCurrentPhysicalAddress() : CEC_INVALID_PHYSICAL_ADDRESS); + + // check whether the route below the device changed + if (CLibCEC::IsValidPhysicalAddress(iPhysicalAddress) && + !CCECTypeUtils::PhysicalAddressIsIncluded(iPhysicalAddress, iRoute)) + device->MarkAsInactiveSource(); } }