diff options
Diffstat (limited to 'recipes-bsp/multitech')
-rwxr-xr-x | recipes-bsp/multitech/get-eeprom-device-info/get-eeprom-device-info.sh | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/recipes-bsp/multitech/get-eeprom-device-info/get-eeprom-device-info.sh b/recipes-bsp/multitech/get-eeprom-device-info/get-eeprom-device-info.sh index e67a53f..b84b360 100755 --- a/recipes-bsp/multitech/get-eeprom-device-info/get-eeprom-device-info.sh +++ b/recipes-bsp/multitech/get-eeprom-device-info/get-eeprom-device-info.sh @@ -1,4 +1,6 @@ #!/bin/bash +# Radio ID loop count +TRY_COUNT=30 CONFIG_PATH=/var/run/config @@ -28,6 +30,14 @@ TEMP_AC_JSON="$TEMP_AC_PATH/ac_data.json" # Number of accessory card places - size of array AC_CARD_COUNT=4 +function usage { + echo 'get-eeprom-device-info [-t TRY_COUNT]' + echo ' Where TRY_COUNT is the number of half' + echo ' second waits for the cellular radio' + echo ' to be ready for identification' + exit 1 +} + # Reads accessory cards data # WARNING: Make sure function called after CAPABILITIY_* variables is set with initial values. ReadAcData() { @@ -109,6 +119,23 @@ isNativeLoraPresent() { fi } +TEMP=$(getopt -o t: -n 'get-eeprom-device-info' -- "$@") +eval set -- "$TEMP" +# extract options and their arguments into variables. +while true ; do + case "$1" in + -t) + case "$2" in + "") usage ;; + *) TRY_COUNT=$2 ; shift 2 ;; + esac ;; + --) shift ; break ;; + *) echo "usage" ;; + esac +done + +echo TRY_COUNT IS $TRY_COUNT + # Read device information from eeprom device mts-id-eeprom --in-file /sys/bus/i2c/devices/i2c-0/0-0056/eeprom > ${CONFIG_PATH}/device_info @@ -170,7 +197,6 @@ fi done <${CONFIG_PATH}/device_info -TRY_COUNT=30 echo "Finding cellular module..." for ((i=0; i < TRY_COUNT; i++)) do @@ -180,7 +206,9 @@ for ((i=0; i < TRY_COUNT; i++)) CAPABILITY_CELL="true" break fi - sleep 0.5 + if ((TRY_COUNT > 1)) ; then + sleep 0.5 + fi done if isNativeLoraPresent; then |