diff options
| author | Adarsh-MR <adarshmr1998@gmail.com> | 2017-10-05 12:40:00 +0000 |
|---|---|---|
| committer | Adarsh-MR <adarshmr1998@gmail.com> | 2017-10-06 18:17:31 +0000 |
| commit | 9dea180d2c839d702bef2d04dc1a45911ea65c7c (patch) | |
| tree | 7c2b4c992513c75b639a1135d2eee26b764d1e27 | |
| parent | ba62f176c9deec94df29be7b747461edd3506cec (diff) | |
Revert "Revert "kenzo: Drop fp wrapper to dynamically select fp HAL""
This reverts commit 0408f9f5173905adc4baa14439455eb555dd14df.
| -rw-r--r-- | device.mk | 4 | ||||
| -rw-r--r-- | fingerprint/Android.mk | 31 | ||||
| -rw-r--r-- | fingerprint/FingerprintWrapper.cpp | 244 | ||||
| -rwxr-xr-x | proprietary-files.txt | 6 | ||||
| -rw-r--r-- | rootdir/etc/init.target.rc | 8 |
5 files changed, 11 insertions, 282 deletions
@@ -25,10 +25,6 @@ PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/audio/audio_platform_info_extcodec.xml:system/etc/audio_platform_info_extcodec.xml \ $(LOCAL_PATH)/audio/mixer_paths.xml:system/etc/mixer_paths_wcd9326.xml -# Fingerprint -PRODUCT_PACKAGES += \ - fingerprint.msm8952 - # Input PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/idc/uinput-fpc.idc:system/usr/idc/uinput-fpc.idc diff --git a/fingerprint/Android.mk b/fingerprint/Android.mk deleted file mode 100644 index 41d8fcc..0000000 --- a/fingerprint/Android.mk +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (C) 2017 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ - FingerprintWrapper.cpp - -LOCAL_SHARED_LIBRARIES := \ - libhardware liblog libcutils - -LOCAL_MODULE_RELATIVE_PATH := hw -LOCAL_MODULE := fingerprint.$(TARGET_BOARD_PLATFORM) -LOCAL_MODULE_TAGS := optional - -include $(BUILD_SHARED_LIBRARY) diff --git a/fingerprint/FingerprintWrapper.cpp b/fingerprint/FingerprintWrapper.cpp deleted file mode 100644 index 152edb0..0000000 --- a/fingerprint/FingerprintWrapper.cpp +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (C) 2017, 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -//#define LOG_NDEBUG 0 -#define LOG_TAG "FingerprintWrapper" - -#include <dlfcn.h> - -#include <cutils/log.h> -#include <cutils/properties.h> - -#include <hardware/hardware.h> -#include <hardware/fingerprint.h> -#include <utils/threads.h> - -typedef struct { - fingerprint_device_t base; - union { - fingerprint_device_t *device; - hw_device_t *hw_device; - } vendor; -} device_t; - -static android::Mutex vendor_mutex; - -static union { - const fingerprint_module_t *module; - const hw_module_t *hw_module; -} vendor; - -static bool ensure_vendor_module_is_loaded(void) -{ - android::Mutex::Autolock lock(vendor_mutex); - - if (!vendor.module) { - - int rv; - char vend [PROPERTY_VALUE_MAX]; - property_get("ro.boot.fpsensor", vend, NULL); - - - if (!strcmp(vend, "fpc")) { - property_set("persist.sys.fp.goodix", "0"); - rv = hw_get_module_by_class("fingerprint", "fpc", &vendor.hw_module); - } else { - property_set("persist.sys.fp.goodix", "1"); - rv = hw_get_module_by_class("fingerprint", "goodix", &vendor.hw_module); - } - if (rv) { - ALOGE("failed to open vendor module, error %d", rv); - vendor.module = NULL; - } else { - ALOGI("loaded vendor module: %s version %x", vendor.module->common.name, - vendor.module->common.module_api_version); - } - } - - return vendor.module != NULL; -} - -static int set_notify(struct fingerprint_device *dev, fingerprint_notify_t notify) -{ - device_t *device = (device_t *) dev; - - device->base.notify = notify; - return device->vendor.device->set_notify(device->vendor.device, notify); -} - -static uint64_t pre_enroll(struct fingerprint_device *dev) -{ - device_t *device = (device_t *) dev; - - return device->vendor.device->pre_enroll(device->vendor.device); -} - -static int enroll(struct fingerprint_device *dev, const hw_auth_token_t *hat, uint32_t gid, - uint32_t timeout_sec) -{ - device_t *device = (device_t *) dev; - - return device->vendor.device->enroll(device->vendor.device, hat, gid, timeout_sec); -} - -static int post_enroll(struct fingerprint_device *dev) -{ - device_t *device = (device_t *) dev; - - return device->vendor.device->post_enroll(device->vendor.device); -} - -static uint64_t get_authenticator_id(struct fingerprint_device *dev) -{ - device_t *device = (device_t *) dev; - - return device->vendor.device->get_authenticator_id(device->vendor.device); -} - -static int cancel(struct fingerprint_device *dev) -{ - device_t *device = (device_t *) dev; - - return device->vendor.device->cancel(device->vendor.device); -} - -#define MAX_FINGERPRINTS 100 - -typedef int (*enumerate_2_0)(struct fingerprint_device *dev, fingerprint_finger_id_t *results, - uint32_t *max_size); - -static int enumerate_pre_2_1(struct fingerprint_device *dev) -{ - device_t *device = (device_t *) dev; - fingerprint_finger_id_t results[MAX_FINGERPRINTS]; - uint32_t n = MAX_FINGERPRINTS; - enumerate_2_0 enumerate = (enumerate_2_0) device->vendor.device->enumerate; - int rv = enumerate(device->vendor.device, results, &n); - - if (rv == 0) { - uint32_t i; - fingerprint_msg_t msg; - - msg.type = FINGERPRINT_TEMPLATE_ENUMERATING; - for (i = 0; i < n; i++) { - msg.data.enumerated.finger = results[i]; - msg.data.enumerated.remaining_templates = n - i - 1; - device->base.notify(&msg); - } - } - - return rv; -} - -static int enumerate(struct fingerprint_device *dev) -{ - device_t *device = (device_t *) dev; - - return device->vendor.device->enumerate(device->vendor.device); -} - -static int remove(struct fingerprint_device *dev, uint32_t gid, uint32_t fid) -{ - device_t *device = (device_t *) dev; - - return device->vendor.device->remove(device->vendor.device, gid, fid); -} - -static int set_active_group(struct fingerprint_device *dev, uint32_t gid, const char *store_path) -{ - device_t *device = (device_t *) dev; - - return device->vendor.device->set_active_group(device->vendor.device, gid, store_path); -} - -static int authenticate(struct fingerprint_device *dev, uint64_t operation_id, uint32_t gid) -{ - device_t *device = (device_t *) dev; - - return device->vendor.device->authenticate(device->vendor.device, operation_id, gid); -} - -static int device_close(hw_device_t *hw_device) -{ - device_t *device = (device_t *) hw_device; - int rv = device->base.common.close(device->vendor.hw_device); - free(device); - return rv; -} - -static int device_open(const hw_module_t *module, const char *name, hw_device_t **device_out) -{ - int rv; - device_t *device; - - if (!ensure_vendor_module_is_loaded()) { - return -EINVAL; - } - - device = (device_t *) calloc(sizeof(*device), 1); - if (!device) { - ALOGE("%s: Failed to allocate memory", __func__); - return -ENOMEM; - } - - rv = vendor.module->common.methods->open(vendor.hw_module, name, &device->vendor.hw_device); - if (rv) { - ALOGE("%s: failed to open, error %d\n", __func__, rv); - free(device); - return rv; - } - - device->base.common.tag = HARDWARE_DEVICE_TAG; - device->base.common.version = device->vendor.device->common.version; - device->base.common.module = (hw_module_t *) module; - device->base.common.close = device_close; - - device->base.set_notify = set_notify; - device->base.pre_enroll = pre_enroll; - device->base.enroll = enroll; - device->base.post_enroll = post_enroll; - device->base.get_authenticator_id = get_authenticator_id; - device->base.cancel = cancel; - if (vendor.module->common.module_api_version >= FINGERPRINT_MODULE_API_VERSION_2_1) { - device->base.enumerate = enumerate; - } else { - device->base.enumerate = enumerate_pre_2_1; - } - device->base.remove = remove; - device->base.set_active_group = set_active_group; - device->base.authenticate = authenticate; - - *device_out = (hw_device_t *) device; - return 0; -} - -static struct hw_module_methods_t module_methods = { - .open = device_open -}; - -fingerprint_module_t HAL_MODULE_INFO_SYM = { - .common = { - .tag = HARDWARE_MODULE_TAG, - .module_api_version = FINGERPRINT_MODULE_API_VERSION_2_1, - .hal_api_version = HARDWARE_HAL_API_VERSION, - .id = FINGERPRINT_HARDWARE_MODULE_ID, - .name = "Lineage Fingerprint Wrapper", - .author = "The LineageOS Project", - .methods = &module_methods, - .dso = NULL, /* remove compilation warnings */ - .reserved = {0}, /* remove compilation warnings */ - }, -}; diff --git a/proprietary-files.txt b/proprietary-files.txt index 59d55ca..9f31814 100755 --- a/proprietary-files.txt +++ b/proprietary-files.txt @@ -487,14 +487,14 @@ vendor/lib/libQSEEComAPI.so # Fingerprint sensor bin/gx_fpd -lib64/hw/fingerprint.goodix.default.so -lib64/hw/fingerprint.msm8952.so:lib64/hw/fingerprint.fpc.msm8952.so +lib64/hw/fingerprint.goodix.default.so:lib64/hw/fingerprint.gdx.so +lib64/hw/fingerprint.msm8952.so:lib64/hw/fingerprint.fpc.so lib64/hw/gxfingerprint.default.so lib64/lib_fpc_tac_shared.so lib64/libfp_client.so lib64/libfpnav.so lib64/libfpservice.so -lib/hw/fingerprint.msm8952.so:lib/hw/fingerprint.fpc.msm8952.so +lib/hw/fingerprint.msm8952.so:lib/hw/fingerprint.fpc.so lib/lib_fpc_tac_shared.so # Fingerprint firmware diff --git a/rootdir/etc/init.target.rc b/rootdir/etc/init.target.rc index 5c61ae5..d0c6fd9 100644 --- a/rootdir/etc/init.target.rc +++ b/rootdir/etc/init.target.rc @@ -37,6 +37,14 @@ on boot chown system system /dev/goodix_fp chmod 0644 /dev/goodix_fp +on property:ro.boot.fpsensor=fpc + setprop persist.sys.fp.goodix 0 + setprop ro.hardware.fingerprint fpc + +on property:ro.boot.fpsensor=gdx + setprop persist.sys.fp.goodix 1 + setprop ro.hardware.fingerprint gdx + service gx_fpd /system/bin/gx_fpd class late_start user system |
