From abc11d883c513043f2ca037ce3c79e75008d829d Mon Sep 17 00:00:00 2001 From: Todd Broch Date: Tue, 12 Mar 2013 09:37:47 -0700 Subject: [PATCH] stm32: Force disconnect of UART prior to writing firmware. For chromeos devices with the stm32 EC we write the firmware via uart. Often developers are connected to this UART for console I/O which causes flash_ec to fail. This change looks for any pids currently attached to the UART and forcibly kills them prior to attempting to write the firmware. Signed-off-by: Todd Broch BRANCH=spring BUG=none TEST=manual, ./util/flash_ec --board spring ... Forcibly grabs UART from both: cu -l /dev/pts/ minicom -p /dev/pts/ Change-Id: Ie2a2b7aaf437c2cedd1d16e399c63068f2b02da3 Reviewed-on: https://gerrit.chromium.org/gerrit/45217 Reviewed-by: Vadim Bendebury Reviewed-by: Vincent Palatin Commit-Queue: Todd Broch Tested-by: Todd Broch --- util/flash_ec | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/util/flash_ec b/util/flash_ec index 3fbe203e27..2680f9e58f 100755 --- a/util/flash_ec +++ b/util/flash_ec @@ -104,6 +104,14 @@ function servo_restore() { done } +function free_pty() { + pids=$(lsof -F p 2>/dev/null -- $1 | cut -d'p' -f2) + if [ "${pids}" != "" ]; then + kill -9 ${pids} + info "You'll need to re-launch console on $1" + fi +} + # Board specific flashing scripts function flash_daisy() { @@ -118,6 +126,7 @@ function flash_daisy() { fi info "Using serial flasher : ${STM32MON}" + free_pty ${EC_UART} dut_control uart1_en:on dut_control uart1_parity:even