repositories
/
deb_libcec.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
88d5d47
)
no need to cache the physical address of the active source in the device map; the...
author
Lars Op den Kamp
<lars@opdenkamp.eu>
Wed, 14 Nov 2012 01:26:52 +0000
(
02:26
+0100)
committer
Lars Op den Kamp
<lars@opdenkamp.eu>
Wed, 14 Nov 2012 01:26:52 +0000
(
02:26
+0100)
src/lib/CECProcessor.cpp
patch
|
blob
|
blame
|
history
src/lib/devices/CECBusDevice.cpp
patch
|
blob
|
blame
|
history
src/lib/devices/CECDeviceMap.cpp
patch
|
blob
|
blame
|
history
src/lib/devices/CECDeviceMap.h
patch
|
blob
|
blame
|
history
src/lib/implementations/CECCommandHandler.cpp
patch
|
blob
|
blame
|
history
diff --git
a/src/lib/CECProcessor.cpp
b/src/lib/CECProcessor.cpp
index 399e065daa81f9872e4d95d3efb54e2773c49d05..e432033961ab0a487cbeb4d4768d44455ac48824 100644
(file)
--- a/
src/lib/CECProcessor.cpp
+++ b/
src/lib/CECProcessor.cpp
@@
-351,7
+351,7
@@
cec_logical_address CCECProcessor::GetActiveSource(bool bRequestActiveSource /*
if (activeSource)
return activeSource->GetLogicalAddress();
if (activeSource)
return activeSource->GetLogicalAddress();
- if (bRequestActiveSource
&& m_busDevices->GetActiveSourceAddress() == CEC_INVALID_PHYSICAL_ADDRESS
)
+ if (bRequestActiveSource)
{
// request the active source from the bus
CCECBusDevice *primary = GetPrimaryDevice();
{
// request the active source from the bus
CCECBusDevice *primary = GetPrimaryDevice();
diff --git
a/src/lib/devices/CECBusDevice.cpp
b/src/lib/devices/CECBusDevice.cpp
index d50045af89eebe2ad5e3aaefbd5d29755d8a95ea..fd2a348a64a7bc6d87064fa2a298db9c1df59457 100644
(file)
--- a/
src/lib/devices/CECBusDevice.cpp
+++ b/
src/lib/devices/CECBusDevice.cpp
@@
-537,9
+537,6
@@
bool CCECBusDevice::SetPhysicalAddress(uint16_t iNewAddress)
{
LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s (%X): physical address changed from %04x to %04x", GetLogicalAddressName(), m_iLogicalAddress, m_iPhysicalAddress, iNewAddress);
m_iPhysicalAddress = iNewAddress;
{
LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s (%X): physical address changed from %04x to %04x", GetLogicalAddressName(), m_iLogicalAddress, m_iPhysicalAddress, iNewAddress);
m_iPhysicalAddress = iNewAddress;
-
- if (m_processor->GetDevices()->GetActiveSourceAddress() == iNewAddress)
- MarkAsActiveSource();
}
return true;
}
}
return true;
}
diff --git
a/src/lib/devices/CECDeviceMap.cpp
b/src/lib/devices/CECDeviceMap.cpp
index b614e1a9175a1c322e28578fcee55ca2390ebb65..b7f3ab2026b4143b88b1096358b04d513b5caa3c 100644
(file)
--- a/
src/lib/devices/CECDeviceMap.cpp
+++ b/
src/lib/devices/CECDeviceMap.cpp
@@
-45,8
+45,7
@@
using namespace std;
using namespace CEC;
CCECDeviceMap::CCECDeviceMap(CCECProcessor *processor) :
using namespace CEC;
CCECDeviceMap::CCECDeviceMap(CCECProcessor *processor) :
- m_processor(processor),
- m_iActiveSource(CEC_INVALID_PHYSICAL_ADDRESS)
+ m_processor(processor)
{
for (uint8_t iPtr = CECDEVICE_TV; iPtr <= CECDEVICE_BROADCAST; iPtr++)
{
{
for (uint8_t iPtr = CECDEVICE_TV; iPtr <= CECDEVICE_BROADCAST; iPtr++)
{
@@
-207,10
+206,6
@@
CCECBusDevice *CCECDeviceMap::GetActiveSource(void) const
{
for (CECDEVICEMAP::const_iterator it = m_busDevices.begin(); it != m_busDevices.end(); it++)
{
{
for (CECDEVICEMAP::const_iterator it = m_busDevices.begin(); it != m_busDevices.end(); it++)
{
- if (m_iActiveSource != CEC_INVALID_PHYSICAL_ADDRESS && !it->second->IsActiveSource() &&
- it->second->GetCurrentPowerStatus() == CEC_POWER_STATUS_ON &&
- m_iActiveSource == it->second->GetCurrentPhysicalAddress())
- it->second->MarkAsActiveSource();
if (it->second->IsActiveSource())
return it->second;
}
if (it->second->IsActiveSource())
return it->second;
}
@@
-289,16
+284,6
@@
void CCECDeviceMap::GetChildrenOf(CECDEVICEVEC& devices, CCECBusDevice* device)
}
}
}
}
-void CCECDeviceMap::SetActiveSource(uint16_t iPhysicalAddress)
-{
- m_iActiveSource = iPhysicalAddress;
-}
-
-uint16_t CCECDeviceMap::GetActiveSourceAddress(void) const
-{
- return m_iActiveSource;
-}
-
void CCECDeviceMap::SignalAll(cec_opcode opcode)
{
for (CECDEVICEMAP::iterator it = m_busDevices.begin(); it != m_busDevices.end(); it++)
void CCECDeviceMap::SignalAll(cec_opcode opcode)
{
for (CECDEVICEMAP::iterator it = m_busDevices.begin(); it != m_busDevices.end(); it++)
diff --git
a/src/lib/devices/CECDeviceMap.h
b/src/lib/devices/CECDeviceMap.h
index 50271dc04d61576f8827b3cd3f7390dc11a7112c..6037fa3d548140523b587b2df8d34c28eb2c441c 100644
(file)
--- a/
src/lib/devices/CECDeviceMap.h
+++ b/
src/lib/devices/CECDeviceMap.h
@@
-63,8
+63,6
@@
namespace CEC
void GetActive(CECDEVICEVEC &devices) const;
void GetByType(const cec_device_type type, CECDEVICEVEC &devices) const;
void GetChildrenOf(CECDEVICEVEC& devices, CCECBusDevice* device) const;
void GetActive(CECDEVICEVEC &devices) const;
void GetByType(const cec_device_type type, CECDEVICEVEC &devices) const;
void GetChildrenOf(CECDEVICEVEC& devices, CCECBusDevice* device) const;
- void SetActiveSource(uint16_t iPhysicalAddress);
- uint16_t GetActiveSourceAddress(void) const;
void SignalAll(cec_opcode opcode);
void GetPowerOffDevices(const libcec_configuration &configuration, CECDEVICEVEC &devices) const;
void SignalAll(cec_opcode opcode);
void GetPowerOffDevices(const libcec_configuration &configuration, CECDEVICEVEC &devices) const;
@@
-82,6
+80,5
@@
namespace CEC
CECDEVICEMAP m_busDevices;
CCECProcessor *m_processor;
CECDEVICEMAP m_busDevices;
CCECProcessor *m_processor;
- uint16_t m_iActiveSource;
};
}
};
}
diff --git
a/src/lib/implementations/CECCommandHandler.cpp
b/src/lib/implementations/CECCommandHandler.cpp
index 3423c283b1960195a2ffb5f9bb3988ef2fe2b353..0e00e4c2ef0107e654538aa4d2555321b1a6ed20 100644
(file)
--- a/
src/lib/implementations/CECCommandHandler.cpp
+++ b/
src/lib/implementations/CECCommandHandler.cpp
@@
-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]);
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)
if (device)
+ {
+ device->SetPhysicalAddress(iAddress);
device->MarkAsActiveSource();
device->MarkAsActiveSource();
+ }
m_processor->GetDevices()->SignalAll(command.opcode);
return COMMAND_HANDLED;
m_processor->GetDevices()->SignalAll(command.opcode);
return COMMAND_HANDLED;