diff options
author | Sasha Levitskiy <sanek@google.com> | 2014-03-24 16:14:42 -0700 |
---|---|---|
committer | Alexander Levitskiy <sanek@google.com> | 2014-04-07 18:14:34 +0000 |
commit | a747c069c6b3f5a6420662020822992cc70384bc (patch) | |
tree | 252a78401e0653374d34574b712fe9ad54871338 /modules | |
parent | d5aa52756fe21c23096e333afc74e3589a11d216 (diff) | |
download | hardware_libhardware-a747c069c6b3f5a6420662020822992cc70384bc.zip hardware_libhardware-a747c069c6b3f5a6420662020822992cc70384bc.tar.gz hardware_libhardware-a747c069c6b3f5a6420662020822992cc70384bc.tar.bz2 |
Hardware: Fingerprint: Introducing Fingerprint HAL
Change-Id: I4e55c42841c3b6a1327a16bdf6d1d4bb3847c7f3
Signed-off-by: Sasha Levitskiy <sanek@google.com>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/Android.mk | 2 | ||||
-rw-r--r-- | modules/fingerprint/Android.mk | 25 | ||||
-rw-r--r-- | modules/fingerprint/fingerprint.c | 93 |
3 files changed, 119 insertions, 1 deletions
diff --git a/modules/Android.mk b/modules/Android.mk index 5f1de32..c903eee 100644 --- a/modules/Android.mk +++ b/modules/Android.mk @@ -1,4 +1,4 @@ hardware_modules := gralloc hwcomposer audio nfc nfc-nci local_time \ power usbaudio audio_remote_submix camera consumerir sensors vibrator \ - mcu tv_input + mcu tv_input fingerprint include $(call all-named-subdir-makefiles,$(hardware_modules)) diff --git a/modules/fingerprint/Android.mk b/modules/fingerprint/Android.mk new file mode 100644 index 0000000..58c0a83 --- /dev/null +++ b/modules/fingerprint/Android.mk @@ -0,0 +1,25 @@ +# Copyright (C) 2013 The Android Open Source 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_MODULE := fingerprint.default +LOCAL_MODULE_RELATIVE_PATH := hw +LOCAL_SRC_FILES := fingerprint.c +LOCAL_SHARED_LIBRARIES := liblog +LOCAL_MODULE_TAGS := optional + +include $(BUILD_SHARED_LIBRARY) diff --git a/modules/fingerprint/fingerprint.c b/modules/fingerprint/fingerprint.c new file mode 100644 index 0000000..3bdcdab --- /dev/null +++ b/modules/fingerprint/fingerprint.c @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2014 The Android Open Source 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_TAG "FingerprintHal" + +#include <errno.h> +#include <string.h> +#include <cutils/log.h> +#include <hardware/hardware.h> +#include <hardware/fingerprint.h> + +static int fingerprint_close(hw_device_t *dev) +{ + if (dev) { + free(dev); + return 0; + } else { + return -1; + } +} + +static fingerprint_msg_t fingerprint_enroll(unsigned timeout_sec, + unsigned *data) { + (void)timeout_sec; + (void)data; + return FINGERPRINT_ERROR; +} + +static fingerprint_msg_t fingerprint_remove(unsigned fingerprint_id) { + (void)fingerprint_id; + return FINGERPRINT_ERROR; +} + +static fingerprint_msg_t fingerprint_match(unsigned fingerprint_id, + unsigned timeout_sec) { + (void)fingerprint_id; + (void)timeout_sec; + return FINGERPRINT_ERROR; +} + +static int fingerprint_open(const hw_module_t* module, const char* id, + hw_device_t** device) +{ + (void)id; + + if (device == NULL) { + ALOGE("NULL device on open"); + return -EINVAL; + } + + fingerprint_device_t *dev = malloc(sizeof(fingerprint_device_t)); + memset(dev, 0, sizeof(fingerprint_device_t)); + + dev->common.tag = HARDWARE_DEVICE_TAG; + dev->common.version = 0; + dev->common.module = (struct hw_module_t*) module; + dev->common.close = fingerprint_close; + + dev->enroll = fingerprint_enroll; + dev->remove = fingerprint_remove; + dev->match = fingerprint_match; + + *device = (hw_device_t*) dev; + return 0; +} + +static struct hw_module_methods_t fingerprint_module_methods = { + .open = fingerprint_open, +}; + +fingerprint_module_t HAL_MODULE_INFO_SYM = { + .common = { + .tag = HARDWARE_MODULE_TAG, + .module_api_version = FINGERPRINT_MODULE_API_VERSION_1_0, + .hal_api_version = HARDWARE_HAL_API_VERSION, + .id = FINGERPRINT_HARDWARE_MODULE_ID, + .name = "Demo Fingerprint HAL", + .author = "The Android Open Source Project", + .methods = &fingerprint_module_methods, + }, +}; |