Skip to content

Instantly share code, notes, and snippets.

@suprematis
Forked from cstrahan/README.md
Created April 7, 2023 00:22
Show Gist options
  • Save suprematis/c3cabe99344980429d50f954f4506522 to your computer and use it in GitHub Desktop.
Save suprematis/c3cabe99344980429d50f954f4506522 to your computer and use it in GitHub Desktop.
Binary transfer script for minicom.

Configure minicom with minicom -s and enter the “File transfer protocols” section. You can add a section there called “binary”, point it at your file, and specify:

Field Value
Name Binary
Program bin-xfer -o %l
Name Y
U/D U
FullScr Y
IO-Red N
Multi N
#!/bin/sh
INFILE=/dev/null
OUTFILE=/dev/null
function exists {
command -v $1 >/dev/null 2>&1
}
while [ $# -gt 0 ]; do
case "$1" in
-i)
shift
INFILE="$1"
;;
-o)
shift
OUTFILE="$1"
;;
-h|--help)
echo "$0 -i infile -o outfile"
;;
*)
INFILE="$1"
esac
shift
done
cat << EOF
binary-xfer utility for minicom
Sending file ${INFILE} to ${OUTFILE}
EOF
if (exists pv); then
pv --force -i 0.25 -B 128 ${INFILE} 2>&1 > ${OUTFILE}
else
cat ${INFILE} > ${OUTFILE}
fi
cat << EOF
File transfer complete
EOF
sleep 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment