From ae5e958a7214588a3c5bb4fe0604af9c8b848187 Mon Sep 17 00:00:00 2001
From: John Klug <john.klug@multitech.com>
Date: Thu, 23 Sep 2021 06:17:16 -0500
Subject: mts-io init script must set serial link even when there is no GPS

---
 recipes-bsp/multitech/mts-io.inc         |  2 +-
 recipes-bsp/multitech/mts-io/mts-io.init | 33 ++++++++++++++++++++------------
 2 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/recipes-bsp/multitech/mts-io.inc b/recipes-bsp/multitech/mts-io.inc
index 8caf810..a00f9aa 100644
--- a/recipes-bsp/multitech/mts-io.inc
+++ b/recipes-bsp/multitech/mts-io.inc
@@ -7,7 +7,7 @@ LIC_FILES_CHKSUM = "file://io-module/COPYING;md5=94d55d512a9ba36caa9b7df079bae19
                     file://io-tool/COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
 "
 do_fetch[depends] += "virtual/kernel:do_shared_workdir"
-INC_PR = "r1"
+INC_PR = "r2"
 
 SRCREV = "${PV}"
 PR = "${INC_PR}.0"
diff --git a/recipes-bsp/multitech/mts-io/mts-io.init b/recipes-bsp/multitech/mts-io/mts-io.init
index 3aa76af..ed0475e 100755
--- a/recipes-bsp/multitech/mts-io/mts-io.init
+++ b/recipes-bsp/multitech/mts-io/mts-io.init
@@ -250,34 +250,43 @@ set_links() {
     [[ -d /var/run/config ]] || mkdir /var/run/config
     gpscap=$(cat ${sysdir}/capability/gps)
 
-    # For all hardware except MTCDTIPHP, the gpscapability
-    # flag indicates whether or not we have a GPS.
-    if ! [[ ${hw_name} =~ ^MTCDTIPHP$ ]] && ((gpscap == 0)) ; then
-        return
-    fi
-    
+
     # Oldest MTRV1 uses venus on ttyS1.
     # Newest MTRV1 usus U-Blox on ttyS1.
     if [[ ${hw_name} == MTRV1 ]] ; then
         case "${hw}" in
             MTRV1-0.0)
-                ln -sf /dev/ttyS1 /dev/gps0
-                echo "venus" >"$GPSCONFIGTYPE"
+                if ((gpscap == 1)) ; then
+                    ln -sf /dev/ttyS1 /dev/gps0
+                    echo "venus" >"$GPSCONFIGTYPE"
+                fi
                 return
                 ;;
             MTRV1-0.1|MTRV1-0.2|MTRV1-0.3)
-                ln -sf /dev/ttyXRUSB0 /dev/gps0
-                echo "u-blox" >"$GPSCONFIGTYPE"
+                if ((gpscap == 1)) ; then
+                    ln -sf /dev/ttyXRUSB0 /dev/gps0
+                    echo "u-blox" >"$GPSCONFIGTYPE"
+                fi
                 return
                 ;;
             *)
-                ln -sf /dev/ttyS1 /dev/gps0
+                if ((gpscap == 1)) ; then
+                    ln -sf /dev/ttyS1 /dev/gps0
+                    echo "u-blox" >"$GPSCONFIGTYPE"
+                fi
                 ln -sf /dev/ttyS4 /dev/ext_serial
-                echo "u-blox" >"$GPSCONFIGTYPE"
                 return
                 ;;
         esac
     fi # MTRV1 hardware version name
+
+    # Continue with non-MTRV1 hardware.
+
+    # For all other hardware except MTCDTIPHP, the gpscapability
+    # flag indicates whether or not we have a GPS.
+    if ! [[ ${hw_name} =~ ^MTCDTIPHP$ ]] && ((gpscap == 0)) ; then
+        return
+    fi
     
     case ${hw_name} in
 	MTR|MTHS)
-- 
cgit v1.2.3