2023-05-18 18:45:38 -05:00
|
|
|
#!/usr/bin/env bash
|
2023-01-04 19:55:59 -06:00
|
|
|
|
|
|
|
BKPPATH="firmware-backups"
|
|
|
|
|
2023-02-19 19:18:39 -06:00
|
|
|
mkdir -p "$BKPPATH"
|
2023-01-04 19:55:59 -06:00
|
|
|
|
|
|
|
NOW=$(date +%s)
|
|
|
|
|
2023-02-20 04:13:03 -06:00
|
|
|
num=$(find /dev -name 'ttyACM*' | sort | rev | cut -c 1)
|
2023-02-19 19:18:39 -06:00
|
|
|
echo com is: "$num"
|
|
|
|
mapfile -t splitPorts <<< "$num"
|
2023-01-04 19:55:59 -06:00
|
|
|
echo "This tool assumes your buds are the only thing connected and are enumerated {right,left} order. YMMV"
|
|
|
|
echo "Right bud is at ${splitPorts[0]}"
|
|
|
|
echo "Left bud is at ${splitPorts[1]}"
|
|
|
|
|
|
|
|
echo "Please disconnect and reconnect the bud on the right"
|
2023-02-19 19:18:39 -06:00
|
|
|
bestool read-image --port "/dev/ttyACM${splitPorts[0]}" "${BKPPATH}/firmware-${NOW}-${splitPorts[0]}.bin.bkp"
|
2023-01-04 19:55:59 -06:00
|
|
|
|
|
|
|
echo "Please disconnect and reconnect the bud on the left"
|
2023-02-19 19:18:39 -06:00
|
|
|
bestool read-image --port "/dev/ttyACM${splitPorts[1]}" "${BKPPATH}/firmware-${NOW}-${splitPorts[1]}.bin.bkp"
|