diff --git a/add-to-export-sh.txt b/add-to-export-sh.txt index 57cf37e..c1aa9bf 100644 --- a/add-to-export-sh.txt +++ b/add-to-export-sh.txt @@ -27,7 +27,6 @@ binDir="$ESPIDFTOOLS_INSTALLDIR/.custom_bin" echo -e "\nChecking for Serial Devices in dmesg\n" COUNTER=0 -# devarr=() declare -a devarr for line in $(dmesg | tail -50 | grep -o -E "tty[A-Z]{3}[0-9]{0,2}" | sort -u); do echo -e "$COUNTER /dev/$line" diff --git a/custom_bin/changeport.sh b/custom_bin/changeport.sh index d9ee500..e1d87a1 100644 --- a/custom_bin/changeport.sh +++ b/custom_bin/changeport.sh @@ -1,4 +1,37 @@ #!/bin/bash + +# handle manuallyy fiven +if [ ! -z "$1" ]; then + export ESPPORT="$1" + echo "ESPPORT set to $ESPPORT" + exit 0 +fi + +# gloals +COUNTER=0 +declare -a devarr + +# hunt dmesg for tty funss and maek da selector thng +for line in $(dmesg | tail -50 | grep -o -E "tty[A-Z]{3}[0-9]{0,2}" | sort -u); do + echo -e "$COUNTER /dev/$line" + devarr[$COUNTER]="/dev/$line" + COUNTER=$(($COUNTER+1)) +done + +# get dat bynverr +if [ $COUNTER -gt 0 ]; then + echo -e "\nEnter TTY Number You'd Like:" + read tty + ttyselect="${devarr[$tty]}" +else + echo -e "\nNo Serial Devices Found, Select one later with 'changeport'\n" +fi + +# finally expport +export ESPPORT="$ttyselect" +echo "ESPPORT set to $ESPPORT" + +exit 0 function subprocess() { echo -e "\nChanging ESPPORT\n" echo -e "\nChecking for Serial Devices in dmesg\n"