diff options
author | TheScarastic <warabhishek@gmail.com> | 2019-09-28 01:14:58 +0530 |
---|---|---|
committer | Bruno Martins <bgcngm@gmail.com> | 2020-01-07 16:19:04 +0200 |
commit | 159f19e64b5ad069cf22159665ac6f178488f0e4 (patch) | |
tree | cf2232a03d4b8151ac39769ca4392a1e3727d8df | |
parent | fd1713f0bae7db27d2341ac010c8393cc7f8d643 (diff) | |
download | android_hardware_lineage_livedisplay-159f19e64b5ad069cf22159665ac6f178488f0e4.tar.gz android_hardware_lineage_livedisplay-159f19e64b5ad069cf22159665ac6f178488f0e4.tar.bz2 android_hardware_lineage_livedisplay-159f19e64b5ad069cf22159665ac6f178488f0e4.zip |
livedisplay: Take into account new SDM lib naming
Change-Id: I1badaef0622d87deb5b4844bc70705b6946e0672
-rw-r--r-- | sdm/service.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/sdm/service.cpp b/sdm/service.cpp index ac7ee5c..087698e 100644 --- a/sdm/service.cpp +++ b/sdm/service.cpp @@ -30,11 +30,14 @@ #include "DisplayModes.h" #include "PictureAdjustment.h" +constexpr const char* SDM_DISP_LIBS[]{ #ifdef LIVES_IN_SYSTEM -#define SDM_DISP_LIB "libsdm-disp-apis.so" + "libsdm-disp-apis.qti.so", + "libsdm-disp-apis.so", #else -#define SDM_DISP_LIB "libsdm-disp-vndapis.so" + "libsdm-disp-vndapis.so", #endif +}; using android::OK; using android::sp; @@ -52,6 +55,7 @@ using ::vendor::lineage::livedisplay::V2_0::sdm::PictureAdjustment; int main() { // Vendor backend void* libHandle = nullptr; + const char* libName = nullptr; int32_t (*disp_api_init)(uint64_t*, uint32_t) = nullptr; int32_t (*disp_api_deinit)(uint64_t, uint32_t) = nullptr; uint64_t cookie = 0; @@ -71,30 +75,38 @@ int main() { LOG(INFO) << "LiveDisplay HAL service is starting."; - libHandle = dlopen(SDM_DISP_LIB, RTLD_NOW); + for (auto&& lib : SDM_DISP_LIBS) { + libHandle = dlopen(lib, RTLD_NOW); + libName = lib; + if (libHandle != nullptr) { + LOG(INFO) << "Loaded: " << libName; + break; + } + LOG(ERROR) << "Can not load " << libName << " (" << dlerror() << ")"; + } + if (libHandle == nullptr) { - LOG(ERROR) << "Can not get " << SDM_DISP_LIB << " (" << dlerror() << ")"; + LOG(ERROR) << "Failed to load SDM display lib, exiting."; goto shutdown; } disp_api_init = reinterpret_cast<int32_t (*)(uint64_t*, uint32_t)>(dlsym(libHandle, "disp_api_init")); if (disp_api_init == nullptr) { - LOG(ERROR) << "Can not get disp_api_init from " << SDM_DISP_LIB << " (" << dlerror() << ")"; + LOG(ERROR) << "Can not get disp_api_init from " << libName << " (" << dlerror() << ")"; goto shutdown; } disp_api_deinit = reinterpret_cast<int32_t (*)(uint64_t, uint32_t)>(dlsym(libHandle, "disp_api_deinit")); if (disp_api_deinit == nullptr) { - LOG(ERROR) << "Can not get disp_api_deinit from " << SDM_DISP_LIB << " (" << dlerror() - << ")"; + LOG(ERROR) << "Can not get disp_api_deinit from " << libName << " (" << dlerror() << ")"; goto shutdown; } status = disp_api_init(&cookie, 0); if (status != OK) { - LOG(ERROR) << "Can not initialize " << SDM_DISP_LIB << " (" << status << ")"; + LOG(ERROR) << "Can not initialize " << libName << " (" << status << ")"; goto shutdown; } |