-
Notifications
You must be signed in to change notification settings - Fork 95
Expand file tree
/
Copy pathfpsensor_utils.h
More file actions
54 lines (44 loc) · 1.58 KB
/
Copy pathfpsensor_utils.h
File metadata and controls
54 lines (44 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* Copyright 2023 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Misc utilities for fingerprint management */
#ifndef __CROS_EC_FPSENSOR_FPSENSOR_UTILS_H
#define __CROS_EC_FPSENSOR_FPSENSOR_UTILS_H
#include "common.h"
#include "ec_commands.h"
#include <cstdint>
#include <string>
/**
* Test that size+offset does not exceed buffer_size
*
* Returns:
* EC_ERROR_OVERFLOW: if size+offset does not fit in uint32_t
* EC_ERROR_INVAL: if size+offset > buffer_size
* EC_SUCCESS: otherwise
*/
enum ec_error_list validate_fp_buffer_offset(uint32_t buffer_size,
uint32_t offset, uint32_t size);
bool fp_match_success(int match_result);
/**
* @param mode sensor mode
* @return true if the mode is a test capture that requires finger touch.
*/
bool is_finger_needed(uint32_t mode);
/**
* @param capture_type current capture type
* @return true if the capture type is the one where we only care about the
* embedded/offset image bytes to be returned over EC_CMD_FRAME.
* Some capture types (simple, pattern0, pattern1, and reset_test) are only
* interested in the height*width*bpp image bytes that are offset inside the
* frame. Other modes require the full frame.
*/
bool skip_image_offset(enum fp_capture_type capture_type);
/**
* Format an unsigned int FOURCC value as a printable string.
*
* If the character is unprintable, we will print '.', instead.
* This is similar to hexdump's behavior.
*/
const std::string fourcc_to_string(uint32_t value);
#endif /* __CROS_EC_FPSENSOR_FPSENSOR_UTILS_H */