From dd9e9b94d14099a70f981f6a00e459aff9dbc441 Mon Sep 17 00:00:00 2001 From: Andrey G Date: Thu, 21 Jul 2022 01:37:20 +0300 Subject: [PATCH] Linux scripts update and improve (#127) * tools: linux update scripts: more verbose, more checks * tools: can_update: more checks, help --- firmware/tools/can_update.sh | 67 ++++++++++++++++++++++++++++------- firmware/tools/uart_update.sh | 25 ++++++++++--- 2 files changed, 75 insertions(+), 17 deletions(-) diff --git a/firmware/tools/can_update.sh b/firmware/tools/can_update.sh index 1164e7d..b176003 100755 --- a/firmware/tools/can_update.sh +++ b/firmware/tools/can_update.sh @@ -1,26 +1,60 @@ #!/bin/bash +help() +{ + echo "" + echo "Usage:" + echo " can_update.sh board [interface]" + echo " Default interface is can0" + exit -1; +} + +if [ ! -d tools ]; then + echo "Please run this script from firmware directory, not tools!" + help +fi + +if [ -z $1 ]; then + echo "Please provide board name as argunment" + help +fi + +IFACE=can0 + +if [ ! -z $1 ]; then + IFACE=$2 +fi + +if [ ! -d /sys/class/net/$IFACE ]; then + echo "Interface $IFACE is not exist" + help +fi + +if [ $(