static int fingerprint_remove(struct fingerprint_device __unused *dev,
                              uint32_t gid, uint32_t fid)
{


    if (fpc_del_print_id(fid) == 0){
        fingerprint_msg_t msg;
        msg.type = FINGERPRINT_TEMPLATE_REMOVED;
        msg.data.removed.finger.fid = fid;
        msg.data.removed.finger.gid = gid;
        callback(&msg);

        uint32_t db_length = fpc_get_user_db_length();
        ALOGD("%s : User Database Length Is : %lu", __func__,(unsigned long) db_length);
        fpc_store_user_db(db_length, db_path);
        return 0;
    } else {
        fingerprint_msg_t msg;
        msg.type = FINGERPRINT_ERROR;
        msg.data.error = FINGERPRINT_ERROR_UNABLE_TO_REMOVE;
        callback(&msg);

        return FINGERPRINT_ERROR;
    }
}
示例#2
0
static int fingerprint_remove(struct fingerprint_device __unused *dev,
                              uint32_t __unused gid, uint32_t __unused fid)
{

    //Maximum prints per gid is 5
    uint32_t prints[5];
    uint32_t print_count = fpc_get_print_count();

    fpc_get_pint_index_cmd_t print_indexs = fpc_get_print_index(print_count);

    //populate print array with index
    prints[0] = print_indexs.p1;
    prints[1] = print_indexs.p2;
    prints[2] = print_indexs.p3;
    prints[3] = print_indexs.p4;
    prints[4] = print_indexs.p5;

    ALOGI("%s : delete print : %lu", __func__,(unsigned long) fid);

    for (int i = 0; i < 5; i++){
        uint32_t print_id = fpc_get_print_id(prints[i]);

        ALOGI("%s : found print : %lu at index %d", __func__,(unsigned long) print_id, i);

        if (print_id == fid){
            ALOGI("%s : Print index found at : %d", __func__, i);

            int ret = fpc_del_print_id(prints[i]);

            ALOGI("%s : fpc_del_print_id returns : %d", __func__, ret);

            if (ret == 0){

                uint32_t db_length = fpc_get_user_db_length();
                ALOGI("%s : User Database Length Is : %lu", __func__,(unsigned long) db_length);
                fpc_store_user_db(db_length, db_path);

                fingerprint_msg_t msg;
                msg.type = FINGERPRINT_TEMPLATE_REMOVED;
                msg.data.removed.finger.fid = print_id;
                msg.data.removed.finger.gid = 0;
                callback(&msg);

                return 0;
            }
        }
    }
    return FINGERPRINT_ERROR;
}