sm6150-common: fingerprint: Load goodix HAL if loading the fpc HAL fails
Author: Demon Singur <demonsingur@gmail.com> Date: Sun Mar 4 17:25:12 2018 +0000 msm8998-common: turn fingerprint wrapper intro a hidl service Change-Id: Ib72892417d401947aeb3935ef0f018c3b5daf94b Author: Demon Singur <demonsingur@gmail.com> Date: Fri Feb 16 18:56:25 2018 +0000 msm8998-common: Cleanup fingerprint wrapper logic Change-Id: I036f8d766378cbfc006cdefdd32ec48e65540dd2 Signed-off-by: Arian <arian.kulmer@web.de> Change-Id: I5d45d1c655e69c34de16e6813eee80b07d30dda9
This commit is contained in:
parent
e76fb5010d
commit
9f781f1bdf
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
* Copyright (C) 2018-2021 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -211,31 +212,31 @@ IBiometricsFingerprint* BiometricsFingerprint::getInstance() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
fingerprint_device_t* BiometricsFingerprint::openHal() {
|
||||
fingerprint_device_t* getDeviceForVendor(const char *class_name) {
|
||||
int err;
|
||||
const hw_module_t *hw_mdl = nullptr;
|
||||
ALOGD("Opening fingerprint hal library...");
|
||||
if (0 != (err = hw_get_module(FINGERPRINT_HARDWARE_MODULE_ID, &hw_mdl))) {
|
||||
ALOGE("Can't open fingerprint HW Module, error: %d", err);
|
||||
if (0 != (err = hw_get_module_by_class(FINGERPRINT_HARDWARE_MODULE_ID, class_name, &hw_mdl))) {
|
||||
ALOGE("Can't open fingerprint HW Module, class: %s, error: %d", class_name, err);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (hw_mdl == nullptr) {
|
||||
ALOGE("No valid fingerprint module");
|
||||
ALOGE("No valid fingerprint module, class: %s", class_name);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
fingerprint_module_t const *module =
|
||||
reinterpret_cast<const fingerprint_module_t*>(hw_mdl);
|
||||
if (module->common.methods->open == nullptr) {
|
||||
ALOGE("No valid open method");
|
||||
ALOGE("No valid open method, class: %s", class_name);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
hw_device_t *device = nullptr;
|
||||
|
||||
if (0 != (err = module->common.methods->open(hw_mdl, nullptr, &device))) {
|
||||
ALOGE("Can't open fingerprint methods, error: %d", err);
|
||||
ALOGE("Can't open fingerprint methods, class: %s, error: %d", class_name, err);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -248,6 +249,39 @@ fingerprint_device_t* BiometricsFingerprint::openHal() {
|
||||
fingerprint_device_t* fp_device =
|
||||
reinterpret_cast<fingerprint_device_t*>(device);
|
||||
|
||||
ALOGI("Loaded fingerprint module, class: %s", class_name);
|
||||
return fp_device;
|
||||
}
|
||||
|
||||
fingerprint_device_t* getFingerprintDevice() {
|
||||
fingerprint_device_t *fp_device;
|
||||
|
||||
fp_device = getDeviceForVendor("fpc");
|
||||
if (fp_device == nullptr) {
|
||||
ALOGE("Failed to load fpc fingerprint module");
|
||||
} else {
|
||||
return fp_device;
|
||||
}
|
||||
|
||||
fp_device = getDeviceForVendor("goodix");
|
||||
if (fp_device == nullptr) {
|
||||
ALOGE("Failed to load goodix fingerprint module");
|
||||
} else {
|
||||
return fp_device;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
fingerprint_device_t* BiometricsFingerprint::openHal() {
|
||||
int err;
|
||||
|
||||
fingerprint_device_t *fp_device;
|
||||
fp_device = getFingerprintDevice();
|
||||
if (fp_device == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (0 != (err =
|
||||
fp_device->set_notify(fp_device, BiometricsFingerprint::notify))) {
|
||||
ALOGE("Can't register fingerprint module callback, error: %d", err);
|
||||
|
Loading…
Reference in New Issue
Block a user