gnss-init: reverted the gnss-init service back to "original" state

Reason for reverting to originial state:
- adaption of the v2x-fw-load script
- re-introduction of the v2x recipe in all of our images
- no difference when wainting on USB disconnect event or directly
  releaseing the gnss module from its reset

BTW: The original timeout of 50s can be explained as the SCU held a
delay of 40s until powering the v2x module. This delay shall be
removed in the next couple of days.

BugzID: 72787
Signed-off-by: Marc Mattmueller <marc.mattmueller@netmodule.com>
This commit is contained in:
Marc Mattmueller 2021-06-07 14:46:32 +02:00
parent b9e18a3a0b
commit c18178f212
3 changed files with 1 additions and 127 deletions

View File

@ -5,8 +5,7 @@ After=usb-hub-reset.service v2x-ieee802.11p.service
[Service]
Type=oneshot
ExecStartPre=/usr/bin/sh -c "/usr/bin/gnss-reset -c -t 20"
ExecStart=/usr/bin/sh -c "/usr/bin/gnss-reset -s on"
ExecStart=/usr/bin/sh -c "echo 0 > /sys/class/leds/gnss_rst/brightness"
RemainAfterExit=yes

View File

@ -1,121 +0,0 @@
#!/bin/sh
# ************************************************************
# GNSS Reset Script
# -----------------------
#
# The USB hub in the HW23 connects the GNSS modem, the v2x-
# module, the user interface and the user module.
#
# When HW23 device is powering up the v2x module enters DFU
# mode. This mode leads to enumeration errors when releasing
# the gnss module from reset. Thus a sequentialized startup
# is needed.
# This script can be called with option -c to check for a
# specific time if the USB hub detects a disconnection of
# the v2x module. This is needed for a proper startup of
# the device.
# ************************************************************
SCRIPT_NAME=$(basename "${0}")
SCRIPT_DIR=$(dirname "${0}")
SCRIPT_PATH=$(realpath "${SCRIPT_DIR}")
MYDIR=$(pwd)
START_REASON=/sys/kernel/broker/start-reason
GNSS_RST=/sys/class/leds/gnss_rst/brightness
ON_VALUE=0
OFF_VALUE=255
CHECK_TIMEOUT_S=0
export RST_STATE="off"
export IS_CHECK=false
#**********************************************************************************************
# local helper functions
#**********************************************************************************************
function printUsage()
{
echo -e "\\nUsage: ${SCRIPT_NAME} [OPT] CMD \\n\\n"
echo -e " CMD:"
echo -e " -c|--check Check start reason and usb-hub message"
echo -e " -s|--set=STATE Set the requested STATE of the gnss module:"
echo -e " * on = release module from reset"
echo -e " * off = set module in reset mode (default)"
echo -e " -h|--help Show this help"
echo -e ""
echo -e " OPT:"
echo -e " -t|--timeout=TIMEOUT_S Set the check timeout in seconds"
echo -e " * 0s = disabled (default)"
echo -e ""
}
function checkDeviceState()
{
if [ $(cat $START_REASON | grep reboot | wc -l) == 1 ]; then
echo "$SCRIPT_NAME: Reboot, no further check necessary"
elif [ $CHECK_TIMEOUT_S != 0 ]; then
echo "$SCRIPT_NAME: Power cycle detected, checking for v2x event on usb-hub (timeout=${CHECK_TIMEOUT_S}s)"
timeout $CHECK_TIMEOUT_S bash -c -- 'while true; do dmesg | grep "usb 1-1.*USB disconnect"; if [ $? == 0 ]; then break; fi; done'
if [ $? == 124 ]; then
echo "$SCRIPT_NAME: timed out - no reset of v2x module detected"
fi
else
echo "$SCRIPT_NAME: Power cycle detected (disabled v2x event check)"
fi
}
#**********************************************************************************************
# main
#**********************************************************************************************
O=$(getopt -o hct:s: --long help,check,timeout:,set: -- "$@") || exit 1
if [ $? != 0 ]; then
echo "ERROR: Could not parse $SCRIPT_NAME command line options"
exit 1
fi
eval set -- "$O"
while true; do
case "${1}" in
-c|--check)
export IS_CHECK=true
shift
;;
-t|--timeout)
export CHECK_TIMEOUT_S=${2}
shift 2
;;
-s|--set)
export RST_STATE="${2}"
shift 2
;;
--)
break
;;
*)
printUsage; exit 0 ;;
esac
done
if [ ! -f $GNSS_RST ]; then
echo "ERROR $SCRIPT_NAME: GNSS module reset lines not available"
exit 1
fi
RST_VALUE=$OFF_VALUE
[[ "${RST_STATE}" != "off" ]] && RST_VALUE=$ON_VALUE || true
if [[ "${IS_CHECK}" == "true" ]]; then
checkDeviceState
exit 0
fi
echo "$SCRIPT_NAME: setting $GNSS_RST=$RST_STATE($RST_VALUE)..."
echo $RST_VALUE > $GNSS_RST
if [[ "$?" != "0" ]]; then
echo "ERROR $SCRIPT_NAME: Could not set $RST_STATE ($RST_VALUE) in $GNSS_RST"
exit 1
fi
exit 0

View File

@ -13,7 +13,6 @@ FILESEXTRAPATHS_append := ":${THISDIR}/files"
SRC_URI_append = " \
file://gnss-init.service \
file://gnss-reset \
"
S = "${WORKDIR}"
@ -27,7 +26,4 @@ FILES_${PN}_append = "${systemd_unitdir}/system ${bindir}"
do_install_append() {
install -d ${D}${systemd_unitdir}/system
install -m 644 ${WORKDIR}/gnss-init.service ${D}${systemd_unitdir}/system/
install -d ${D}${bindir}
install -m 744 ${WORKDIR}/gnss-reset ${D}${bindir}
}