Skip to content

Instantly share code, notes, and snippets.

@cstrahan
Last active June 10, 2023 01:15
Show Gist options
  • Save cstrahan/5796653 to your computer and use it in GitHub Desktop.
Save cstrahan/5796653 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
@norbert616
Copy link

Thank you! I can transfer binary file via minicom without teraterm.

@msaufyrohmad
Copy link

i still cant transfer my .bin file

@p-mercury
Copy link

Thank you for this resource, I appreciate your work and time.

I have a quick question, I downloaded minicom trough homebrew and then I created a file called bin-xfer in the same directory as the ascii-xfr file, I made sure to give the new one the same execution permissions as the ascii-xfr file and made sure the bin-xfer works by simply calling it from the terminal.

The issue is that after I create the custom file transfer protocol in minicom and then run it, something goes wrong and it simply does not do anything. Do you by any chance have an idea why this might be happening?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment