X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2FCECProcessor.cpp;h=ad41d3c5f552fc5b854f556d732c2d074c387205;hb=c4483d6f83059251d529c8be45510734877477be;hp=4ae1efeef343291b51425dab8a1f9ceb8585dbc4;hpb=4e7a172e6dc79f56fa6600fbe75985f5eb0b9d29;p=deb_libcec.git diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 4ae1efe..ad41d3c 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -104,6 +104,8 @@ void CCECProcessor::Close(void) SetCECInitialised(false); // stop the processor + StopThread(-1); + m_inBuffer.Broadcast(); StopThread(); // close the connection @@ -222,7 +224,7 @@ void *CCECProcessor::Process(void) if (m_inBuffer.Pop(command, CEC_PROCESSOR_SIGNAL_WAIT_TIME)) ProcessCommand(command); - if (CECInitialised()) + if (CECInitialised() && !IsStopped()) { // check clients for keypress timeouts m_libcec->CheckKeypressTimeout(); @@ -438,7 +440,7 @@ bool CCECProcessor::Transmit(const cec_command &data, bool bIsReply) } return bIsReply ? - adapterState != ADAPTER_MESSAGE_STATE_ERROR : + adapterState == ADAPTER_MESSAGE_STATE_SENT_ACKED || adapterState == ADAPTER_MESSAGE_STATE_SENT || adapterState == ADAPTER_MESSAGE_STATE_WAITING_TO_BE_SENT : adapterState == ADAPTER_MESSAGE_STATE_SENT_ACKED; } @@ -853,7 +855,7 @@ bool CCECProcessor::UnregisterClient(CCECClient *client) void CCECProcessor::UnregisterClients(void) { - m_libcec->AddLog(CEC_LOG_NOTICE, "unregistering all CEC clients"); + m_libcec->AddLog(CEC_LOG_DEBUG, "unregistering all CEC clients"); vector clients = m_libcec->GetClients(); for (vector::iterator client = clients.begin(); client != clients.end(); client++) @@ -933,6 +935,8 @@ void CCECProcessor::HandleLogicalAddressLost(cec_logical_address oldAddress) m_libcec->AddLog(CEC_LOG_NOTICE, "logical address %x was taken by another device, allocating a new address", oldAddress); CCECClient* client = GetClient(oldAddress); + if (!client) + client = GetPrimaryClient(); if (client) { if (m_addrAllocator) @@ -944,6 +948,16 @@ void CCECProcessor::HandleLogicalAddressLost(cec_logical_address oldAddress) } } +uint16_t CCECProcessor::GetAdapterVendorId(void) const +{ + return m_communication ? m_communication->GetAdapterVendorId() : 0; +} + +uint16_t CCECProcessor::GetAdapterProductId(void) const +{ + return m_communication ? m_communication->GetAdapterProductId() : 0; +} + CCECAllocateLogicalAddress::CCECAllocateLogicalAddress(CCECProcessor* processor, CCECClient* client) : m_processor(processor), m_client(client) { }