From: Lars Op den Kamp Date: Tue, 27 Mar 2012 13:28:22 +0000 (+0200) Subject: cec: request the vendor id of a device if needed when the device status is changed... X-Git-Tag: upstream/2.2.0~1^2~31^2~44 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=ee17ad585ff284535cfbb4e6452e72943e3919c1;p=deb_libcec.git cec: request the vendor id of a device if needed when the device status is changed into 'present'. bugzid: 361 --- diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index 814f58a..a3208ba 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -567,44 +567,49 @@ bool CCECBusDevice::TryLogicalAddress(void) void CCECBusDevice::SetDeviceStatus(const cec_bus_device_status newStatus) { - CLockObject lock(m_mutex); - switch (newStatus) { - case CEC_DEVICE_STATUS_UNKNOWN: - if (m_deviceStatus != newStatus) - CLibCEC::AddLog(CEC_LOG_DEBUG, "device status of %s changed into 'unknown'", ToString(m_iLogicalAddress)); - m_iStreamPath = 0; - m_powerStatus = CEC_POWER_STATUS_UNKNOWN; - m_vendor = CEC_VENDOR_UNKNOWN; - m_menuState = CEC_MENU_STATE_ACTIVATED; - m_bActiveSource = false; - m_iLastActive = 0; - m_cecVersion = CEC_VERSION_UNKNOWN; - m_deviceStatus = newStatus; - break; - case CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC: - if (m_deviceStatus != newStatus) - CLibCEC::AddLog(CEC_LOG_DEBUG, "device status of %s changed into 'handled by libCEC'", ToString(m_iLogicalAddress)); - m_iStreamPath = 0; - m_powerStatus = CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON; - m_vendor = CEC_VENDOR_UNKNOWN; - m_menuState = CEC_MENU_STATE_ACTIVATED; - m_bActiveSource = false; - m_iLastActive = 0; - m_cecVersion = CEC_VERSION_1_3A; - m_deviceStatus = newStatus; - break; - case CEC_DEVICE_STATUS_PRESENT: - if (m_deviceStatus != newStatus) - CLibCEC::AddLog(CEC_LOG_DEBUG, "device status of %s changed into 'present'", ToString(m_iLogicalAddress)); - m_deviceStatus = newStatus; - break; - case CEC_DEVICE_STATUS_NOT_PRESENT: - if (m_deviceStatus != newStatus) - CLibCEC::AddLog(CEC_LOG_DEBUG, "device status of %s changed into 'not present'", ToString(m_iLogicalAddress)); - m_deviceStatus = newStatus; - break; + CLockObject lock(m_mutex); + switch (newStatus) + { + case CEC_DEVICE_STATUS_UNKNOWN: + if (m_deviceStatus != newStatus) + CLibCEC::AddLog(CEC_LOG_DEBUG, "device status of %s changed into 'unknown'", ToString(m_iLogicalAddress)); + m_iStreamPath = 0; + m_powerStatus = CEC_POWER_STATUS_UNKNOWN; + m_vendor = CEC_VENDOR_UNKNOWN; + m_menuState = CEC_MENU_STATE_ACTIVATED; + m_bActiveSource = false; + m_iLastActive = 0; + m_cecVersion = CEC_VERSION_UNKNOWN; + m_deviceStatus = newStatus; + break; + case CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC: + if (m_deviceStatus != newStatus) + CLibCEC::AddLog(CEC_LOG_DEBUG, "device status of %s changed into 'handled by libCEC'", ToString(m_iLogicalAddress)); + m_iStreamPath = 0; + m_powerStatus = CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON; + m_vendor = CEC_VENDOR_UNKNOWN; + m_menuState = CEC_MENU_STATE_ACTIVATED; + m_bActiveSource = false; + m_iLastActive = 0; + m_cecVersion = CEC_VERSION_1_3A; + m_deviceStatus = newStatus; + break; + case CEC_DEVICE_STATUS_PRESENT: + if (m_deviceStatus != newStatus) + CLibCEC::AddLog(CEC_LOG_DEBUG, "device status of %s changed into 'present'", ToString(m_iLogicalAddress)); + m_deviceStatus = newStatus; + break; + case CEC_DEVICE_STATUS_NOT_PRESENT: + if (m_deviceStatus != newStatus) + CLibCEC::AddLog(CEC_LOG_DEBUG, "device status of %s changed into 'not present'", ToString(m_iLogicalAddress)); + m_deviceStatus = newStatus; + break; + } } + + if (newStatus == CEC_DEVICE_STATUS_PRESENT) + RequestVendorId(); } void CCECBusDevice::SetPhysicalAddress(uint16_t iNewAddress)