Skip to content

Commit cd79dbb

Browse files
committed
scripts: Use /dev/serial/by-id/*-if00 links instead of hardcoding
Hardcoding /dev/ttyACM{0,1} doesn't work when ports don't enumerate exactly as that. The programmer already seems to enumerate nicely inside `/dev/serial/by-id/*-if{00,02,04}` for control, ec and ap respectively. Why don't we semantically use those? BUG=None TEST=I can use the programmer on lotus without unplugging my led panels (since they always enumerate first) TEST=./flash_azalea_ec.sh ~/framework/cros/src/platform/ec/build/zephyr/marigold/output TEST=DEVICE="/dev/serial/by-id/usb-Framework_CMSIS-1" ./flash_azalea_ec.sh ~/framework/cros/src/platform/ec/build/zephyr/marigold/output TEST=DEVICE="/dev/serial/by-id/usb-Framework_CMSIS-2" ./flash_azalea_ec.sh ~/framework/cros/src/platform/ec/build/zephyr/marigold/output
1 parent 381ac9e commit cd79dbb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

scripts/flash_azalea_ec.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/bin/bash
22

3-
CTRLUART=/dev/ttyACM0
4-
FLASHUART=ttyACM1
3+
DEVICE=${DEVICE:-"/dev/serial/by-id/usb-Framework_CMSIS-"}
4+
CTRLUART=(${DEVICE}*-if00)
5+
FLASHUART=$(basename $(readlink ${DEVICE}*-if02))
56

67
if [ $# -eq 0 ]; then
78
#no argument, try default locations
@@ -28,7 +29,7 @@ echo "USING ${FLASH_SRC} to flash EC"
2829
echo -e "\n" > ${CTRLUART}
2930
#put ec into reset
3031
echo -e "\npin 21 0 opendrain\n" > ${CTRLUART}
31-
#read INPUT < /dev/ttyACM0
32+
#read INPUT < ${CTRLUART}
3233
sleep 1
3334

3435
#enable 10k external pulldown on UART RX wired to pin 20
@@ -48,7 +49,7 @@ echo "Using NUVOTON Tool ./uartupdatetool"
4849

4950
#put ec into reset
5051
echo -e "\npin 21 0 opendrain\n" > ${CTRLUART}
51-
#read INPUT < /dev/ttyACM0
52+
#read INPUT < ${CTRLUART}
5253
sleep 1
5354

5455
#disable 10k external pulldown on UART RX wired to pin 20

0 commit comments

Comments
 (0)