1
0
Fork 0

bashrc: "dynamically" connect to serial console with baud-rate and also the console itself

This commit is contained in:
Pratham Patel 2024-01-27 19:08:10 +05:30
parent 198aee37a2
commit 2c0f553087
Signed by: thefossguy
SSH Key Fingerprint: SHA256:/B3wAg7jnMEBQ2JwkebbS/eXVZANDmqRfnd9QkIhxMI
1 changed files with 13 additions and 1 deletions

14
.bashrc
View File

@ -61,6 +61,18 @@ function list_open_ports() {
fi
}
function tty_serial() {
if [[ -n "$1" ]]; then
if [[ -n "$2" ]]; then
picocom --quiet --baud "$2" "/dev/ttyUSB$1"
else
picocom --quiet --baud 115200 "/dev/ttyUSB$1"
fi
else
picocom --quiet --baud 115200 /dev/ttyUSB0
fi
}
# alias wrappers to call scripts
SCRIPTS_DIR="${HOME}/.local/scripts/other-common-scripts"
alias debextract="${SCRIPTS_DIR}/extract-deb-pkg.sh"
@ -81,7 +93,7 @@ alias drivetemp='hdparm -CH'
alias mtr='mtr --show-ips --displaymode 0 -o "LDR AGJMXI"'
alias nixcheckconf="rsync --fsync ${RSYNC_OPTIONS} --dry-run --checksum ${HOME}/my-git-repos/pratham/prathams-nixos/nixos-configuration/ /etc/nixos/"
alias prettynixbuild='nix build --log-format internal-json -v . 2>&1 | nom --json'
alias serialterm='clear && picocom --quiet --baud 115200 /dev/ttyUSB0'
alias serialterm="tty_serial"
alias sudo='sudo '
alias unxz='unxz --keep' # override 'unxz' with this to always keep the archive
alias update="source ${HOME}/.bashrc"