diff options
author | Scott Murray <scott.murray@konsulko.com> | 2021-02-04 10:22:10 -0500 |
---|---|---|
committer | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2021-02-05 11:54:16 +0000 |
commit | da9aad9b0bda135578d017fa68c0db751e82b2e4 (patch) | |
tree | 5501206d7bd44c87cec918ad8eceaf1e95b2160b /meta-agl-bsp/meta-agl-refhw-gen3/recipes-navigation/gpsd/files | |
parent | 48fd4407babad2df5dba0aeb57c832a9ab531c0d (diff) |
meta-agl-bsp: Add reference hardware GPS support
Add recipe for gpsd configuration for the reference hardware, which
also installs a script plus systemd unit drop-in to handle enabling
and disabling it. The latter is required due to the reference
hardware's reuse of the h3ulcb image, which means the existing
PREFERRED_PROVIDER_virtual/gpsd-conf scheme is not sufficient in
this case.
Bug-AGL: SPEC-3792
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: Ifaf3b93d06825f7c5c6a8ce2773d93931e47178c
Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/25994
Tested-by: Jenkins Job builder account
ci-image-build: Jenkins Job builder account
ci-image-boot-test: Jenkins Job builder account
Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
Diffstat (limited to 'meta-agl-bsp/meta-agl-refhw-gen3/recipes-navigation/gpsd/files')
4 files changed, 74 insertions, 0 deletions
diff --git a/meta-agl-bsp/meta-agl-refhw-gen3/recipes-navigation/gpsd/files/gpsd.refhw b/meta-agl-bsp/meta-agl-refhw-gen3/recipes-navigation/gpsd/files/gpsd.refhw new file mode 100644 index 000000000..d22970681 --- /dev/null +++ b/meta-agl-bsp/meta-agl-refhw-gen3/recipes-navigation/gpsd/files/gpsd.refhw @@ -0,0 +1,5 @@ +# Default settings for gpsd. +START_DAEMON="true" +GPSD_OPTIONS="" +DEVICES="/dev/ttySC3" +GPSD_SOCKET="/var/run/gpsd.sock" diff --git a/meta-agl-bsp/meta-agl-refhw-gen3/recipes-navigation/gpsd/files/refhw-gpsd-helper.sh b/meta-agl-bsp/meta-agl-refhw-gen3/recipes-navigation/gpsd/files/refhw-gpsd-helper.sh new file mode 100644 index 000000000..d183ba43c --- /dev/null +++ b/meta-agl-bsp/meta-agl-refhw-gen3/recipes-navigation/gpsd/files/refhw-gpsd-helper.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# +# Script to detect AGL Reference Hardware and switch gpsd +# configuration as necessary. +# +# 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 +if [ ! \( -f "$COMPAT" -a -f /etc/default/gpsd.refhw \) ]; then + exit 0 +fi + +found=false +for c in `cat $COMPAT | tr '\0' ' '`; do + if echo $c | grep -q '^agl,refhw-h3$'; then + found=true + break + fi +done + +if $found; then + if [ ! -c "$GPSTTY" ]; then + exit 0 + fi + update-alternatives --install /etc/default/gpsd gpsd-defaults /etc/default/gpsd.refhw 20 +else + update-alternatives --install /etc/default/gpsd gpsd-defaults /etc/default/gpsd.refhw 5 +fi +exit 0 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 diff --git a/meta-agl-bsp/meta-agl-refhw-gen3/recipes-navigation/gpsd/files/refhw.conf b/meta-agl-bsp/meta-agl-refhw-gen3/recipes-navigation/gpsd/files/refhw.conf new file mode 100644 index 000000000..b7e3a7b0d --- /dev/null +++ b/meta-agl-bsp/meta-agl-refhw-gen3/recipes-navigation/gpsd/files/refhw.conf @@ -0,0 +1,2 @@ +[Service] +ExecStartPre=-/usr/sbin/refhw-gpsd-helper.sh |