diff --git a/recipes-bsp/v2x-ieee802.11p/files/v2x-fw-load b/recipes-bsp/v2x-ieee802.11p/files/v2x-fw-load index 03d84bb..bbfa4e7 100755 --- a/recipes-bsp/v2x-ieee802.11p/files/v2x-fw-load +++ b/recipes-bsp/v2x-ieee802.11p/files/v2x-fw-load @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh SCRIPT_NAME=$(basename "${0}") @@ -11,18 +11,20 @@ IS_PLACEHOLDER_FW=false #********************************************************************************************** # local helper functions #********************************************************************************************** -function printUsage() +printUsage() { - echo -e "\\nUsage: ${SCRIPT_NAME} [OPT] CMD \\n\\n" - echo -e " CMD:" - echo -e " -h|--help Show this help" - echo -e "" - echo -e " OPT:" - echo -e " -c|--config-file=FILE The config file pathname (default=${V2X_CONF})" - echo -e "" + echo "" + echo "Usage: ${SCRIPT_NAME} [OPT] CMD" + echo "" + echo " CMD:" + echo " -h|--help Show this help" + echo "" + echo " OPT:" + echo " -c|--config-file=FILE The config file pathname (default=${V2X_CONF})" + echo "" } -function checkInputParameters() +checkInputParameters() { if [ ! -f $V2X_RST ]; then echo "ERROR $SCRIPT_NAME: v2x module reset lines not available" @@ -34,18 +36,17 @@ function checkInputParameters() fi } -function getConfigParameters() +getConfigParameters() { echo "$SCRIPT_NAME: getting config parameter from $V2X_CONF" placeholderEntry=$(grep is-placeholder-firmware $V2X_CONF | cut -d'=' -f2) - if [[ "${placeholderEntry}" != "" && "${placeholderEntry}" == "true" ]]; then + if [ "${placeholderEntry}" != "" ] && [ "${placeholderEntry}" = "true" ]; then IS_PLACEHOLDER_FW=true fi } -function enableTheModule() +enableTheModule() { - local pwrGpio pwrGpio="$(gpiofind UM_SUP_EN)" echo "$SCRIPT_NAME: releasing v2x reset..." @@ -54,22 +55,21 @@ function enableTheModule() echo "$SCRIPT_NAME: toggling v2x module power..." gpioset -m time -s 1 $pwrGpio=0 gpioset -m signal $pwrGpio=1 & - PWR_GPIO_PID=$! } -function detectDfuMode() +detectDfuMode() { - local timeoutS=30 + timeoutS=30 echo "$SCRIPT_NAME: discovering DFU mode of v2x module (timeout=${timeoutS}s)..." timeout $timeoutS bash -c -- 'while true; do lsusb | grep "0483:df11"; if [ $? == 0 ]; then break; fi; done' - if [ $? == 124 ]; then + if [ $? = 124 ]; then echo "ERROR: v2x module is not available on usb bus" exit 1 fi } -function loadFirmware() +loadFirmware() { echo "$SCRIPT_NAME: loading v2x firmware..." output=$(dfu-util -d 0483:df11 -s 0x10000000 -D /lib/firmware/v2x/SECTON.packed_bin.rom 2>&1) @@ -112,7 +112,7 @@ getConfigParameters enableTheModule -if [ $IS_PLACEHOLDER_FW == true ]; then +if [ $IS_PLACEHOLDER_FW = true ]; then echo "$SCRIPT_NAME: v2x placeholder firmware configured" exit 0 fi