diff options
author | Craig Hesling <hesling@chromium.org> | 2021-05-24 19:29:03 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-06-01 01:30:10 +0000 |
commit | 1fba349593d112073a911ff3a9962f5cee7615ec (patch) | |
tree | 6732d93538cc63398a3fa2de380d80f45392b0c0 /util/flash_fp_mcu | |
parent | 4319470ce35f471681c776df2f65dbce9efa71f2 (diff) | |
download | chrome-ec-1fba349593d112073a911ff3a9962f5cee7615ec.tar.gz |
flash_fp_mcu: Add automatic service stop/restart
The normal invocation of flash_fp_mcu is without biod and timberslide
being stopped. This is a problem, since this script unbinds/bind
drivers that biod and timberslide have open and can interact with.
BRANCH=none
BUG=b:188985272 b:181635081
TEST=# On Nocturne
scp util/flash_fp_mcu dut1:/usr/local/bin/flash_fp_mcu
ssh dut1 flash_fp_mcu --hello
# Ensure that the biod and timebrslide were stopped and restarted.
# No warnings about other services having files open should occur.
ssh dut1 flash_fp_mcu --noservices --hello
# Ensure that no services were stopped/started and a warning should
# be emitted about processes with the device file open.
ssh dut1 flash_fp_mcu --noservices --hello
# Should see that the warnings shown now show that the open file
# was deleted.
Cq-Depend: chromium:2918383, chromium:2918638
Signed-off-by: Craig Hesling <hesling@chromium.org>
Change-Id: I021b922fb58defcbe608492239e311a5f5296fca
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2914502
Reviewed-by: Josie Nordrum <josienordrum@google.com>
Diffstat (limited to 'util/flash_fp_mcu')
-rw-r--r-- | util/flash_fp_mcu | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/util/flash_fp_mcu b/util/flash_fp_mcu index ef67677d82..3f93e613dc 100644 --- a/util/flash_fp_mcu +++ b/util/flash_fp_mcu @@ -19,6 +19,8 @@ DEFINE_boolean 'remove_flash_write_protect' "${FLAGS_TRUE}" \ DEFINE_integer 'retries' "${DEFAULT_RETRIES}" 'Specify number of retries' 'R' DEFINE_integer 'baudrate' "${STM32MON_SERIAL_BAUDRATE}" 'Specify UART baudrate' 'B' DEFINE_boolean 'hello' "${FLAGS_FALSE}" 'Only ping the bootloader' 'H' +DEFINE_boolean 'services' "${FLAGS_TRUE}" \ + 'Stop and restart conflicting fingerprint services' 's' FLAGS_HELP="Usage: ${0} [flags] [ec.bin]" # EXIT_SUCCESS=0 @@ -574,6 +576,12 @@ main() { exit "${EXIT_CONFIG}" fi + if [[ "${FLAGS_services}" -eq "${FLAGS_TRUE}" ]]; then + echo "# Stopping biod and timberslide" + stop biod + stop timberslide LOG_PATH=/sys/kernel/debug/cros_fp/console_log + fi + # If cros-ec driver isn't bound on startup, this means the final rebinding # may fail. if [[ ! -c "/dev/cros_fp" ]]; then @@ -603,6 +611,7 @@ main() { echo "See b/188985272." >&2 fi + local ret flash_fp_mcu_stm32 \ "${TRANSPORT}" \ "${DEVICE}" \ @@ -610,7 +619,15 @@ main() { "${GPIO_BOOT0}" \ "${GPIO_PWREN}" \ "${filename}" - exit $? + ret=$? + + if [[ "${FLAGS_services}" -eq "${FLAGS_TRUE}" ]]; then + echo "# Restarting biod and timberslide" + start timberslide LOG_PATH=/sys/kernel/debug/cros_fp/console_log + start biod + fi + + exit "${ret}" } main "$@" |