Skip to content

Instantly share code, notes, and snippets.

@XePeleato
Last active March 17, 2024 12:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save XePeleato/3cacd4533a2e2ff41aa7e706c7b2eb17 to your computer and use it in GitHub Desktop.
Save XePeleato/3cacd4533a2e2ff41aa7e706c7b2eb17 to your computer and use it in GitHub Desktop.
Huawei G8 Fingerprint commands
/*
* Copyright (C) 2016 Shane Francis / Jens Andersen
*
* 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.
*/
#ifndef __TZAPI_H_
#define __TZAPI_H_
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define FP_TZAPP_PATH "/firmware/image/"
#define FP_TZAPP_NAME "fingerpr"
//#define FP_TZAPP_PATH "/etc/firmware/"
//#define FP_TZAPP_NAME "fpctzapp"
#define BUFFER_SIZE 64
//enumerate tz app command ID's
enum fingerprint_cmd_t {
FPC_INIT = 0x00, //fpc_ta_init_lib // fpc_tac_send_cmd [0x0000220E]
FPC_ENROLL_START = 0x03, //fpc_tac_begin_enrol // fpc_tac_send_cmd [0x00002596]
FPC_ENROLL_STEP = 0x04, //fpc_ta_enrol // send_cmd UNUSED
FPC_ENROLL_END = 0x05, //fpc_tac_end_enrol // fpc_tac_send_cmd [0x00002726]
FPC_ENROLL_EXTENDED = 0x06, //fpc_tac_enrol_extended // fpc_tac_send_get_extended_enrol_cmd [0x000048B4]
FPC_AUTH_START = 0x07, //fpc_tac_begin_identify // j_fpc_tac_send_begin_identify_cmd [0x00003F70]
FPC_AUTH_STEP = 0x08, //fpc_tac_identify // fpc_tac_send_identify_cmd [0x00004044]
FPC_AUTH_END = 0x09, //fpc_tac_end_identify // fpc_tac_send_cmd [0x00002952]
FPC_CHK_FP_LOST = 0x0B, // fpc_tac_check_finger_lost // fpc_tac_send_get_uint32_cmd [0x00002A8C]
FPC_SET_WAKE = 0x0C, // fpc_tac_wakeup_setup // fpc_tac_send_cmd [0x00002D12]
FPC_GET_WAKE_TYPE = 0x0D, //fpc_ta_wakeup_qualification // fpc_tac_send_cmd [0x00002D5E]
FPC_SET_FP_STORE = 0x21, //fpc_tac_set_active_fingerprint_set // fpc_tac_send_cmd [0x000023FC]
FPC_GET_PRINT_ID = 0x26, // fpc_tac_get_template_id_from_index // fpc_tac_send_get_template_id_from_index_cmd [0x00004134]
FPC_SET_DB_DATA = 0x0E, //fpc_tac_send_set_template_db_path // fpc_tac_send_set_arbitrary_data_cmd [0x00004752]
FPC_GET_DB_LENGTH = 0x13, // fpc_tac_send_get_template_size_cmd UNUSED
FPC_GET_DB_DATA = 0x0F, //fpc_ta_load_template_db // fpc_tac_send_cmd [0x00001F38]
FPC_GET_ID_LIST = 0x11, //fpc_ta_get_indices // fpc_tac_send_get_indices_cmd [0x00003E9A]
FPC_GET_ID_COUNT = 0x12, // fpc_ta_get_template_count // fpc_tac_send_get_uint32_cmd [0x00002B90]
FPC_GET_DEL_PRINT = 0x13, //fpc_ta_delete_template // fpc_tac_send_cmd [0x00002BDC]
FPC_CAPTURE_IMAGE = 0x17, //fpc_ta_capture_image // fpc_tac_send_cmd [0x00002C7C]
FPC_GET_INIT_STATE = 0x20, // fpc_init_lib step 2 // fpc_tac_send_get_uint32_cmd [0x0000221E]
FPC_INIT_UNK_0 = 0x25, // fpc_get_sensor_info UNUSED
FPC_INIT_UNK_1 = 0x26, // fpc_tac_open (check if return 13) engeneering mode UNUSED
};
typedef struct {
uint32_t cmd_id;
uint32_t ret_val; //Some cases this is used for return value of the command
uint32_t length; //Some length of data supplied by previous modified command
uint32_t extra; //Some length of data supplied by previous modified command
} fpc_send_std_cmd_t;
typedef struct {
uint32_t cmd_id;
uint32_t ret_val; //Some cases this is used for return value of the command
uint32_t length; //Some length of data supplied by previous modified command
uint32_t id; //Some length of data supplied by previous modified command
} fpc_send_auth_cmd_t;
typedef struct {
uint32_t cmd_id;
uint32_t ret_val; //Some cases this is used for return value of the command
uint32_t na1; // always 0x45 ?
uint32_t na2; //???
uint32_t na3; //???
uint32_t na4; //???
uint32_t print_index;
} fpc_send_enroll_start_cmd_t;
typedef struct {
uint32_t cmd_id;
uint32_t p1; //Some cases this is used for return value of the command
uint32_t p2; // always 0x45 ?
uint32_t p3; //???
uint32_t p4; //???
uint32_t p5; //???
uint32_t print_count;
} fpc_get_pint_index_cmd_t;
typedef struct {
uint32_t cmd_id;
uint32_t v_addr; //Virtual address of ion mmap buffer
uint32_t length; //Length of data on ion buffer
uint32_t extra; //???
} fpc_send_mod_cmd_t;
typedef struct {
uint32_t cmd_id;
uint32_t v_addr;
uint64_t ret_val; //64bit int
} fpc_send_int64_cmd_t;
#ifdef __cplusplus
}
#endif
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment