summaryrefslogtreecommitdiffstats
path: root/meta-agl-bsp/meta-agl-refhw-gen3/recipes-navigation/gpsd/files/refhw-gpsd-helper.sh.bak
diff options
context:
space:
mode:
Diffstat (limited to 'meta-agl-bsp/meta-agl-refhw-gen3/recipes-navigation/gpsd/files/refhw-gpsd-helper.sh.bak')
-rw-r--r--meta-agl-bsp/meta-agl-refhw-gen3/recipes-navigation/gpsd/files/refhw-gpsd-helper.sh.bak32
1 files changed, 32 insertions, 0 deletions
diff --git a/meta-agl-bsp/meta-agl-refhw-gen3/recipes-navigation/gpsd/files/refhw-gpsd-helper.sh.bak b/meta-agl-bsp/meta-agl-refhw-gen3/recipes-navigation/gpsd/files/refhw-gpsd-helper.sh.bak
new file mode 100644
index 000000000..2c9089aa0
--- /dev/null
+++ b/meta-agl-bsp/meta-agl-refhw-gen3/recipes-navigation/gpsd/files/refhw-gpsd-helper.sh.bak
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Script to detect AGL Reference Hardware and switch gpdf configuration
+# as needed.
+#
+# NOTE:
+# For the most part errors are ignored and the script returns
+# 0/success so gpsd still be started if the script is somehow
+# run on a board without the expected hardware.
+
+COMPAT=/sys/firmware/devicetree/base/compatible
+GPSTTY=/dev/ttySC3
+
+if [ ! \( -f "$COMPAT" -a -c "$GPSTTY" -a -f /etc/default/gpsd.refhw \) ]; then
+ exit 0
+fi
+
+found=false
+for c in `cat $COMPAT | tr '\0' ' '`; do
+ echo "c = $c"
+ if echo $c | grep -q '^agl,refhw-h3$'; then
+ found=true
+ break
+ fi
+done
+
+if $found; then
+ update-alternatives --install /etc/default/gpsd gpsd-defaults /etc/default/gpsd.refhw 20
+else
+ update-alternatives --remove gpsd-defaults /etc/default/gpsd.refhw
+fi
+exit 0