Skip to content

Instantly share code, notes, and snippets.

@csexton
Created March 13, 2015 18:44
Show Gist options
  • Save csexton/8af10f0ee558749fbcc6 to your computer and use it in GitHub Desktop.
Save csexton/8af10f0ee558749fbcc6 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Utility to try every dfu method so that we don't have to care which firmware is installed
# Known DFU codes (see id-beacon-type/fingerprint.yaml for latest)
NATIVE_BLUEGIGA="0001090001"
RADBEACON2_1="aa"
RADBEACON2_0="aa"
RADBEACON1_0="30"
SBEACON_POC="aaaaaaaaaaaaaa"
SBEACON_DEV="aaaaaaaabbbbbb"
# "Nice" DFU mode, not in fingerprint.yaml, part of firmware
NICE="0530303030"
PORT=${1:-/dev/cu.usbmodem1}
echo "Sending all known dfu commands to the device"
echo "port: $PORT"
echo
echo "NOTE: Newer devices (RadBeaconv2.0+, Sbeacon DEV) can go into DFU mode"
echo "without generating an error, as long as the device uses the default PIN"
echo "For those devices, a status response is given"
echo " success: 02 fe"
echo " failure: 02 ff"
echo
echo "All other devices will generate errors on success or failure,"
echo "including the above devices if the PIN is not known"
echo "However the device will be in DFU mode if it's one of the known devices"
echo
echo
# ToDo: Stop trying after successful DFU
echo "Trying:"
echo "Nice: ./rbcomser $PORT $NICE"
rbcomser $PORT $NICE
echo "Native Bluegiga:./rbcomser $PORT $NATIVE_BLUEGIGA"
rbcomser $PORT $NATIVE_BLUEGIGA
echo "Force RadBeacon v2.1: ./rbcomser $PORT $RADBEACON2_1"
rbcomser $PORT $RADBEACON2_1
echo "Force RadBeacon v2.0: ./rbcomser $PORT $RADBEACON2_0"
rbcomser $PORT $RADBEACON2_0
echo "RadBeacon v1.0: ./rbcomser $PORT $RADBEACON1_0"
rbcomser $PORT $RADBEACON1_0
echo "Force Samsung Beacon DEV: ./rbcomser $PORT $SBEACON_DEV"
rbcomser $PORT $SBEACON_DEV
echo "Samsung Beacon POC: ./rbcomser $PORT $SBEACON_POC"
rbcomser $PORT $SBEACON_POC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment