diff options
-rw-r--r-- | board/hatch_fp/build.mk | 1 | ||||
-rw-r--r-- | board/nocturne_fp/build.mk | 1 | ||||
-rw-r--r-- | board/nucleo-dartmonkey/build.mk | 1 | ||||
-rw-r--r-- | driver/fingerprint/fpc/bep/fpc_private.c | 2 | ||||
-rw-r--r-- | driver/fingerprint/fpc/bep/fpc_private.h | 3 | ||||
-rw-r--r-- | driver/fingerprint/fpc/libfp/fpc_private.c | 2 | ||||
-rw-r--r-- | driver/fingerprint/fpc/libfp/fpc_private.h | 3 | ||||
-rw-r--r-- | test/build.mk | 1 | ||||
-rw-r--r-- | test/fpsensor_hw.c | 27 | ||||
-rw-r--r-- | test/fpsensor_hw.tasklist | 9 | ||||
-rwxr-xr-x | test/run_device_tests.py | 2 |
11 files changed, 50 insertions, 2 deletions
diff --git a/board/hatch_fp/build.mk b/board/hatch_fp/build.mk index 43a22babf9..7c030b8bfe 100644 --- a/board/hatch_fp/build.mk +++ b/board/hatch_fp/build.mk @@ -30,6 +30,7 @@ test-list-y=\ flash_physical \ flash_write_protect \ fpsensor \ + fpsensor_hw \ mpu \ mutex \ pingpong \ diff --git a/board/nocturne_fp/build.mk b/board/nocturne_fp/build.mk index a26fbca348..f6fd9fe3d9 100644 --- a/board/nocturne_fp/build.mk +++ b/board/nocturne_fp/build.mk @@ -29,6 +29,7 @@ test-list-y=\ flash_physical \ flash_write_protect \ fpsensor \ + fpsensor_hw \ mpu \ mutex \ pingpong \ diff --git a/board/nucleo-dartmonkey/build.mk b/board/nucleo-dartmonkey/build.mk index 3c378c4765..4bc677e7e0 100644 --- a/board/nucleo-dartmonkey/build.mk +++ b/board/nucleo-dartmonkey/build.mk @@ -18,6 +18,7 @@ test-list-y=\ flash_physical \ flash_write_protect \ fpsensor \ + fpsensor_hw \ mpu \ mutex \ pingpong \ diff --git a/driver/fingerprint/fpc/bep/fpc_private.c b/driver/fingerprint/fpc/bep/fpc_private.c index 36ca0fe1b9..0a405d4ad5 100644 --- a/driver/fingerprint/fpc/bep/fpc_private.c +++ b/driver/fingerprint/fpc/bep/fpc_private.c @@ -114,7 +114,7 @@ void fp_sensor_low_power(void) fpc_send_cmd(FPC_CMD_DEEPSLEEP); } -static int fpc_check_hwid(void) +int fpc_check_hwid(void) { uint16_t id; int rc; diff --git a/driver/fingerprint/fpc/bep/fpc_private.h b/driver/fingerprint/fpc/bep/fpc_private.h index 5334779672..9a9acfd42a 100644 --- a/driver/fingerprint/fpc/bep/fpc_private.h +++ b/driver/fingerprint/fpc/bep/fpc_private.h @@ -34,4 +34,7 @@ typedef struct { int fp_sensor_maintenance(uint8_t *image_data, fp_sensor_info_t *fp_sensor_info); +/* Read the HWID from the sensor. */ +int fpc_check_hwid(void); + #endif /* __CROS_EC_FPC_PRIVATE_H */ diff --git a/driver/fingerprint/fpc/libfp/fpc_private.c b/driver/fingerprint/fpc/libfp/fpc_private.c index 8c11849c8f..623f110187 100644 --- a/driver/fingerprint/fpc/libfp/fpc_private.c +++ b/driver/fingerprint/fpc/libfp/fpc_private.c @@ -97,7 +97,7 @@ void fp_sensor_low_power(void) fpc_send_cmd(FPC_CMD_SLEEP); } -static int fpc_check_hwid(void) +int fpc_check_hwid(void) { uint16_t id; int rc; diff --git a/driver/fingerprint/fpc/libfp/fpc_private.h b/driver/fingerprint/fpc/libfp/fpc_private.h index 18feff3a49..95313726f6 100644 --- a/driver/fingerprint/fpc/libfp/fpc_private.h +++ b/driver/fingerprint/fpc/libfp/fpc_private.h @@ -125,4 +125,7 @@ typedef struct { int fp_sensor_maintenance(uint8_t *image_data, fp_sensor_info_t *fp_sensor_info); +/* Read the HWID from the sensor. */ +int fpc_check_hwid(void); + #endif /* __CROS_EC_FPC_PRIVATE_H */ diff --git a/test/build.mk b/test/build.mk index 9dd576aa41..d0dd3eab25 100644 --- a/test/build.mk +++ b/test/build.mk @@ -146,6 +146,7 @@ flash_physical-y=flash_physical.o flash_write_protect-y=flash_write_protect.o fpsensor-y=fpsensor.o fpsensor_crypto-y=fpsensor_crypto.o +fpsensor_hw-y=fpsensor_hw.o fpsensor_state-y=fpsensor_state.o gyro_cal-y=gyro_cal.o gyro_cal_init_for_test.o hooks-y=hooks.o diff --git a/test/fpsensor_hw.c b/test/fpsensor_hw.c new file mode 100644 index 0000000000..1ca4a9f505 --- /dev/null +++ b/test/fpsensor_hw.c @@ -0,0 +1,27 @@ +/* Copyright 2021 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "common.h" +#include "test_util.h" +#include "fpc_private.h" + +/* Hardware-dependent smoke test that makes a SPI transaction with the + * fingerprint sensor. + */ +test_static int test_fp_check_hwid(void) +{ + /* TODO(b/187134801): modify fpc_check_hwid() to return the hwid. */ + if (IS_ENABLED(SECTION_IS_RW)) + TEST_EQ(fpc_check_hwid(), EC_SUCCESS, "%d"); + + return EC_SUCCESS; +} + + +void run_test(int argc, char **argv) +{ + RUN_TEST(test_fp_check_hwid); + test_print_result(); +} diff --git a/test/fpsensor_hw.tasklist b/test/fpsensor_hw.tasklist new file mode 100644 index 0000000000..299cf25390 --- /dev/null +++ b/test/fpsensor_hw.tasklist @@ -0,0 +1,9 @@ +/* Copyright 2021 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * See CONFIG_TASK_LIST in config.h for details. + */ +#define CONFIG_TEST_TASK_LIST diff --git a/test/run_device_tests.py b/test/run_device_tests.py index 4bc4b020ea..7a9730286e 100755 --- a/test/run_device_tests.py +++ b/test/run_device_tests.py @@ -123,6 +123,8 @@ class AllTests: TestConfig(name='flash_write_protect', image_to_use=ImageType.RO, toggle_power=True, enable_hw_write_protect=True), + 'fpsensor_hw': + TestConfig(name='fpsensor_hw'), 'fpsensor_spi_ro': TestConfig(name='fpsensor', image_to_use=ImageType.RO, test_args=['spi']), |