-rw-r--r-- | hwc2/common/devices/PhysicalDevice.cpp | 85 | ||||
-rw-r--r-- | hwc2/common/devices/PrimaryDevice.cpp | 36 | ||||
-rw-r--r-- | hwc2/common/utils/Utils.cpp | 16 | ||||
-rw-r--r-- | hwc2/common/utils/Utils.h | 4 | ||||
-rw-r--r-- | hwc2/include/PhysicalDevice.h | 20 | ||||
-rw-r--r-- | hwc2/include/PrimaryDevice.h | 7 |
6 files changed, 163 insertions, 5 deletions
diff --git a/hwc2/common/devices/PrimaryDevice.cpp b/hwc2/common/devices/PrimaryDevice.cpp index da28b8e..377db74 100644 --- a/hwc2/common/devices/PrimaryDevice.cpp +++ b/hwc2/common/devices/PrimaryDevice.cpp @@ -22,7 +22,6 @@ #include <Utils.h> #include <SysTokenizer.h> - namespace android { namespace amlogic { @@ -56,6 +55,10 @@ bool PrimaryDevice::initialize() Utils::getHotplugUeventEnvelope(), hotplugEventListener, this); + observer->registerListener( + Utils::getModeChangeUeventEnvelope(), + modeChangeEventListener, + this); } else { ETRACE("Uevent observer is NULL"); } @@ -76,6 +79,15 @@ void PrimaryDevice::hotplugEventListener(void *data, bool status) } } +void PrimaryDevice::modeChangeEventListener(void *data, bool status) +{ + PrimaryDevice *pThis = (PrimaryDevice*)data; + DTRACE("mode change event: %d", status); + if (status && pThis) { + pThis->changeModeDetectThread(); + } +} + void PrimaryDevice::hotplugListener(bool connected) { CTRACE(); @@ -124,5 +136,27 @@ int PrimaryDevice::parseConfigFile() return status; } +void PrimaryDevice::changeModeDetectThread() +{ + pthread_t id; + int ret = pthread_create(&id, NULL, changeModeDetect, this); + if (ret != 0) + ETRACE("Create changeModeDetect error!\n"); +} + +void* PrimaryDevice::changeModeDetect(void* data) +{ + PrimaryDevice *pThis = (PrimaryDevice*)data; + bool modeChanged = false; + char lastMode[32]; + Utils::getSysfsStr(SYSFS_DISPLAY_MODE, lastMode); + do { + modeChanged = Utils::checkSysfsStatus(SYSFS_DISPLAY_MODE, lastMode, 32); + usleep(1000 * 1000); + } while (!modeChanged); + pThis->setOsdMouse(); + return NULL; +} + } // namespace amlogic } // namespace android |