diff --git a/recipes-connectivity/gnss-init/files/gnss-init.service b/recipes-connectivity/gnss-init/files/gnss-init.service index 38aa797..3afcec4 100644 --- a/recipes-connectivity/gnss-init/files/gnss-init.service +++ b/recipes-connectivity/gnss-init/files/gnss-init.service @@ -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 diff --git a/recipes-connectivity/gnss-init/files/gnss-reset b/recipes-connectivity/gnss-init/files/gnss-reset deleted file mode 100755 index 249f327..0000000 --- a/recipes-connectivity/gnss-init/files/gnss-reset +++ /dev/null @@ -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 diff --git a/recipes-connectivity/gnss-init/gnss-init.bb b/recipes-connectivity/gnss-init/gnss-init.bb index a82a268..77d6ad1 100644 --- a/recipes-connectivity/gnss-init/gnss-init.bb +++ b/recipes-connectivity/gnss-init/gnss-init.bb @@ -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} }