diff --git a/recipes-connectivity/ublox-gsm-fw-update/files/gsm-fw-update b/recipes-connectivity/ublox-gsm-fw-update/files/gsm-fw-update index 70824f2..0a9043c 100755 --- a/recipes-connectivity/ublox-gsm-fw-update/files/gsm-fw-update +++ b/recipes-connectivity/ublox-gsm-fw-update/files/gsm-fw-update @@ -34,13 +34,14 @@ if [ $? -eq 0 ]; then systemctl stop ModemManager fi -# Empty data in serial device +echo Empty data in serial device printf '\r\n' > $TTY_DEVICE -timeout 5 cat $TTY_DEVICE > /dev/null +timeout -k 5 5 cat $TTY_DEVICE > /dev/null +timeout -k 5 5 cat $TTY_DEVICE > /dev/null -# Check running version +echo Check running version printf '\r\nAT+CGMR\r\n' > $TTY_DEVICE -timeout 5 cat $TTY_DEVICE | grep -B3 -m 1 "OK" | grep "$FW_VERSION" +timeout -k 5 5 cat $TTY_DEVICE | grep -B3 -m 1 "OK" | grep "$FW_VERSION" if [ $? -eq 0 ]; then echo "The modem is already running the same FW version" @@ -53,6 +54,8 @@ else systemctl restart ublox-gsm-config fi +rm -rf $TMP_PATH + if [ "$MM_RUNNING" = "1" ]; then echo "Restarting ModemManager" systemctl start ModemManager