From 3e95c41c0d3056c7949e698e6cf679eda23ca8aa Mon Sep 17 00:00:00 2001 From: Nick Anstee Date: Thu, 9 May 2024 19:00:34 +0200 Subject: [PATCH] Update uart_log.sh Pick the serial device by ID, allowing us to safely predict the paths to find the left and right bud at Also improve the script so it asks which bud we'd like to debug Specify necessary minicom options, so it opens even if the default configuration is invalid --- uart_log.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/uart_log.sh b/uart_log.sh index 4edec55..3ae39c7 100755 --- a/uart_log.sh +++ b/uart_log.sh @@ -1,5 +1,11 @@ #!/usr/bin/env sh -num=$(find /dev -name 'ttyUSB*' | rev | cut -c 1) -echo "$num" -sudo minicom "port$num" +rightbud=/dev/serial/by-id/usb-wch.cn_USB_Dual_Serial_0123456789-if00 +leftbud=/dev/serial/by-id/usb-wch.cn_USB_Dual_Serial_0123456789-if02 + +read -p "Which bud do you want to connect to UART for? L/R (default L): " -n 1 -r +ttydev=$leftbud +if [[ $REPLY =~ ^[Rr]$ ]]; then + ttydev=$rightbud +fi +sudo minicom -D $ttydev -b 2000000