Skip to content

Instantly share code, notes, and snippets.

@cr1901
Created December 13, 2017 14:36
Show Gist options
  • Save cr1901/24a9b0e52ff2503ef27f7c8ca1e9c55f to your computer and use it in GitHub Desktop.
Save cr1901/24a9b0e52ff2503ef27f7c8ca1e9c55f to your computer and use it in GitHub Desktop.
HDMI2USB XMODEM Helper Script
#!/bin/sh
if [ "$#" -lt 3 ]; then
echo "Usage: $0 bin-file address interface" >&2
exit 1
fi
LEN_CRC=`~/bin/getcrc32.py $1 | cut -d' ' -f2-`
PROG_CMD="write spi xmodem $2 $LEN_CRC"
echo "$PROG_CMD" > $3
sleep 1 # If we don't have this, we can accidentally send before
# the receiver is ready. Will wait 10 seconds before
# transmitting.
sx -kvv $1 < $3 > $3
stdbuf -oL grep -m 1 -e "successfully" -e "error" -e "failed" $3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment