Skip to content

Instantly share code, notes, and snippets.

@cstrahan
Last active January 31, 2025 20:13

Revisions

  1. cstrahan revised this gist Jun 17, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ Configure minicom with `minicom -s` and enter the “File transfer protocols”
    | Field | Value |
    | ------- | -------------- |
    | Name | Binary |
    | Program | bin-xfer -o %1 |
    | Program | bin-xfer -o %l |
    | Name | Y |
    | U/D | U |
    | FullScr | Y |
  2. cstrahan created this gist Jun 17, 2013.
    12 changes: 12 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    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 %1 |
    | Name | Y |
    | U/D | U |
    | FullScr | Y |
    | IO-Red | N |
    | Multi | N |
    43 changes: 43 additions & 0 deletions bin-xfer.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,43 @@
    #!/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