From 9aa4e52f96315a3ee7ca4e03935b90d27a6cde7f Mon Sep 17 00:00:00 2001 From: John Klug Date: Tue, 3 Jan 2017 18:38:47 -0600 Subject: suppress the correct message --- .../gpsd-3.16/0005-suppress-text-in-binary.patch | 21 +++++++++++---------- recipes-navigation/gpsd/gpsd_3.16.bb | 1 + 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/recipes-navigation/gpsd/gpsd-3.16/0005-suppress-text-in-binary.patch b/recipes-navigation/gpsd/gpsd-3.16/0005-suppress-text-in-binary.patch index 34c9924..f338126 100644 --- a/recipes-navigation/gpsd/gpsd-3.16/0005-suppress-text-in-binary.patch +++ b/recipes-navigation/gpsd/gpsd-3.16/0005-suppress-text-in-binary.patch @@ -1,12 +1,12 @@ diff -u old/gpsctl.c new/gpsctl.c --- old/gpsctl.c 2017-01-03 15:57:50.517120891 -0600 -+++ new/gpsctl.c 2017-01-03 15:58:05.025120861 -0600 ++++ new/gpsctl.c 2017-01-03 18:31:21.421101434 -0600 @@ -175,7 +175,7 @@ int option, status; char *device = NULL, *devtype = NULL; char *speed = NULL, *control = NULL, *rate = NULL; - bool to_binary = false, to_nmea = false, reset = false; -+ bool to_binary = false, to_nmea = false, reset = false, cstring = false; ++ bool to_binary = false, to_nmea = false, reset = false, control_string = false; bool lowlevel=false, echo=false; struct gps_data_t gpsdata; const struct gps_type_t *forcetype = NULL; @@ -14,16 +14,17 @@ diff -u old/gpsctl.c new/gpsctl.c #ifdef CONTROLSEND_ENABLE control = optarg; lowlevel = true; -+ cstring = true; ++ control_string = true; if ((cooklen = hex_escapes(cooked, control)) <= 0) { gpsd_log(&context.errout, LOG_ERROR, "invalid escape string (error %d)\n", (int)cooklen); -@@ -443,7 +444,7 @@ +@@ -704,7 +705,8 @@ + } } - /* if no control operation was specified, just ID the device */ -- if (speed==NULL && rate == NULL && !to_nmea && !to_binary && !reset) { -+ if (speed==NULL && rate == NULL && !to_nmea && !to_binary && !reset && !cstring) { - (void)printf("%s identified as a %s", - gpsdata.dev.path, gpsdata.dev.driver); - if (gpsdata.dev.subtype[0] != '\0') { +- (void)printf("%s identified as a %s at %u baud.\n", ++ if(!control_string) ++ (void)printf("%s identified as a %s at %u baud.\n", + device, gpsd_id(&session), + session.gpsdata.dev.baudrate); + diff --git a/recipes-navigation/gpsd/gpsd_3.16.bb b/recipes-navigation/gpsd/gpsd_3.16.bb index 100edcc..20b2cad 100644 --- a/recipes-navigation/gpsd/gpsd_3.16.bb +++ b/recipes-navigation/gpsd/gpsd_3.16.bb @@ -4,6 +4,7 @@ LICENSE = "BSD" LIC_FILES_CHKSUM = "file://COPYING;md5=d217a23f408e91c94359447735bc1800" DEPENDS = "dbus dbus-glib ncurses python libusb1 chrpath-replacement-native pps-tools" PROVIDES = "virtual/gpsd" +PR="m1" EXTRANATIVEPATH += "chrpath-native" -- cgit v1.2.3 From 6fdb632e17e3b4ef01be73eb24b7a2d80d0154d4 Mon Sep 17 00:00:00 2001 From: Brandon Bayer Date: Thu, 5 Jan 2017 11:44:36 -0600 Subject: chore: remove .gitlab-ci.yml --- .gitlab-ci.yml | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index e07d2a9..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,36 +0,0 @@ -variables: - GIT_STRATEGY: none - -before_script: - - test -d mlinux || git clone git@gitlab.multitech.net:mirrors/mlinux.git - - cd mlinux - - git pull - - (test -f env-oe.sh && ./setup.sh --update) || ./setup.sh - - source env-oe.sh - - cd layers/meta-mlinux - - git fetch - - git checkout $CI_BUILD_REF - - cd ../.. - -cache: - untracked: true - -mtcdt_mlinux: - stage: build - tags: - - mlinux - script: - - bitbake mlinux-factory-image - artifacts: - paths: - - mlinux/build/tmp/deploy/images/mtcdt/*-upgrade.bin - -mtcap_mlinux: - stage: build - tags: - - mlinux - script: - - MACHINE=mtcap bitbake mlinux-mtcap-image - artifacts: - paths: - - mlinux/build/tmp/deploy/images/mtcap/*-upgrade.bin -- cgit v1.2.3 From 366999777621dede38c49b2f67de7b0d810b2764 Mon Sep 17 00:00:00 2001 From: John Klug Date: Fri, 6 Jan 2017 09:01:29 -0600 Subject: Add flag to start gpsd --- recipes-navigation/gpsd/gpsd/gpsd | 3 +++ recipes-navigation/gpsd/gpsd/gpsd-default | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes-navigation/gpsd/gpsd/gpsd b/recipes-navigation/gpsd/gpsd/gpsd index c08be9b..c0e4c2b 100755 --- a/recipes-navigation/gpsd/gpsd/gpsd +++ b/recipes-navigation/gpsd/gpsd/gpsd @@ -48,6 +48,9 @@ fi # do_start() { + if ((GPSD_NOSTART != 0)) ; then + exit 0 + fi # Return # 0 if daemon has been started # 1 if daemon was already running diff --git a/recipes-navigation/gpsd/gpsd/gpsd-default b/recipes-navigation/gpsd/gpsd/gpsd-default index fe8576a..61ca995 100644 --- a/recipes-navigation/gpsd/gpsd/gpsd-default +++ b/recipes-navigation/gpsd/gpsd/gpsd-default @@ -4,3 +4,5 @@ GPSD_OPTIONS="-n -D 1" # Conduit 0.1 GPS devices GPS_DEVICES="/dev/ttyXRUSB2 /dev/pps0" + +GPSD_NOSTART=0 -- cgit v1.2.3 From db0e43683299c67103f1eb2031cf4b809c064a25 Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 9 Jan 2017 19:15:49 -0600 Subject: Add gps0 symlink and set baud rate --- recipes-navigation/gpsd/gpsd/gpsd | 10 ++++++++++ recipes-navigation/gpsd/gpsd/gpsd-default | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/recipes-navigation/gpsd/gpsd/gpsd b/recipes-navigation/gpsd/gpsd/gpsd index c0e4c2b..d9cf201 100755 --- a/recipes-navigation/gpsd/gpsd/gpsd +++ b/recipes-navigation/gpsd/gpsd/gpsd @@ -43,6 +43,10 @@ if [ -n "$GPSD_SOCKET" ]; then GPSD_OPTIONS="$GPSD_OPTIONS -F $GPSD_SOCKET" fi +if ! [[ -L /dev/gps${GPS_NUM} ]] ; then + ln -s $GPS_LINE /dev/gps${GPS_NUM} +fi + # # Function that starts the daemon/service # @@ -55,6 +59,12 @@ do_start() # 0 if daemon has been started # 1 if daemon was already running # 2 if daemon could not be started + # Set the baud rate. Works better with ntp at a higher baud rate. + gpsctl -t 'u-blox' -s $GPS_BAUD -b -f $GPS_LINE + # The next line is needed due to a bug in gpsctl. + # We will go back to the default baud rate if we don't do this step. + gpsctl -T 2 -f $GPS_LINE + stty -F $GPS_LINE $GPS_BAUD /usr/sbin/start-stop-daemon -N -20 --start --quiet --pidfile $PIDFILE --exec $DAEMON --test \ -- $GPSD_OPTIONS -P $PIDFILE $GPS_DEVICES > /dev/null \ || return 1 diff --git a/recipes-navigation/gpsd/gpsd/gpsd-default b/recipes-navigation/gpsd/gpsd/gpsd-default index 61ca995..00576d3 100644 --- a/recipes-navigation/gpsd/gpsd/gpsd-default +++ b/recipes-navigation/gpsd/gpsd/gpsd-default @@ -3,6 +3,10 @@ GPSD_SOCKET="/var/run/gpsd.sock" GPSD_OPTIONS="-n -D 1" # Conduit 0.1 GPS devices -GPS_DEVICES="/dev/ttyXRUSB2 /dev/pps0" +GPS_LINE=/dev/ttyXRUSB2 +GPS_NUM=0 +# Highest speed permitted by uBlox. +GPS_BAUD=115200 +GPS_DEVICES="$GPS_LINE /dev/pps0" GPSD_NOSTART=0 -- cgit v1.2.3 From 058eae5c25592c7b65ebe5c7af2e1b66d930afeb Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 9 Jan 2017 19:39:21 -0600 Subject: New GPSD for Ublox --- conf/distro/mlinux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/distro/mlinux.conf b/conf/distro/mlinux.conf index 9a8011d..e4b199e 100644 --- a/conf/distro/mlinux.conf +++ b/conf/distro/mlinux.conf @@ -1,7 +1,7 @@ DISTRO = "mlinux" DISTRO_NAME = "mLinux" DISTRO_BASE_VERSION = "3.2" -DISTRO_VERSION = "${DISTRO_BASE_VERSION}.4" +DISTRO_VERSION = "${DISTRO_BASE_VERSION}.5" DISTRO_CODENAME = "" SDK_VENDOR = "-mlinux" SDK_VERSION := "${@'${DISTRO_VERSION}'.replace('snapshot-${DATE}','snapshot')}" -- cgit v1.2.3 From 2dac3e03e77449b07831594555253053bc3dd61b Mon Sep 17 00:00:00 2001 From: John Klug Date: Tue, 10 Jan 2017 19:37:44 -0600 Subject: Add status to gpsd init script --- recipes-navigation/gpsd/gpsd/gpsd | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/recipes-navigation/gpsd/gpsd/gpsd b/recipes-navigation/gpsd/gpsd/gpsd index d9cf201..9c59f10 100755 --- a/recipes-navigation/gpsd/gpsd/gpsd +++ b/recipes-navigation/gpsd/gpsd/gpsd @@ -63,6 +63,7 @@ do_start() gpsctl -t 'u-blox' -s $GPS_BAUD -b -f $GPS_LINE # The next line is needed due to a bug in gpsctl. # We will go back to the default baud rate if we don't do this step. + echo Expect a timeout error here. Need this error. gpsctl -T 2 -f $GPS_LINE stty -F $GPS_LINE $GPS_BAUD /usr/sbin/start-stop-daemon -N -20 --start --quiet --pidfile $PIDFILE --exec $DAEMON --test \ @@ -104,6 +105,19 @@ do_reload() { return 0 } +do_status() { + NAME=$1 + PIDFILE=$2 + # -t: test only but not stop + start-stop-daemon -K -t --quiet --pidfile $PIDFILE --name $NAME + # exit with status 0 if process is found + if [ "$?" = "0" ]; then + return 0 + else + return 1 + fi +} + case "$1" in start) echo "Starting $DESC" "$NAME" @@ -116,7 +130,19 @@ case "$1" in exit $? ;; status) - ;; + echo -n "status $NAME ... " + do_status "$NAME" "$PIDFILE" + if [ "$?" = "0" ]; then + echo "running" + exit 0 + else + echo "stopped" + exit 1 + fi + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|force-reload}" >&2 + ;; reload|force-reload) echo "Reloading $DESC" "$NAME" do_reload -- cgit v1.2.3 From c4fa95a8241a7f807924b402febff22cfc1d6e9b Mon Sep 17 00:00:00 2001 From: John Klug Date: Wed, 11 Jan 2017 18:40:04 -0600 Subject: Add new parameters for evaluating GPS fix status. --- recipes-navigation/gpsd/gpsd/gpsd-default | 14 +++ recipes-navigation/gpsd/gpsd/gpsd_ubx_fixed.sh | 142 +++++++++++++++++++++++++ recipes-navigation/gpsd/gpsd_3.16.bb | 9 +- 3 files changed, 160 insertions(+), 5 deletions(-) create mode 100755 recipes-navigation/gpsd/gpsd/gpsd_ubx_fixed.sh diff --git a/recipes-navigation/gpsd/gpsd/gpsd-default b/recipes-navigation/gpsd/gpsd/gpsd-default index 00576d3..7c4e6bb 100644 --- a/recipes-navigation/gpsd/gpsd/gpsd-default +++ b/recipes-navigation/gpsd/gpsd/gpsd-default @@ -10,3 +10,17 @@ GPS_BAUD=115200 GPS_DEVICES="$GPS_LINE /dev/pps0" GPSD_NOSTART=0 + +GPS_FIXFILE=/var/run/gpsfix + +# GPSD/UBlox Lock requiremnt +# Create GPS_FIXFILE when reached. +# UBlox NAV SOL (0x01 0x06) at gpsFix value +# and above +# 00 No Fix +# 01 Dead reckoning only +# 02 2D fix +# 03 3D fix +# 04 GPS + dead reckoning combined +# 05 Time only fix +GPSFIX="03 05" diff --git a/recipes-navigation/gpsd/gpsd/gpsd_ubx_fixed.sh b/recipes-navigation/gpsd/gpsd/gpsd_ubx_fixed.sh new file mode 100755 index 0000000..9fd3f7f --- /dev/null +++ b/recipes-navigation/gpsd/gpsd/gpsd_ubx_fixed.sh @@ -0,0 +1,142 @@ +#!/bin/bash +# Fix file creation for U-Blox GPS. +# If GPS reaches expected +# fix level, file GSP_FIXFILE is created. +# This is to know when to set the system +# and hardware clock, and when +# it is safe to start ntp. +if [[ -r /etc/default/gpsd ]] ; then + . /etc/default/gpsd +else + echo "Must configure GPSD requirements" + exit 1 +fi +UBXNAVSOL='b56201063400' +UBXNAVSOLLEN=60 + +function rm_gps_file +{ + if [[ -n "${GPS_FIXFILE}" ]] && [[ -f ${GPS_FIXFILE} ]] ; then + rm -f "${GPS_FIXFILE}" + fi +} + +# Most exits are errors, so remove the GPS fix file. +trap rm_gps_file EXIT + +if ! [[ -x /usr/bin/gpsmon ]] ; then + logger -p user.err "gpsd_ubx_3dfix.sh: Please install gpsmon" + exit 0 +fi + + +# Terminate gpsmon after 10 seconds if it is our child +( + sleep 10 + ppid=$$ + # echo "looking for shell ${ppid}" + gpsmonpid=$(ps -o pid,ppid,comm -e | egrep "[[:space:]]${ppid}[[:space:]]+gpsmon$" | sed -r 's/^[[:space:]]*([0-9]*)[[:space:]]+.*/\1/') + # echo sleeper TERM found pid $gpsmonpid + if ((${#gpsmonpid})) ; then + logger -p user.info "terminating gpscat(${gpsmonpid}) with SIGTERM" + kill ${gpsmonpid} + else + exit 0 + fi + sleep 2 + gpsmonpid=$(ps -o pid,ppid,comm -e | egrep "[[:space:]]${ppid}[[:space:]]+gpsmon$" | sed -r 's/^[[:space:]]*([0-9]*)[[:space:]]+.*/\1/') + # echo sleeper KILL found pid $gpsmonpid + if ((${#gpsmonpid})) ; then + logger -p user.info "terminating gpscat(${gpsmonpid}) with SIGKILL" + kill -9 ${gpsmonpid} + fi +) & + +fix="" +status="" + +# egrep in busybox has a horrible buffering issue. +# echo My shell pid is $$ +# echo Place data fix, status +stuff="$(gpsmon -a 2>&1 | { + OIFS=${IFS} + IFS=$'\n' + while read ln ; do + if [[ $ln =~ ^[[:space:]]*\(${UBXNAVSOLLEN}\)[[:space:]]*${UBXNAVSOL}....................(..)(.) ]] ; then + IFS=${OIFS} + fix="${BASH_REMATCH[1]}" + if ((${#fix} == 0)) ; then + fix="unknown" + fi + status=$(echo "${BASH_REMATCH[2]}") + if ((${#status} == 0)) ; then + status="unknown" + fi + break; + fi + oldln="${ln}" + done + if ((${#fix})) && ((${#status})) ; then + echo "$fix,$status" + else + echo "${oldln}" + fi +})" + +if ((${#stuff} == 0)) ; then + logger -p user.err No data from GPS + exit 1 +fi + +if [[ -t 1 ]] ; then + stty echo icanon +fi + +OIFS=${IFS} +IFS=, +set $stuff +fix="$1" +status="$2" +IFS=${OIFS} + +# fixOK is the least significant bit of a hex single digit +case $status in + [13579bBdDfF]) + ((fixOK=1)) + ;; + [02468aAcCeE]) + ((fixOK=0)) + ;; + *) + logger -p user.err "Is GPSD running?" + logger -p user.err "FIX OK field should be single hex digit: gpsmon data: $stuff" + exit 1 + break + ;; +esac + +# echo "status is $status. fixOK is $fixOK" + + +if ((fixOK == 0)) ; then + logger -p user.err "Problem with the GPS fix. The fix is an even value, \"$status\", and should be an odd value. fixOK=${fixOK}" + exit 1 + # Retry later. How? +fi + +# echo "fix is $fix. Is it in $GPSFIX?" +# Test the GPS fixOK +for x in $GPSFIX ; do + # echo test $x with $fix + if [[ $x == $fix ]] ; then + logger user.info "GPS has fix $fix found in list GPSFIX: $GPSFIX" + echo $x >"${GPS_FIXFILE}" + GPS_FIXFILE="" + exit 0 + fi +done + +logger -p user.info "GPS fix is bad: $fix and should be one of: $GPSFIX" +# Start later +exit 1 + diff --git a/recipes-navigation/gpsd/gpsd_3.16.bb b/recipes-navigation/gpsd/gpsd_3.16.bb index 20b2cad..cf4b578 100644 --- a/recipes-navigation/gpsd/gpsd_3.16.bb +++ b/recipes-navigation/gpsd/gpsd_3.16.bb @@ -16,6 +16,7 @@ SRC_URI = "${SAVANNAH_GNU_MIRROR}/${BPN}/${BP}.tar.gz \ file://0005-suppress-text-in-binary.patch \ file://gpsd-default \ file://gpsd \ + file:://gpsd_ubx_fixed.sh \ file://60-gpsd.rules \ file://gpsd.service \ " @@ -88,12 +89,10 @@ do_install_append() { install -m 0755 ${WORKDIR}/gpsd ${D}/${sysconfdir}/init.d/ install -d ${D}/${sysconfdir}/default install -m 0644 ${WORKDIR}/gpsd-default ${D}/${sysconfdir}/default/gpsd.default + install -d ${D}/usr/sbin + install -m 0644 ${WORKDIR}/gpsd_ubx_fixed.sh ${D}/usr/sbin/gpsd_ubx_fixed - #support for udev - install -d ${D}/${sysconfdir}/udev/rules.d - install -m 0644 ${WORKDIR}/60-gpsd.rules ${D}/${sysconfdir}/udev/rules.d - install -d ${D}${base_libdir}/udev/ - install -m 0755 ${S}/gpsd.hotplug ${D}${base_libdir}/udev/ + # UDEV code assumed a USB GPS. #support for python install -d ${D}/${PYTHON_SITEPACKAGES_DIR}/gps -- cgit v1.2.3 From ab413cb77eeb899c513f7b2cc63776ff8601446e Mon Sep 17 00:00:00 2001 From: John Klug Date: Thu, 12 Jan 2017 09:59:35 -0600 Subject: Add gpsd_ubx_fixed script (does GPS have 3D fix?) to gpsd. --- recipes-navigation/gpsd/gpsd_3.16.bb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes-navigation/gpsd/gpsd_3.16.bb b/recipes-navigation/gpsd/gpsd_3.16.bb index cf4b578..f2a5c05 100644 --- a/recipes-navigation/gpsd/gpsd_3.16.bb +++ b/recipes-navigation/gpsd/gpsd_3.16.bb @@ -16,7 +16,7 @@ SRC_URI = "${SAVANNAH_GNU_MIRROR}/${BPN}/${BP}.tar.gz \ file://0005-suppress-text-in-binary.patch \ file://gpsd-default \ file://gpsd \ - file:://gpsd_ubx_fixed.sh \ + file://gpsd_ubx_fixed.sh \ file://60-gpsd.rules \ file://gpsd.service \ " @@ -89,8 +89,8 @@ do_install_append() { install -m 0755 ${WORKDIR}/gpsd ${D}/${sysconfdir}/init.d/ install -d ${D}/${sysconfdir}/default install -m 0644 ${WORKDIR}/gpsd-default ${D}/${sysconfdir}/default/gpsd.default - install -d ${D}/usr/sbin - install -m 0644 ${WORKDIR}/gpsd_ubx_fixed.sh ${D}/usr/sbin/gpsd_ubx_fixed + install -d ${D}${sbindir} + install -m 0755 ${WORKDIR}/gpsd_ubx_fixed.sh ${D}${sbindir}/gpsd_ubx_fixed # UDEV code assumed a USB GPS. @@ -133,7 +133,7 @@ SUMMARY_libgps = "C service library used for communicating with gpsd" FILES_libgps = "${libdir}/libgps.so.*" SUMMARY_gpsd-conf = "gpsd configuration files and init scripts" -FILES_gpsd-conf = "${sysconfdir}" +FILES_gpsd-conf = "${sysconfdir} ${sbindir}/gpsd_ubx_fixed" CONFFILES_gpsd-conf = "${sysconfdir}/default/gpsd.default" SUMMARY_gpsd-gpsctl = "Tool for tweaking GPS modes" -- cgit v1.2.3 From 2d5497affdcc14c94b0038e908970e48d093d455 Mon Sep 17 00:00:00 2001 From: John Klug Date: Thu, 12 Jan 2017 10:26:49 -0600 Subject: EEPROM tool for MTCDT-0.1 production --- prod-scripts/MTCDT-0.1/cdteep.sh | 110 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100755 prod-scripts/MTCDT-0.1/cdteep.sh diff --git a/prod-scripts/MTCDT-0.1/cdteep.sh b/prod-scripts/MTCDT-0.1/cdteep.sh new file mode 100755 index 0000000..c0e1e14 --- /dev/null +++ b/prod-scripts/MTCDT-0.1/cdteep.sh @@ -0,0 +1,110 @@ +#!/bin/sh +# This scripts follows old school option rules, and all +# options must come before parameters. Four parameters +# are required. Options requiring parameters must be +# followed by their parameter, with or without a space. +# Options not requiring parameters can be ganged, and may +# precede a single option requiring a parameter. +# +MYNAME=cdteep.sh +out="/sys/bus/i2c/devices/0-0056/eeprom" +vendor_id="Multi-Tech Systems" +hw_version="MTCDT-0.1" + + +# Set the MTCDT EEPROM +function usage { + echo "${MYNAME}"' -d -g -b "bt_mac_addr" -w "wifi_mac_addr" -i "imei number" -l "product-id" "device-id" "uuid" "eth_mac_addr"' >&2 + cat <&2 + assumptions: + All options are optional and must come first. + -b and -w require a following mac address + -d displays the PROM, do not write. Ignores other parameters. + -g GPS capability. + -l lora capability. + -i requires a following imei number + + Example + cdteep.sh -lb 01:12:AB:C3:23:FE MTCDT-210L 3489235379 125-6356-2283-9792 12:34:AB:CD:8F:34 + To add wifimac and remove lora: + ${MYNAME} -b 01:12:AB:C3:23:FE -w 04:16:3C:C3:45:75 MTCDT-210L 3489235379 125-6356-2283-9792 12:34:AB:CD:8F:34 + + product-id, device-id, uuid and eth_mac_addr are required. + + -d display EEPROM + -g capa-GPS + -l capa-Lora + The following fields are fixed: + out-file ${out} + vendor-id ${vendor_id} + hw-version ${hw_version} +!EOF + exit 1 +} + +((display=0)) + +while getopts b:dgw:i:l opt ; do +echo looking at opt $opt + case $opt in + b) + bt_mac_addr="$OPTARG" + barg="--mac-bluetooth ${OPTARG} --capa-bluetooth" + ;; + w) + wifi_mac_addr="$OPTARG" + warg="--mac-wifi ${OPTARG} --capa-wifi" + ;; + i) + imei="$OPTARG" + if ((${#imei} == 0)) ; then + echo "i option requires an imei number." >&2 + usage + fi + iarg="--imei ${OPTARG}" + ;; + l) + larg="--capa-lora" + ;; + d) + echo -e "\n\nEEPROM contents" + echo "-----------------" + mts-id-eeprom --in-file $out + exit + ;; + g) + gps="--capa-gps" + ;; + \?) + usage + ;; + :) + echo "Option -$OPTARG requires an argument." >&2 + usage + ;; + esac +done + + +shift $((OPTIND-1)) + +if (($# != 4)) ; then + echo Need 4 parameters beyond the options. >&2 + echo "You specified $#." >&2 + usage + exit 1 +fi +product_id=$1 +device_id=$2 +uuid=$3 +mac=$4 + +mts-id-eeprom --out-file $out --out-format bin --vendor-id "$vendor_id" \ + --product-id "$product_id" --device-id "$device_id" \ + --hw-version "$hw_version" --mac-addr $mac \ + ${warg} ${barg} \ + ${iarg} ${larg} ${gps} --uuid "$uuid" + +echo -e "\n\nNew contents" +echo "-----------------" +mts-id-eeprom --in-file $out -- cgit v1.2.3 From e0dc5fbcf8465f710f9f2f64009d9f488b8a17bb Mon Sep 17 00:00:00 2001 From: John Klug Date: Thu, 12 Jan 2017 12:06:51 -0600 Subject: Do not change the baud rate if gpsd is already running --- recipes-navigation/gpsd/gpsd/gpsd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes-navigation/gpsd/gpsd/gpsd b/recipes-navigation/gpsd/gpsd/gpsd index 9c59f10..e12d1c4 100755 --- a/recipes-navigation/gpsd/gpsd/gpsd +++ b/recipes-navigation/gpsd/gpsd/gpsd @@ -55,6 +55,9 @@ do_start() if ((GPSD_NOSTART != 0)) ; then exit 0 fi + /usr/sbin/start-stop-daemon -N -20 --start --quiet --pidfile $PIDFILE --exec $DAEMON --test \ + -- $GPSD_OPTIONS -P $PIDFILE $GPS_DEVICES > /dev/null \ + || return 1 # Return # 0 if daemon has been started # 1 if daemon was already running @@ -66,9 +69,6 @@ do_start() echo Expect a timeout error here. Need this error. gpsctl -T 2 -f $GPS_LINE stty -F $GPS_LINE $GPS_BAUD - /usr/sbin/start-stop-daemon -N -20 --start --quiet --pidfile $PIDFILE --exec $DAEMON --test \ - -- $GPSD_OPTIONS -P $PIDFILE $GPS_DEVICES > /dev/null \ - || return 1 /usr/sbin/start-stop-daemon -N -20 --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ $GPSD_OPTIONS -P $PIDFILE $GPS_DEVICES \ || return 2 -- cgit v1.2.3 From 94ec4baeb66a9bf1bfb2d86b532403514f2175c6 Mon Sep 17 00:00:00 2001 From: John Klug Date: Thu, 12 Jan 2017 16:31:34 -0600 Subject: Add script to set the system clock directly from the GPS. --- recipes-navigation/gpsd/gpsd/gpsd_ubx_settime.sh | 47 ++++++++++++++++++++++++ recipes-navigation/gpsd/gpsd_3.16.bb | 4 +- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100755 recipes-navigation/gpsd/gpsd/gpsd_ubx_settime.sh diff --git a/recipes-navigation/gpsd/gpsd/gpsd_ubx_settime.sh b/recipes-navigation/gpsd/gpsd/gpsd_ubx_settime.sh new file mode 100755 index 0000000..7f22719 --- /dev/null +++ b/recipes-navigation/gpsd/gpsd/gpsd_ubx_settime.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# PPS= 1484247472.29561104 clock= 1484247990.00000000 offset= 517.704388959 + +trap "stty echo icanon" exit + +OIFS=$IFS +IFS=$'\n' +if ! /usr/sbin/gpsd_ubx_fixed ; then + logger -e -p user.warn "GPS does not have a fix yet. Try again later." + exit 1 +fi +# This shell script is shaped by two things: +# Lousy performance of sed and grep when used with gpsmon +# Need to terminate +# Terminate gpsmon after 10 seconds if it is our child +( + sleep 10 + ppid=$$ + gpsmonpid=$(ps -o pid,ppid,comm -e | egrep "[[:space:]]${ppid}[[:space:]]+gpsmon$" | sed -r 's/^[[:space:]]*([0-9]*)[[:space:]]+.*/\1/') + if ((${#gpsmonpid})) ; then + logger -p user.info "terminating gpscat(${gpsmonpid}) with SIGTERM" + kill ${gpsmonpid} + else + exit 0 + fi + sleep 2 + gpsmonpid=$(ps -o pid,ppid,comm -e | egrep "[[:space:]]${ppid}[[:space:]]+gpsmon$" | sed -r 's/^[[:space:]]*([0-9]*)[[:space:]]+.*/\1/') + if ((${#gpsmonpid})) ; then + logger -p user.info "terminating gpscat(${gpsmonpid}) with SIGKILL" + kill -9 ${gpsmonpid} + fi +) & + + +epoch=$(gpsmon -a 2>&1 | ( while read ln ; do + if [[ $ln =~ ^[[:space:]]*PPS=.*clock=[[:space:]]*([0-9]*)\. ]] ; then + echo ${BASH_REMATCH[1]} + break + fi +done )) +if [[ $epoch =~ ^[0-9]+$ ]] ; then + date +%s -s @${epoch} >/dev/null +else + logger user.err "gpsmon output is bad." + exit 1 +fi +exit 0 diff --git a/recipes-navigation/gpsd/gpsd_3.16.bb b/recipes-navigation/gpsd/gpsd_3.16.bb index f2a5c05..e5b3207 100644 --- a/recipes-navigation/gpsd/gpsd_3.16.bb +++ b/recipes-navigation/gpsd/gpsd_3.16.bb @@ -17,6 +17,7 @@ SRC_URI = "${SAVANNAH_GNU_MIRROR}/${BPN}/${BP}.tar.gz \ file://gpsd-default \ file://gpsd \ file://gpsd_ubx_fixed.sh \ + file://gpsd_ubx_settime.sh \ file://60-gpsd.rules \ file://gpsd.service \ " @@ -91,6 +92,7 @@ do_install_append() { install -m 0644 ${WORKDIR}/gpsd-default ${D}/${sysconfdir}/default/gpsd.default install -d ${D}${sbindir} install -m 0755 ${WORKDIR}/gpsd_ubx_fixed.sh ${D}${sbindir}/gpsd_ubx_fixed + install -m 0755 ${WORKDIR}/gpsd_ubx_settime.sh ${D}${sbindir}/gpsd_ubx_settime # UDEV code assumed a USB GPS. @@ -133,7 +135,7 @@ SUMMARY_libgps = "C service library used for communicating with gpsd" FILES_libgps = "${libdir}/libgps.so.*" SUMMARY_gpsd-conf = "gpsd configuration files and init scripts" -FILES_gpsd-conf = "${sysconfdir} ${sbindir}/gpsd_ubx_fixed" +FILES_gpsd-conf = "${sysconfdir} ${sbindir}/gpsd_ubx_fixed ${sbindir}/gpsd_ubx_settime" CONFFILES_gpsd-conf = "${sysconfdir}/default/gpsd.default" SUMMARY_gpsd-gpsctl = "Tool for tweaking GPS modes" -- cgit v1.2.3 From b05b7927a9c717e554bc499e27bb8d7df599aa26 Mon Sep 17 00:00:00 2001 From: John Klug Date: Thu, 12 Jan 2017 17:21:32 -0600 Subject: Fix bad option for logger --- recipes-navigation/gpsd/gpsd/gpsd_ubx_settime.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-navigation/gpsd/gpsd/gpsd_ubx_settime.sh b/recipes-navigation/gpsd/gpsd/gpsd_ubx_settime.sh index 7f22719..5644d57 100755 --- a/recipes-navigation/gpsd/gpsd/gpsd_ubx_settime.sh +++ b/recipes-navigation/gpsd/gpsd/gpsd_ubx_settime.sh @@ -6,7 +6,7 @@ trap "stty echo icanon" exit OIFS=$IFS IFS=$'\n' if ! /usr/sbin/gpsd_ubx_fixed ; then - logger -e -p user.warn "GPS does not have a fix yet. Try again later." + logger -s -p user.warn "GPS does not have a fix yet. Try again later." exit 1 fi # This shell script is shaped by two things: -- cgit v1.2.3 From 9c2dff39448305408d5843db5461716f4845800d Mon Sep 17 00:00:00 2001 From: John Klug Date: Thu, 12 Jan 2017 17:36:37 -0600 Subject: gpsd must start before ntp --- recipes-navigation/gpsd/gpsd_3.16.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-navigation/gpsd/gpsd_3.16.bb b/recipes-navigation/gpsd/gpsd_3.16.bb index e5b3207..7a61f68 100644 --- a/recipes-navigation/gpsd/gpsd_3.16.bb +++ b/recipes-navigation/gpsd/gpsd_3.16.bb @@ -35,7 +35,7 @@ SRC_URI[sha256sum] = "03579af13a4d3fe0c5b79fa44b5f75c9f3cac6749357f1d99ce5d38c09 inherit scons update-rc.d python-dir pythonnative systemd INITSCRIPT_NAME = "gpsd" -INITSCRIPT_PARAMS = "defaults 35" +INITSCRIPT_PARAMS = "defaults 10" SYSTEMD_OESCONS = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false',d)}" -- cgit v1.2.3 From ff32f2719b24a05c160a7110fd08745b348a23c3 Mon Sep 17 00:00:00 2001 From: John Klug Date: Thu, 12 Jan 2017 18:19:32 -0600 Subject: Delay ntp start when dependent on gpsd. --- recipes-support/ntp/files/ntpd-init.patch | 57 ++++++++++++++++++++++++++----- 1 file changed, 49 insertions(+), 8 deletions(-) diff --git a/recipes-support/ntp/files/ntpd-init.patch b/recipes-support/ntp/files/ntpd-init.patch index fc388f8..05a6a8e 100644 --- a/recipes-support/ntp/files/ntpd-init.patch +++ b/recipes-support/ntp/files/ntpd-init.patch @@ -1,11 +1,52 @@ ---- old/ntpd 2016-12-19 18:11:58.022663976 -0600 -+++ new/ntpd 2016-12-19 18:12:56.618663852 -0600 -@@ -23,7 +23,7 @@ - # this. If ntpd seems to disappear after a while assume TICKADJ - # above is set to a totally incorrect value. - echo -n "Starting ntpd: " +--- old/ntpd 2017-01-12 18:10:40.208157197 -0600 ++++ new/ntpd 2017-01-12 18:14:27.952154318 -0600 +@@ -1,6 +1,8 @@ +-#! /bin/sh ++#! /bin/bash + # ++. /etc/default/ntpd + PATH=/sbin:/bin:/usr/bin:/usr/sbin ++GNSSRST=/sys/devices/platform/mts-io/gnss-reset + + # ntpd init.d script for ntpdc from ntp.isc.org + test -x /usr/sbin/ntpd -a -r /etc/ntp.conf || exit 0 +@@ -18,13 +20,32 @@ + } + } + startdaemon(){ +- # The -g option allows ntpd to step the time to correct it just +- # once. The daemon will exit if the clock drifts too much after +- # this. If ntpd seems to disappear after a while assume TICKADJ +- # above is set to a totally incorrect value. +- echo -n "Starting ntpd: " - start-stop-daemon --start -x /usr/sbin/ntpd -- -u ntp:ntp -p /var/run/ntp.pid "$@" -+ start-stop-daemon -N -20 --start -x /usr/sbin/ntpd -- -u ntp:ntp -p /var/run/ntp.pid "$@" - echo "done" +- echo "done" ++ /usr/sbin/start-stop-daemon -N -20 --start -x /usr/sbin/ntpd --test -- -u ntp:ntp -p /var/run/ntp.pid "$@" \ ++ || return 1 ++ if ((GPSD_REQUIRED == 1)) && [[ -L /dev/gps0 ]] && [[ -f "${GNSSRST}" ]]; then ++ . /etc/default/gpsd ++ # Could not get ntpd -gq to work with the GPS. ++ # So read the GPS time directly and set the system ++ # clock. ++ if ((SET_SYSTEM_CLOCK == 1)) && /usr/sbin/gpsd_ubx_settime ; then ++ # System time set by the GPS. ++ /usr/sbin/start-stop-daemon -N -20 --start -x /usr/sbin/ntpd -- -u ntp:ntp -p /var/run/ntp.pid "$@" ++ else ++ # Need a GPS fix before startint ntp. ++ /usr/sbin/start-stop-daemon -b -n z1e9d3qb -N -20 --start -x /bin/bash -- -c "sleep $GPSD_WAIT_TIME;/etc/init.d/ntpd start" ++ fi ++ else ++ if ((SET_SYSTEM_CLOCK == 1)) ; then ++ ntpd -gq ++ shift ++ fi ++ ++ # The -g option allows ntpd to step the time to correct it just ++ # once. The daemon will exit if the clock drifts too much after ++ # this. If ntpd seems to disappear after a while assume TICKADJ ++ # above is set to a totally incorrect value. ++ /usr/sbin/start-stop-daemon -N -20 --start -x /usr/sbin/ntpd -- -u ntp:ntp -p /var/run/ntp.pid "$@" ++ fi } stopdaemon(){ + echo -n "Stopping ntpd: " -- cgit v1.2.3 From 823edc2d6be48e9dc2dffda2f44c8dea5b7fc1e6 Mon Sep 17 00:00:00 2001 From: John Klug Date: Fri, 13 Jan 2017 18:48:22 -0600 Subject: Add /etc/default/ntpd to the ntp configuration. --- recipes-support/ntp/files/ntpd-default | 26 ++++++++++++++++++++++++++ recipes-support/ntp/ntp_4.2.6p5.bbappend | 18 ++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 recipes-support/ntp/files/ntpd-default diff --git a/recipes-support/ntp/files/ntpd-default b/recipes-support/ntp/files/ntpd-default new file mode 100644 index 0000000..85b8041 --- /dev/null +++ b/recipes-support/ntp/files/ntpd-default @@ -0,0 +1,26 @@ +# The GPSD_* parameters in this file are ignored +# if the uBlox GPS is not present. + +# Require a GPS lock/fix before starting NTP +# This is needed if we are not using NTP servers. +# NTP will not work with the GPS if the GPS is not +# locked before starting. +GPSD_REQUIRED=1 + +# Number of seconds to wait before checking if +# the GPS has a lock. +GPSD_WAIT_TIME=120 + +# Since the HW Clock could be off by a second or +# so, our GPS might get marked as a false ticker +# if we do not set the system clock to the GPS +# first. The current correct way to do this +# according to the GPS doc is ntpd -gq +# which must be done before ntpd is started. +# ntpd -gq apparently does not work with the GPS +# when tested with the clock one day off and no +# ntpd. +# If there is a uBlox GPS present, the time is +# read from the GPS to initialize the system time. +SET_SYSTEM_CLOCK=1 + diff --git a/recipes-support/ntp/ntp_4.2.6p5.bbappend b/recipes-support/ntp/ntp_4.2.6p5.bbappend index 7928608..b656256 100644 --- a/recipes-support/ntp/ntp_4.2.6p5.bbappend +++ b/recipes-support/ntp/ntp_4.2.6p5.bbappend @@ -2,6 +2,7 @@ PR .= ".mlinux1" SRC_URI += " file://ntpd-init.patch;patchdir=.. \ file://ntp.conf.patch;patchdir=.. \ + file://ntpd-default \ " FILESEXTRAPATHS_prepend := "${THISDIR}/files" @@ -26,3 +27,20 @@ pkg_postinst_${PN} () { chown -R ntp:ntp ${drdir} } + +do_install_prepend() { + echo JAK In do_install_append in directory $(pwd), and D is ${D} + echo JAK In do_install_append sysconfdir is ${sysconfdir} + install -d ${D}${sysconfdir}/default + install -m 0644 ${WORKDIR}/ntpd-default ${D}${sysconfdir}/default/ntpd.default + echo JAK In do_install_append default is $(ls ${D}cd${sysconfdir}/default/ntpd.default) +} +pkg_postinst_${PN}() { + update-alternatives --install ${sysconfdir}/default/ntpd ntpd-defaults ${sysconfdir}/default/ntpd.default 10 +} + +pkg_postrm_${PN}() { + update-alternatives --remove ntpd-defaults ${sysconfdir}/default/ntpd.default +} +FILES_${PN} += "${sysconfdir}/default/ntpd.default" +CONFFILES_${PN} += "${sysconfdir}/default/ntpd.default" -- cgit v1.2.3 From a439b62e1e91fbb6822e0e4a5b3714bd2e28b969 Mon Sep 17 00:00:00 2001 From: John Klug Date: Fri, 13 Jan 2017 19:24:21 -0600 Subject: Enhance the documentation for /etc/default/ntpd --- recipes-support/ntp/files/ntpd-default | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/recipes-support/ntp/files/ntpd-default b/recipes-support/ntp/files/ntpd-default index 85b8041..4811f46 100644 --- a/recipes-support/ntp/files/ntpd-default +++ b/recipes-support/ntp/files/ntpd-default @@ -5,22 +5,27 @@ # This is needed if we are not using NTP servers. # NTP will not work with the GPS if the GPS is not # locked before starting. +# See /etc/default/gpsd for the states required. GPSD_REQUIRED=1 -# Number of seconds to wait before checking if -# the GPS has a lock. +# Number of seconds between testing for a GPS +# lock prior to calling ntpd. GPSD_WAIT_TIME=120 # Since the HW Clock could be off by a second or # so, our GPS might get marked as a false ticker # if we do not set the system clock to the GPS # first. The current correct way to do this -# according to the GPS doc is ntpd -gq +# according to the ntp doc is ntpd -gq -c conffile # which must be done before ntpd is started. +# conffile should exclude the local clock, so it is +# ignored while doing the initial sync. # ntpd -gq apparently does not work with the GPS -# when tested with the clock one day off and no -# ntpd. +# when tested with the clock more than one day off +# and no ntpd. The gps shared memory is never polled. +# # If there is a uBlox GPS present, the time is -# read from the GPS to initialize the system time. +# read from the GPS to initialize the system time +# before NTP is started. SET_SYSTEM_CLOCK=1 -- cgit v1.2.3 From ab5bf7c08e48d5ad18bce04b4d9feb78c7dc5bb6 Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 16 Jan 2017 09:59:56 -0600 Subject: Add ntp to the mLinux factory image --- recipes-core/images/mlinux-factory-image.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-core/images/mlinux-factory-image.bb b/recipes-core/images/mlinux-factory-image.bb index 6ce05ab..d7e9e55 100644 --- a/recipes-core/images/mlinux-factory-image.bb +++ b/recipes-core/images/mlinux-factory-image.bb @@ -80,6 +80,6 @@ IMAGE_INSTALL += "sms-utils" # Multi-Tech GPS Utility IMAGE_INSTALL += "venus-gps" IMAGE_INSTALL += "pps-tools" -IMAGE_INSTALL += "gpsd" +IMAGE_INSTALL += "gpsd ntp" IMAGE_INSTALL += "uvccapture" -- cgit v1.2.3 From c596b231a46cc200dffec292eac1ddfd6f2269ce Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 16 Jan 2017 13:26:35 -0600 Subject: ntp requires gps-utils when the GPS is used. --- recipes-core/images/mlinux-factory-image.bb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes-core/images/mlinux-factory-image.bb b/recipes-core/images/mlinux-factory-image.bb index d7e9e55..f8a395d 100644 --- a/recipes-core/images/mlinux-factory-image.bb +++ b/recipes-core/images/mlinux-factory-image.bb @@ -80,6 +80,8 @@ IMAGE_INSTALL += "sms-utils" # Multi-Tech GPS Utility IMAGE_INSTALL += "venus-gps" IMAGE_INSTALL += "pps-tools" -IMAGE_INSTALL += "gpsd ntp" + +# When ntp is to use the GPS, gps-utils is required +IMAGE_INSTALL += "gpsd ntp gps-utils" IMAGE_INSTALL += "uvccapture" -- cgit v1.2.3 From bb46a5f01f16f8517f0daa2469b53e35a178b770 Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 16 Jan 2017 17:29:12 -0600 Subject: Have udev create /dev/gps0 --- recipes-core/images/mlinux-factory-image.bb | 2 +- recipes-navigation/gpsd/gpsd/60-gpsd.rules | 47 -------------------------- recipes-navigation/gpsd/gpsd/gpsd.rules | 51 +++++++++++++++++++++++++++++ recipes-navigation/gpsd/gpsd_3.16.bb | 8 +++-- 4 files changed, 58 insertions(+), 50 deletions(-) delete mode 100644 recipes-navigation/gpsd/gpsd/60-gpsd.rules create mode 100644 recipes-navigation/gpsd/gpsd/gpsd.rules diff --git a/recipes-core/images/mlinux-factory-image.bb b/recipes-core/images/mlinux-factory-image.bb index f8a395d..710ebf7 100644 --- a/recipes-core/images/mlinux-factory-image.bb +++ b/recipes-core/images/mlinux-factory-image.bb @@ -82,6 +82,6 @@ IMAGE_INSTALL += "venus-gps" IMAGE_INSTALL += "pps-tools" # When ntp is to use the GPS, gps-utils is required -IMAGE_INSTALL += "gpsd ntp gps-utils" +IMAGE_INSTALL += "gpsd ntp gps-utils gpsd-udev" IMAGE_INSTALL += "uvccapture" diff --git a/recipes-navigation/gpsd/gpsd/60-gpsd.rules b/recipes-navigation/gpsd/gpsd/60-gpsd.rules deleted file mode 100644 index 61143b8..0000000 --- a/recipes-navigation/gpsd/gpsd/60-gpsd.rules +++ /dev/null @@ -1,47 +0,0 @@ -# udev rules for gpsd -# $Id$ -# -# GPSes don't have their own USB device class. They're serial-over-USB -# devices, so what you see is actually the ID of the serial-over-USB chip. -# Fortunately, just two of these account for over 80% of consumer-grade -# GPS sensors. The gpsd.hotplug.wrapper script will tell a running gpsd -# that it should look at the device that just went active, because it -# might be a GPS. -# -# The following setup works on Debian - something similar will apply on -# other distributions: -# -# /etc/udev/gpsd.rules -# /etc/udev/rules.d/025_gpsd.rules -> ../gpsd.rules -# /lib/udev/gpsd.hotplug.wrapper -# /lib/udev/gpsd.hotplug -# -# Setting the link in /etc/udev/rules.d activates the rule and determines -# when to run it on boot (similar to init.d processing). - -SUBSYSTEM!="tty", GOTO="gpsd_rules_end" - -# Prolific Technology, Inc. PL2303 Serial Port -ATTR{idVendor}=="067b", ATTR{idProduct}=="2303", SYMLINK+="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper" -# ATEN International Co., Ltd UC-232A Serial Port [pl2303] -ATTR{idVendor}=="0557", ATTR{idProduct}=="2008", SYMLINK+="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper" -# FTDI 8U232AM -ATTR{idVendor}=="0403", ATTR{idProduct}=="6001", SYMLINK+="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper" -# Cypress M8/CY7C64013 (DeLorme uses these) -ATTR{idVendor}=="1163", ATTR{idProduct}=="0100", SYMLINK+="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper" -# PS-360 OEM (Microsoft GPS sold with Street and Trips 2005) -ATTR{idVendor}=="067b", ATTR{idProduct}=="aaa0", SYMLINK+="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper" -# Garmin International GPSmap, various models (tested with Garmin GPS 18 USB) -ATTR{idVendor}=="091e", ATTR{idProduct}=="0003", SYMLINK+="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper" -# Cygnal Integrated Products, Inc. CP210x Composite Device (Used by Holux m241) -ATTR{idVendor}=="10c4", ATTR{idProduct}=="ea60", SYMLINK+="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper" -# u-blox AG, u-blox 5 (tested with Navilock NL-402U) -ATTR{idVendor}=="1546", ATTR{idProduct}=="01a5", SYMLINK="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper" -# FTDI FT232 -ATTR{idVendor}=="0403", ATTR{idProduct}=="6001", SYMLINK="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper" -# u-blox 4 -ATTR{idVendor}=="1546", ATTR{idProduct}=="01a4", SYMLINK="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper" - -ACTION=="remove", RUN+="/lib/udev/gpsd.hotplug.wrapper" - -LABEL="gpsd_rules_end" diff --git a/recipes-navigation/gpsd/gpsd/gpsd.rules b/recipes-navigation/gpsd/gpsd/gpsd.rules new file mode 100644 index 0000000..c314b54 --- /dev/null +++ b/recipes-navigation/gpsd/gpsd/gpsd.rules @@ -0,0 +1,51 @@ +# udev rules for gpsd +# $Id$ +# +# GPSes don't have their own USB device class. They're serial-over-USB +# devices, so what you see is actually the ID of the serial-over-USB chip. +# Fortunately, just two of these account for over 80% of consumer-grade +# GPS sensors. The gpsd.hotplug.wrapper script will tell a running gpsd +# that it should look at the device that just went active, because it +# might be a GPS. +# +# The following setup works on Debian - something similar will apply on +# other distributions: +# +# /etc/udev/gpsd.rules +# /etc/udev/rules.d/025_gpsd.rules -> ../gpsd.rules +# /lib/udev/gpsd.hotplug.wrapper +# /lib/udev/gpsd.hotplug +# +# Setting the link in /etc/udev/rules.d activates the rule and determines +# when to run it on boot (similar to init.d processing). + +SUBSYSTEM!="tty", GOTO="gpsd_rules_end" + +# Prolific Technology, Inc. PL2303 Serial Port +ATTR{idVendor}=="067b", ATTR{idProduct}=="2303", SYMLINK+="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper" +# ATEN International Co., Ltd UC-232A Serial Port [pl2303] +ATTR{idVendor}=="0557", ATTR{idProduct}=="2008", SYMLINK+="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper" +# FTDI 8U232AM +ATTR{idVendor}=="0403", ATTR{idProduct}=="6001", SYMLINK+="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper" +# Cypress M8/CY7C64013 (DeLorme uses these) +ATTR{idVendor}=="1163", ATTR{idProduct}=="0100", SYMLINK+="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper" +# PS-360 OEM (Microsoft GPS sold with Street and Trips 2005) +ATTR{idVendor}=="067b", ATTR{idProduct}=="aaa0", SYMLINK+="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper" +# Garmin International GPSmap, various models (tested with Garmin GPS 18 USB) +ATTR{idVendor}=="091e", ATTR{idProduct}=="0003", SYMLINK+="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper" +# Cygnal Integrated Products, Inc. CP210x Composite Device (Used by Holux m241) +ATTR{idVendor}=="10c4", ATTR{idProduct}=="ea60", SYMLINK+="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper" +# u-blox AG, u-blox 5 (tested with Navilock NL-402U) +ATTR{idVendor}=="1546", ATTR{idProduct}=="01a5", SYMLINK="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper" +# FTDI FT232 +ATTR{idVendor}=="0403", ATTR{idProduct}=="6001", SYMLINK="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper" +# u-blox 4 +ATTR{idVendor}=="1546", ATTR{idProduct}=="01a4", SYMLINK="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper" + +ACTION=="remove", RUN+="/lib/udev/gpsd.hotplug.wrapper" + +KERNEL=="ttyXRUSB2", SYMLINK+="gps0" +KERNEL=="pps0", OWNER="root", GROUP="tty", MODE="0660", SYMLINK+="gpspps0" +KERNEL=="ttyXRUSB2", RUN+="/bin/setserial -v /dev/%k low_latency + +LABEL="gpsd_rules_end" diff --git a/recipes-navigation/gpsd/gpsd_3.16.bb b/recipes-navigation/gpsd/gpsd_3.16.bb index 7a61f68..7e573f8 100644 --- a/recipes-navigation/gpsd/gpsd_3.16.bb +++ b/recipes-navigation/gpsd/gpsd_3.16.bb @@ -18,7 +18,7 @@ SRC_URI = "${SAVANNAH_GNU_MIRROR}/${BPN}/${BP}.tar.gz \ file://gpsd \ file://gpsd_ubx_fixed.sh \ file://gpsd_ubx_settime.sh \ - file://60-gpsd.rules \ + file://gpsd.rules \ file://gpsd.service \ " # Fixed @@ -94,7 +94,11 @@ do_install_append() { install -m 0755 ${WORKDIR}/gpsd_ubx_fixed.sh ${D}${sbindir}/gpsd_ubx_fixed install -m 0755 ${WORKDIR}/gpsd_ubx_settime.sh ${D}${sbindir}/gpsd_ubx_settime - # UDEV code assumed a USB GPS. + #support for udev + install -d ${D}/${sysconfdir}/udev/rules.d + install -m 0644 ${WORKDIR}/gpsd.rules ${D}/${sysconfdir}/udev/rules.d + install -d ${D}${base_libdir}/udev/ + install -m 0755 ${S}/gpsd.hotplug ${D}${base_libdir}/udev/ #support for python install -d ${D}/${PYTHON_SITEPACKAGES_DIR}/gps -- cgit v1.2.3 From 75b853c9fd44d63086ecda236c5afe5ef84e6d08 Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 16 Jan 2017 17:40:19 -0600 Subject: Must exit if GPS not found on old conduit --- recipes-navigation/gpsd/gpsd/gpsd | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/recipes-navigation/gpsd/gpsd/gpsd b/recipes-navigation/gpsd/gpsd/gpsd index e12d1c4..257728d 100755 --- a/recipes-navigation/gpsd/gpsd/gpsd +++ b/recipes-navigation/gpsd/gpsd/gpsd @@ -29,12 +29,15 @@ DAEMON=/usr/sbin/$NAME PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME -# Exit if the package is not installed -[ -x "$DAEMON" ] || exit 0 - # Read configuration, if present [ -r /etc/default/$NAME ] && . /etc/default/$NAME +# Exit if no gps found +([[ -n $GPS_LINE ]] && [[ -c $GPS_LINE ]]) || exit 0 + +# Exit if the package is not installed +[ -x "$DAEMON" ] || exit 0 + if [ -z "$GPSD_SOCKET" ] && [ -z "$DEVICES" ]; then GPSD_SOCKET=/var/run/gpsd.sock fi -- cgit v1.2.3 From 044ba4279ea51952a5d6738111996ec03dd093d9 Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 16 Jan 2017 17:55:51 -0600 Subject: Remove incorrect comment --- recipes-navigation/gpsd/gpsd/gpsd-default | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes-navigation/gpsd/gpsd/gpsd-default b/recipes-navigation/gpsd/gpsd/gpsd-default index 7c4e6bb..9928143 100644 --- a/recipes-navigation/gpsd/gpsd/gpsd-default +++ b/recipes-navigation/gpsd/gpsd/gpsd-default @@ -1,4 +1,3 @@ -# If you must specify a non-NMEA driver, uncomment and modify the next line GPSD_SOCKET="/var/run/gpsd.sock" GPSD_OPTIONS="-n -D 1" -- cgit v1.2.3 From 6ecba6f72f433b144a28140e4d4c0a293ed9d2ee Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 16 Jan 2017 18:01:37 -0600 Subject: Remove unneeded GPS_NUM --- recipes-navigation/gpsd/gpsd/gpsd | 4 ---- recipes-navigation/gpsd/gpsd/gpsd-default | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/recipes-navigation/gpsd/gpsd/gpsd b/recipes-navigation/gpsd/gpsd/gpsd index 257728d..857c561 100755 --- a/recipes-navigation/gpsd/gpsd/gpsd +++ b/recipes-navigation/gpsd/gpsd/gpsd @@ -46,10 +46,6 @@ if [ -n "$GPSD_SOCKET" ]; then GPSD_OPTIONS="$GPSD_OPTIONS -F $GPSD_SOCKET" fi -if ! [[ -L /dev/gps${GPS_NUM} ]] ; then - ln -s $GPS_LINE /dev/gps${GPS_NUM} -fi - # # Function that starts the daemon/service # diff --git a/recipes-navigation/gpsd/gpsd/gpsd-default b/recipes-navigation/gpsd/gpsd/gpsd-default index 9928143..f9c1bec 100644 --- a/recipes-navigation/gpsd/gpsd/gpsd-default +++ b/recipes-navigation/gpsd/gpsd/gpsd-default @@ -3,7 +3,7 @@ GPSD_OPTIONS="-n -D 1" # Conduit 0.1 GPS devices GPS_LINE=/dev/ttyXRUSB2 -GPS_NUM=0 + # Highest speed permitted by uBlox. GPS_BAUD=115200 GPS_DEVICES="$GPS_LINE /dev/pps0" -- cgit v1.2.3 From 2252f387635dc75042201d2a4bda1a9bd387c696 Mon Sep 17 00:00:00 2001 From: John Klug Date: Tue, 17 Jan 2017 09:19:24 -0600 Subject: ntp-utils needed to verify ntpd operation. --- recipes-core/images/mlinux-factory-image.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-core/images/mlinux-factory-image.bb b/recipes-core/images/mlinux-factory-image.bb index 710ebf7..b8d2676 100644 --- a/recipes-core/images/mlinux-factory-image.bb +++ b/recipes-core/images/mlinux-factory-image.bb @@ -82,6 +82,6 @@ IMAGE_INSTALL += "venus-gps" IMAGE_INSTALL += "pps-tools" # When ntp is to use the GPS, gps-utils is required -IMAGE_INSTALL += "gpsd ntp gps-utils gpsd-udev" +IMAGE_INSTALL += "gpsd ntp ntp-utils gps-utils gpsd-udev" IMAGE_INSTALL += "uvccapture" -- cgit v1.2.3 From 3959907c3a6a8d78368de3c624155260a2d418fe Mon Sep 17 00:00:00 2001 From: John Klug Date: Tue, 17 Jan 2017 12:06:49 -0600 Subject: Remove incorrect comments, and use syslog for logging --- recipes-support/ntp/files/ntp.conf.patch | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/recipes-support/ntp/files/ntp.conf.patch b/recipes-support/ntp/files/ntp.conf.patch index 499dac5..691d039 100644 --- a/recipes-support/ntp/files/ntp.conf.patch +++ b/recipes-support/ntp/files/ntp.conf.patch @@ -1,7 +1,7 @@ -diff -u old/ntp.conf new/ntp.conf ---- old/ntp.conf 2016-12-21 08:36:33.887646960 -0600 -+++ new/ntp.conf 2016-12-21 08:37:41.115645756 -0600 -@@ -1,7 +1,20 @@ +diff -Naur old/ntp.conf new/ntp.conf +--- old/ntp.conf 2017-01-17 12:00:15.560426583 -0600 ++++ new/ntp.conf 2017-01-17 12:02:11.968426337 -0600 +@@ -1,16 +1,44 @@ -# This is the most basic ntp configuration file # The driftfile must remain in a place specific to this # machine - it records the machine specific clock error @@ -23,20 +23,19 @@ diff -u old/ntp.conf new/ntp.conf + # This should be a server that is close (in IP terms) # to the machine. Add other servers as required. - # Unless you un-comment the line below ntpd will sync -@@ -9,8 +22,26 @@ +-# Unless you un-comment the line below ntpd will sync +-# only against the local system clock. # # server time.server.example.com # + -+logfile /var/log/ntp.log -+ +restrict default kod nomodify notrap nopeer noquery +restrict -6 default kod nomodify notrap nopeer noquery +restrict 127.0.0.1 mask 255.255.255.0 +restrict -6 ::1 + +# GPS Serial data reference (NTP0) ++# This sets the GPS 80 milliseconds slower than the PPS. +server 127.127.28.0 +fudge 127.127.28.0 time1 0.080 refid GPS + -- cgit v1.2.3 From e16cbd0bf5b2985cd78a26a82868d5cd3eb96da2 Mon Sep 17 00:00:00 2001 From: Jason Reiss Date: Tue, 17 Jan 2017 14:32:11 -0600 Subject: Update lora-network-server --- .../lora/lora-network-server_1.0.18.bb | 49 ---------------------- .../lora/lora-network-server_1.0.21.bb | 49 ++++++++++++++++++++++ 2 files changed, 49 insertions(+), 49 deletions(-) delete mode 100644 recipes-connectivity/lora/lora-network-server_1.0.18.bb create mode 100644 recipes-connectivity/lora/lora-network-server_1.0.21.bb diff --git a/recipes-connectivity/lora/lora-network-server_1.0.18.bb b/recipes-connectivity/lora/lora-network-server_1.0.18.bb deleted file mode 100644 index 1a7aab6..0000000 --- a/recipes-connectivity/lora/lora-network-server_1.0.18.bb +++ /dev/null @@ -1,49 +0,0 @@ -DESCRIPTION = "MultiTech LoRa Network Server" -PRIORITY = "optional" -SECTION = "console/utils" -LICENSE = "Proprietary" -LIC_FILES_CHKSUM = "file://LICENSE;md5=7ffae4666a986c4ccf45e99e464f8402" -DEPENDS = "jsoncpp libmts mosquitto sqlite3" -RDEPENDS_${PN} += "lora-packet-forwarder logrotate" -PR = "r1" - -SRC_URI = "http://multitech.net/downloads/lora-network-server_${TUNE_PKGARCH}_${PV}.tar.gz \ - file://lora-network-server.init \ - file://lora-network-server.default \ - file://lora-network-server.logrotate.conf \ - " - -SRC_URI[md5sum] = "9e83c88149fc9b9c969034edcc6371f8" -SRC_URI[sha256sum] = "1e94620eed249c0c431987ac64850e329f7506ddd2d3c2ff6de0a554cb76ed52" - -# binaries are already stripped, so suppress warning -INSANE_SKIP_${PN} = "already-stripped" - -S = "${WORKDIR}" - -LORA_DIR = "/opt/lora" - -do_compile() { -} - -inherit update-rc.d - -INITSCRIPT_NAME = "lora-network-server" -INITSCRIPT_PARAMS = "defaults 80 30" - -do_install() { - install -d ${D}${LORA_DIR} - install -m 0755 lora-network-server ${D}${LORA_DIR}/ - install -m 0644 lora-network-server.conf.sample ${D}${LORA_DIR}/lora-network-server.conf.sample - - install -d ${D}${sysconfdir}/default - install -m 0644 ${WORKDIR}/lora-network-server.default ${D}${sysconfdir}/default/lora-network-server - install -d ${D}${sysconfdir}/init.d - install -m 0755 ${WORKDIR}/lora-network-server.init ${D}${sysconfdir}/init.d/lora-network-server - install -d ${D}${sysconfdir}/logrotate.d - install -m 0644 ${WORKDIR}/lora-network-server.logrotate.conf ${D}${sysconfdir}/logrotate.d/lora-network-server.conf -} - -CONFFILES_${PN} = "${sysconfdir}/default/lora-network-server" -FILES_${PN} += "${LORA_DIR}" -FILES_${PN}-dbg += "${LORA_DIR}/.debug" diff --git a/recipes-connectivity/lora/lora-network-server_1.0.21.bb b/recipes-connectivity/lora/lora-network-server_1.0.21.bb new file mode 100644 index 0000000..5091b9d --- /dev/null +++ b/recipes-connectivity/lora/lora-network-server_1.0.21.bb @@ -0,0 +1,49 @@ +DESCRIPTION = "MultiTech LoRa Network Server" +PRIORITY = "optional" +SECTION = "console/utils" +LICENSE = "Proprietary" +LIC_FILES_CHKSUM = "file://LICENSE;md5=7ffae4666a986c4ccf45e99e464f8402" +DEPENDS = "jsoncpp libmts mosquitto sqlite3" +RDEPENDS_${PN} += "lora-packet-forwarder logrotate" +PR = "r1" + +SRC_URI = "http://multitech.net/downloads/lora-network-server_${TUNE_PKGARCH}_${PV}.tar.gz \ + file://lora-network-server.init \ + file://lora-network-server.default \ + file://lora-network-server.logrotate.conf \ + " + +SRC_URI[md5sum] = "5d8e6f207fa95c53844c8992a999a014" +SRC_URI[sha256sum] = "af454f942c8b441580b014087d4c707affc5016451a12ff493e63b4530ad10d9" + +# binaries are already stripped, so suppress warning +INSANE_SKIP_${PN} = "already-stripped" + +S = "${WORKDIR}" + +LORA_DIR = "/opt/lora" + +do_compile() { +} + +inherit update-rc.d + +INITSCRIPT_NAME = "lora-network-server" +INITSCRIPT_PARAMS = "defaults 80 30" + +do_install() { + install -d ${D}${LORA_DIR} + install -m 0755 lora-network-server ${D}${LORA_DIR}/ + install -m 0644 lora-network-server.conf.sample ${D}${LORA_DIR}/lora-network-server.conf.sample + + install -d ${D}${sysconfdir}/default + install -m 0644 ${WORKDIR}/lora-network-server.default ${D}${sysconfdir}/default/lora-network-server + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/lora-network-server.init ${D}${sysconfdir}/init.d/lora-network-server + install -d ${D}${sysconfdir}/logrotate.d + install -m 0644 ${WORKDIR}/lora-network-server.logrotate.conf ${D}${sysconfdir}/logrotate.d/lora-network-server.conf +} + +CONFFILES_${PN} = "${sysconfdir}/default/lora-network-server" +FILES_${PN} += "${LORA_DIR}" +FILES_${PN}-dbg += "${LORA_DIR}/.debug" -- cgit v1.2.3 From a55ba668fa18b75a00a8546a0408f90de39e7085 Mon Sep 17 00:00:00 2001 From: John Klug Date: Tue, 17 Jan 2017 16:39:07 -0600 Subject: Add ntpd config file item NTPD_ENABLED to enable/disable ntpd --- recipes-support/ntp/files/ntpd-default | 1 + recipes-support/ntp/files/ntpd-init.patch | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/recipes-support/ntp/files/ntpd-default b/recipes-support/ntp/files/ntpd-default index 4811f46..d4e13bd 100644 --- a/recipes-support/ntp/files/ntpd-default +++ b/recipes-support/ntp/files/ntpd-default @@ -1,3 +1,4 @@ +NTPD_ENABLED=1 # The GPSD_* parameters in this file are ignored # if the uBlox GPS is not present. diff --git a/recipes-support/ntp/files/ntpd-init.patch b/recipes-support/ntp/files/ntpd-init.patch index 05a6a8e..136edac 100644 --- a/recipes-support/ntp/files/ntpd-init.patch +++ b/recipes-support/ntp/files/ntpd-init.patch @@ -1,5 +1,6 @@ ---- old/ntpd 2017-01-12 18:10:40.208157197 -0600 -+++ new/ntpd 2017-01-12 18:14:27.952154318 -0600 +diff -Naur old/ntpd new/ntpd +--- old/ntpd 2017-01-17 16:26:47.427368196 -0600 ++++ new/ntpd 2017-01-17 16:32:15.366116859 -0600 @@ -1,6 +1,8 @@ -#! /bin/sh +#! /bin/bash @@ -50,3 +51,13 @@ } stopdaemon(){ echo -n "Stopping ntpd: " +@@ -34,6 +55,9 @@ + + case "$1" in + start) ++ if ((NTPD_ENABLED != 1)) ; then ++ exit 0 ++ fi + settick + startdaemon -g + ;; -- cgit v1.2.3 From 62ae734de0cd4263c015a4979020d256eb9cde8a Mon Sep 17 00:00:00 2001 From: John Klug Date: Wed, 18 Jan 2017 10:41:40 -0600 Subject: rs9113 factory image to contain the mlinux factory image --- recipes-core/images/mlinux-factory-image.bb | 1 + recipes-core/images/mlinux-rs9113-base-image.bb | 4 +- recipes-core/images/mlinux-rs9113-factory-image.bb | 87 +--------------------- 3 files changed, 7 insertions(+), 85 deletions(-) diff --git a/recipes-core/images/mlinux-factory-image.bb b/recipes-core/images/mlinux-factory-image.bb index b8d2676..c50619b 100644 --- a/recipes-core/images/mlinux-factory-image.bb +++ b/recipes-core/images/mlinux-factory-image.bb @@ -1,5 +1,6 @@ # Conduit 0.0 or 0.1 without RS9113 require mlinux-base-image.bb +DESCRIPTION = "mLinux factory image" LIGHTTPD = "lighttpd \ lighttpd-module-cgi lighttpd-module-indexfile \ diff --git a/recipes-core/images/mlinux-rs9113-base-image.bb b/recipes-core/images/mlinux-rs9113-base-image.bb index a4e9f23..78f604f 100644 --- a/recipes-core/images/mlinux-rs9113-base-image.bb +++ b/recipes-core/images/mlinux-rs9113-base-image.bb @@ -1,5 +1,5 @@ -require mlinux-base-image.bb -DESCRIPTION = "mLinux base image" +require mlinux-rs9113-base-image.bb +DESCRIPTION = "mLinux base image with rs9113 drivers" # Extra stuff to install IMAGE_INSTALL += " rs9113 " diff --git a/recipes-core/images/mlinux-rs9113-factory-image.bb b/recipes-core/images/mlinux-rs9113-factory-image.bb index bf2beaa..3fe2ca6 100644 --- a/recipes-core/images/mlinux-rs9113-factory-image.bb +++ b/recipes-core/images/mlinux-rs9113-factory-image.bb @@ -1,84 +1,5 @@ -require mlinux-rs9113-base-image.bb +require mlinux-factory-image.bb +DESCRIPTION = "mLinux factory image with rs9113 drivers" -LIGHTTPD = "lighttpd \ - lighttpd-module-cgi lighttpd-module-indexfile \ - lighttpd-module-redirect lighttpd-module-auth \ - lighttpd-module-access lighttpd-module-accesslog \ - lighttpd-module-rewrite lighttpd-module-proxy lighttpd-module-fastcgi \ - lighttpd-module-scgi lighttpd-module-alias \ - lighttpd-module-dirlisting lighttpd-module-staticfile \ - " - -# Lighttpd web server -IMAGE_INSTALL += "${LIGHTTPD}" - -IMAGE_INSTALL += "sqlite3" - -IMAGE_INSTALL += "autossh" - -# Monit system/process monitor -IMAGE_INSTALL += "monit" - -# LoRa support (MTAC-LORA accessory card) -IMAGE_INSTALL += "lora-gateway-utils lora-network-server lora-query" - -# MQTT server -IMAGE_INSTALL += "mosquitto mosquitto-clients" - -# Perl support -IMAGE_INSTALL += "perl" -IMAGE_INSTALL += "perl-module-io perl-module-fcntl" -# not in meta-oe or oe-core... -#IMAGE_INSTALL += "libdevice-serialport-perl" -#IMAGE_INSTALL += "libexpect-perl" - -# Python support -IMAGE_INSTALL += "python" -# Python modules -IMAGE_INSTALL += "python-async \ -python-argparse \ -python-compression \ -python-dateutil \ -python-html \ -python-psutil \ -python-pycurl \ -python-pyopenssl \ -python-pyserial \ -python-pyudev \ -python-pyusb \ -python-simplejson \ -python-sqlite3 \ -python-syslog \ -python-textutils \ -python-unixadmin \ -python-xml \ -" - -# Ruby support -IMAGE_INSTALL += "ruby" -IMAGE_INSTALL += "ruby-sqlite3" -IMAGE_INSTALL += "ruby-serialport" - -# OpenJDK Java runtime -IMAGE_INSTALL += "openjdk-7-jre" -# OpenJDK with JamVM VM (Multi-Tech default) -IMAGE_INSTALL += "openjdk-7-vm-jamvm" -# OpenJDK with CACAO VM (run with 'java -cacao') -IMAGE_INSTALL += "openjdk-7-vm-cacao" -# OpenJDK Zero VM (run with 'java -zero') -IMAGE_INSTALL += "openjdk-7-vm-zero" - -# PHP support -IMAGE_INSTALL += "php php-cli php-cgi" - -# Node.js support -IMAGE_INSTALL += "nodejs nodejs-npm" - -# Multi-Tech SMS Utility (see http://git.multitech.net) -IMAGE_INSTALL += "sms-utils" -# Multi-Tech GPS Utility -IMAGE_INSTALL += "venus-gps" -IMAGE_INSTALL += "pps-tools" -IMAGE_INSTALL += "gpsd" - -IMAGE_INSTALL += "uvccapture" +# Extra stuff to install +IMAGE_INSTALL += " rs9113 " -- cgit v1.2.3 From 40643007e2ba1ed38cdf7a9b1cdae13f251d455b Mon Sep 17 00:00:00 2001 From: John Klug Date: Wed, 18 Jan 2017 10:48:58 -0600 Subject: Fix recursion in mlinux-rs9113-base-image recipe --- recipes-core/images/mlinux-rs9113-base-image.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-core/images/mlinux-rs9113-base-image.bb b/recipes-core/images/mlinux-rs9113-base-image.bb index 78f604f..8aab186 100644 --- a/recipes-core/images/mlinux-rs9113-base-image.bb +++ b/recipes-core/images/mlinux-rs9113-base-image.bb @@ -1,4 +1,4 @@ -require mlinux-rs9113-base-image.bb +require mlinux-base-image.bb DESCRIPTION = "mLinux base image with rs9113 drivers" # Extra stuff to install -- cgit v1.2.3 From 788210e026ffcc5e1dfa64448648f8865106cbf7 Mon Sep 17 00:00:00 2001 From: John Klug Date: Thu, 19 Jan 2017 16:47:23 -0600 Subject: Remove excess usage from case statement --- recipes-navigation/gpsd/gpsd/gpsd | 3 --- 1 file changed, 3 deletions(-) diff --git a/recipes-navigation/gpsd/gpsd/gpsd b/recipes-navigation/gpsd/gpsd/gpsd index 857c561..6674028 100755 --- a/recipes-navigation/gpsd/gpsd/gpsd +++ b/recipes-navigation/gpsd/gpsd/gpsd @@ -139,9 +139,6 @@ case "$1" in exit 1 fi ;; - *) - echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|force-reload}" >&2 - ;; reload|force-reload) echo "Reloading $DESC" "$NAME" do_reload -- cgit v1.2.3 From 3e06d43781d9622ee6114c45848de6ddc91bda6c Mon Sep 17 00:00:00 2001 From: John Klug Date: Thu, 19 Jan 2017 17:04:20 -0600 Subject: Leap second fix for U-Blox message UBX_NAV_TIMELS --- recipes-navigation/gpsd/gpsd/0006-ubxtimelps.patch | 200 +++++++++++++++++++++ recipes-navigation/gpsd/gpsd_3.16.bb | 4 +- 2 files changed, 203 insertions(+), 1 deletion(-) create mode 100644 recipes-navigation/gpsd/gpsd/0006-ubxtimelps.patch diff --git a/recipes-navigation/gpsd/gpsd/0006-ubxtimelps.patch b/recipes-navigation/gpsd/gpsd/0006-ubxtimelps.patch new file mode 100644 index 0000000..e715847 --- /dev/null +++ b/recipes-navigation/gpsd/gpsd/0006-ubxtimelps.patch @@ -0,0 +1,200 @@ +diff -Naur old/driver_ubx.c new/driver_ubx.c +--- old/driver_ubx.c 2017-01-19 14:12:25.099231346 -0600 ++++ new/driver_ubx.c 2017-01-19 15:13:58.552152991 -0600 +@@ -57,6 +57,29 @@ + #define UBX_CFG_LEN 20 + #define outProtoMask 14 + ++#ifdef UBLOXTIMELS_ENABLE ++/* UBX-NAV-TIMELS support */ ++static char *srcOfCurrLs[] = { ++ "firmware", ++ "GPS GLONASS difference", ++ "GPS", ++ "SBAS", ++ "BeiDou", ++ "Galileo", ++ "Aided data", ++ "Configured" ++}; ++static char *srcOfLsChange[] = { ++ "No Source", ++ "Undefined", ++ "GPS", ++ "SBAS", ++ "BeiDou", ++ "Galileo", ++ "GLONOSS", ++}; ++#endif /* UBLOXTIMELS_ENABLE */ ++ + static gps_mask_t ubx_parse(struct gps_device_t *session, unsigned char *buf, + size_t len); + static gps_mask_t ubx_msg_nav_dop(struct gps_device_t *session, +@@ -237,6 +260,89 @@ + return mask; + } + ++#ifdef UBLOXTIMELS_ENABLE ++/** ++ * Navigation time to leap second ++ * ++ * Sets leap_notify if leap second is < 23 hours away. ++ */ ++static void ++ubx_msg_nav_timels(struct gps_device_t *session, unsigned char *buf, ++ size_t data_len) ++{ ++ int version; ++ unsigned int flags; ++ int valid_curr_ls; ++ int valid_time_to_ls_event; ++ ++ if (data_len != 24) { ++ gpsd_log(&session->context->errout, LOG_WARN, ++ "UBX-NAV-TIMELS: unexpected length %d, expecting 24\n", ++ data_len); ++ return; ++ } ++ version = getsb(buf,4); ++ /* Only version 0 is defined so far. */ ++ flags = (unsigned int)getub(buf, 23); ++ gpsd_log(&session->context->errout, LOG_DATA, ++ "UBX-NAV-TIMELS: flags 0x%x message version %d\n",flags, version); ++ valid_curr_ls = flags & UBX_TIMELS_VALID_CURR_LS; ++ valid_time_to_ls_event = flags & UBX_TIMELS_VALID_TIME_LS_EVT; ++ if(valid_curr_ls) { ++ unsigned int src_of_curr_ls = getub(buf,8); ++ int curr_ls = getsb(buf,9); ++ char *src = "Unknown"; ++ ++ if(src_of_curr_ls < (sizeof srcOfCurrLs/(sizeof srcOfCurrLs[0]))) ++ src = srcOfCurrLs[src_of_curr_ls]; ++ ++ gpsd_log(&session->context->errout, LOG_DATA, ++ "UBX-NAV-TIMELS: source_of_current_leapsecond=%u:%s curr_ls=%d\n", ++ src_of_curr_ls,src,curr_ls); ++ session->context->leap_seconds = curr_ls; ++ session->context->valid |= LEAP_SECOND_VALID; ++ } /* Valid current leap second */ ++ if(valid_time_to_ls_event) { ++ char *src="Unknown"; ++ unsigned int src_of_ls_change; ++ unsigned short dateOfLSGpsWn, dateOfLSGpsDn; ++ int lsChange = getsb(buf,11); ++ int timeToLsEvent = getles32(buf,12); ++ src_of_ls_change = getub(buf,10); ++ if(src_of_ls_change < (sizeof srcOfLsChange/(sizeof srcOfLsChange[0]))) ++ src = srcOfLsChange[src_of_ls_change]; ++ dateOfLSGpsWn = getles16(buf,16); ++ dateOfLSGpsDn = getles16(buf,18); ++ gpsd_log(&session->context->errout, LOG_DATA, ++ "UBX_NAV_TIMELS: source_of_leapsecond_change=%u:%s " ++ "leapSecondChage=%d timeToLsEvent=%d\n", ++ src_of_ls_change,src,lsChange,timeToLsEvent); ++ gpsd_log(&session->context->errout, LOG_DATA, ++ "UBX_NAV_TIMELS: dateOfLSGpsWn=%d dateOfLSGpsDn=%d\n", ++ dateOfLSGpsWn,dateOfLSGpsDn); ++ if(timeToLsEvent < 60*60*23 && timeToLsEvent > 0) { ++ if(lsChange == 0) ++ session->context->leap_notify = LEAP_NOWARNING; ++ else if (lsChange == 1) ++ session->context->leap_notify = LEAP_ADDSECOND; ++ else if (lsChange == -1) ++ session->context->leap_notify = LEAP_DELSECOND; ++ } else ++ session->context->leap_notify = LEAP_NOWARNING; ++ ++ if (session->context->leap_notify == LEAP_ADDSECOND) ++ gpsd_log(&session->context->errout,LOG_INF, ++ "UBX_NAV_TIMELS: Add leap second today\n"); ++ else if (session->context->leap_notify == LEAP_DELSECOND) ++ gpsd_log(&session->context->errout,LOG_INF, ++ "UBX_NAV_TIMELS: Remove leap second today\n"); ++ ++ gpsd_log(&session->context->errout, LOG_DATA, ++ "UBX_NAV_TIMELS: leaving: leap_notify=%d\n", ++ session->context->leap_notify); ++ } ++} ++#endif /* UBLOXTIMELS_ENABLE */ + /** + * Geodetic position solution message + */ +@@ -523,13 +629,22 @@ + case UBX_NAV_EKFSTATUS: + gpsd_log(&session->context->errout, LOG_DATA, "UBX_NAV_EKFSTATUS\n"); + break; +- ++ case UBX_NAV_TIMELS: ++ gpsd_log(&session->context->errout, LOG_DATA, "UBX_NAV_TIMELS\n"); ++#ifdef UBLOXTIMELS_ENABLE ++ ubx_msg_nav_timels(session, &buf[UBX_PREFIX_LEN],data_len); ++#endif // UBLOXTIMELS_ENABLE ++ break; + case UBX_RXM_RAW: + gpsd_log(&session->context->errout, LOG_DATA, "UBX_RXM_RAW\n"); + break; + case UBX_RXM_SFRB: ++ gpsd_log(&session->context->errout, LOG_DATA, "UBX_RXM_SFRB\n"); + mask = ubx_msg_sfrb(session, &buf[UBX_PREFIX_LEN]); + break; ++ case UBX_RXM_SFRBX: ++ gpsd_log(&session->context->errout, LOG_DATA, "UBX_RXM_SFRBX\n"); ++ break; + case UBX_RXM_SVSI: + gpsd_log(&session->context->errout, LOG_PROG, "UBX_RXM_SVSI\n"); + break; +@@ -955,6 +1070,12 @@ + msg[1] = 0x20; /* msg id = UBX_NAV_TIMEGPS */ + msg[2] = 0x01; /* rate */ + (void)ubx_write(session, 0x06u, 0x01, msg, 3); ++#ifdef UBLOXTIMELS_ENABLE ++ msg[0] = 0x01; /* class */ ++ msg[1] = 0x26; /* msg id = UBX_NAV_TIMELS */ ++ msg[2] = 0xff; /* rate */ ++#endif /* UBLOXTIMELS_ENABLE */ ++ (void)ubx_write(session, 0x06u, 0x01, msg, 3); + msg[0] = 0x01; /* class */ + msg[1] = 0x30; /* msg id = NAV-SVINFO */ + msg[2] = 0x0a; /* rate */ +diff -Naur old/driver_ubx.h new/driver_ubx.h +--- old/driver_ubx.h 2017-01-19 14:12:25.099231346 -0600 ++++ new/driver_ubx.h 2017-01-19 14:01:48.177653001 -0600 +@@ -35,6 +35,7 @@ + UBX_NAV_TIMEGPS = UBX_MSGID(UBX_CLASS_NAV, 0x20), + UBX_NAV_TIMEUTC = UBX_MSGID(UBX_CLASS_NAV, 0x21), + UBX_NAV_CLOCK = UBX_MSGID(UBX_CLASS_NAV, 0x22), ++ UBX_NAV_TIMELS = UBX_MSGID(UBX_CLASS_NAV, 0x26), + UBX_NAV_SVINFO = UBX_MSGID(UBX_CLASS_NAV, 0x30), + UBX_NAV_DGPS = UBX_MSGID(UBX_CLASS_NAV, 0x31), + UBX_NAV_SBAS = UBX_MSGID(UBX_CLASS_NAV, 0x32), +@@ -42,6 +43,7 @@ + + UBX_RXM_RAW = UBX_MSGID(UBX_CLASS_RXM, 0x10), + UBX_RXM_SFRB = UBX_MSGID(UBX_CLASS_RXM, 0x11), ++ UBX_RXM_SFRBX = UBX_MSGID(UBX_CLASS_RXM, 0x13), + UBX_RXM_SVSI = UBX_MSGID(UBX_CLASS_RXM, 0x20), + UBX_RXM_ALM = UBX_MSGID(UBX_CLASS_RXM, 0x30), + UBX_RXM_EPH = UBX_MSGID(UBX_CLASS_RXM, 0x31), +@@ -102,6 +104,9 @@ + #define UBX_SOL_VALID_WEEK 0x04 + #define UBX_SOL_VALID_TIME 0x08 + ++#define UBX_TIMELS_VALID_CURR_LS 0x01 ++#define UBX_TIMELS_VALID_TIME_LS_EVT 0x01 ++ + /* from UBX_NAV_SVINFO */ + #define UBX_SAT_USED 0x01 + #define UBX_SAT_DGPS 0x02 +diff -Naur old/SConstruct new/SConstruct +--- old/SConstruct 2017-01-19 14:51:35.638466569 -0600 ++++ new/SConstruct 2017-01-19 15:20:02.488159765 -0600 +@@ -113,6 +113,7 @@ + ("tripmate", True, "DeLorme TripMate support"), + ("tsip", True, "Trimble TSIP support"), + ("ublox", True, "u-blox Protocol support"), ++ ("ubloxtimels", False, "u-blox UBX-NAV-TIMELS support (leap second)"), + ("fury", True, "Jackson Labs Fury and Firefly support"), + ("nmea2000", True, "NMEA2000/CAN support"), + # Non-GPS protocols diff --git a/recipes-navigation/gpsd/gpsd_3.16.bb b/recipes-navigation/gpsd/gpsd_3.16.bb index 7e573f8..52aa9a9 100644 --- a/recipes-navigation/gpsd/gpsd_3.16.bb +++ b/recipes-navigation/gpsd/gpsd_3.16.bb @@ -4,7 +4,7 @@ LICENSE = "BSD" LIC_FILES_CHKSUM = "file://COPYING;md5=d217a23f408e91c94359447735bc1800" DEPENDS = "dbus dbus-glib ncurses python libusb1 chrpath-replacement-native pps-tools" PROVIDES = "virtual/gpsd" -PR="m1" +PR="m2" EXTRANATIVEPATH += "chrpath-native" @@ -14,6 +14,7 @@ SRC_URI = "${SAVANNAH_GNU_MIRROR}/${BPN}/${BP}.tar.gz \ file://0004-SConstruct-disable-html-and-man-docs-building-becaus.patch \ file://0001-include-sys-ttydefaults.h.patch \ file://0005-suppress-text-in-binary.patch \ + file://0006-ubxtimelps.patch \ file://gpsd-default \ file://gpsd \ file://gpsd_ubx_fixed.sh \ @@ -58,6 +59,7 @@ EXTRA_OESCONS = " \ systemd='${SYSTEMD_OESCONS}' \ libdir='${libdir}' \ ublox='yes' \ + ubloxtimels='yes' \ pps='yes' \ gpsd_group='gps' \ ntpshm='yes' \ -- cgit v1.2.3 From 1543b989f23af92550fdc18970c169f6964f3d4a Mon Sep 17 00:00:00 2001 From: Brandon Bayer Date: Fri, 20 Jan 2017 15:02:36 -0600 Subject: refacter: lora recipe --- recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb b/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb index ada0493..e9ff489 100644 --- a/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb +++ b/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb @@ -47,26 +47,21 @@ do_install() { install -m 755 util_ack/util_ack ${D}${LORA_DIR}/forwarder-utils/ install -m 755 util_tx_test/util_tx_test ${D}${LORA_DIR}/forwarder-utils/ install -m 755 ${WORKDIR}/README.md ${D}${LORA_DIR}/ + + install -d ${D}${sysconfdir}/default + install -m 0644 ${WORKDIR}/lora-packet-forwarder.default ${D}${sysconfdir}/default/lora-packet-forwarder + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/lora-packet-forwarder.init ${D}${sysconfdir}/init.d/lora-packet-forwarder } do_install_append_mtcdt() { install -m 755 ${WORKDIR}/global_conf.json.3.0.0.MTAC_LORA_1_5.EU868.basic.clksrc0 ${D}${LORA_DIR}/global_conf.json install -m 755 ${WORKDIR}/global_conf.json.3.0.0.MTAC_LORA_1_0.EU868.basic.clksrc0 ${D}${LORA_DIR}/global_conf.json.MTAC_LORA_1_0 install -m 755 ${WORKDIR}/global_conf.json.3.0.0.MTAC_LORA_1_5.EU868.basic.clksrc0 ${D}${LORA_DIR}/global_conf.json.MTAC_LORA_1_5 - - install -d ${D}${sysconfdir}/default - install -m 0644 ${WORKDIR}/lora-packet-forwarder.default ${D}${sysconfdir}/default/lora-packet-forwarder - install -d ${D}${sysconfdir}/init.d - install -m 0755 ${WORKDIR}/lora-packet-forwarder.init ${D}${sysconfdir}/init.d/lora-packet-forwarder } do_install_append_mtcap() { install -m 755 ${WORKDIR}/global_conf.json.3.0.0.MTCAP-LORA-1-5.EU868.basic ${D}${LORA_DIR}/global_conf.json - - install -d ${D}${sysconfdir}/default - install -m 0644 ${WORKDIR}/lora-packet-forwarder.default ${D}${sysconfdir}/default/lora-packet-forwarder - install -d ${D}${sysconfdir}/init.d - install -m 0755 ${WORKDIR}/lora-packet-forwarder.init ${D}${sysconfdir}/init.d/lora-packet-forwarder } FILES_${PN} += "${LORA_DIR}" -- cgit v1.2.3 From d07f3c058d205d73795dcdf4c82c0988523cb275 Mon Sep 17 00:00:00 2001 From: Brandon Bayer Date: Fri, 20 Jan 2017 15:40:35 -0600 Subject: mtcap:fix: remove comments from global_conf.json --- ...obal_conf.json.3.0.0.MTCAP-LORA-1-5.EU868.basic | 38 +++------------------- 1 file changed, 4 insertions(+), 34 deletions(-) diff --git a/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.3.0.0.MTCAP-LORA-1-5.EU868.basic b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.3.0.0.MTCAP-LORA-1-5.EU868.basic index 8f8d93d..e29b1f1 100644 --- a/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.3.0.0.MTCAP-LORA-1-5.EU868.basic +++ b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.3.0.0.MTCAP-LORA-1-5.EU868.basic @@ -1,17 +1,17 @@ { "SX1301_conf": { "lorawan_public": true, - "clksrc": 0, /* radio_0 provides clock to concentrator */ + "clksrc": 0, "lbt_cfg": { "enable": false, - "rssi_target": 160, /* rssi in dBm = -lbt_rssi_target/2 */ + "rssi_target": 160, "nb_channel": 1, "start_freq": 869525000, "scan_time_us": 5000, "tx_delay_1ch_us": 4000000, "tx_delay_2ch_us": 4000000 }, - "antenna_gain": 1.4, /* antenna gain, in dBi */ + "antenna_gain": 1.4, "radio_0": { "enable": true, "type": "SX1257", @@ -29,55 +29,46 @@ "tx_enable": false }, "chan_multiSF_0": { - /* Lora MAC channel, 125kHz, all SF, 868.1 MHz */ "enable": true, "radio": 1, "if": -400000 }, "chan_multiSF_1": { - /* Lora MAC channel, 125kHz, all SF, 868.3 MHz */ "enable": true, "radio": 1, "if": -200000 }, "chan_multiSF_2": { - /* Lora MAC channel, 125kHz, all SF, 868.5 MHz */ "enable": true, "radio": 1, "if": 0 }, "chan_multiSF_3": { - /* Lora MAC channel, 125kHz, all SF, 867.1 MHz */ "enable": true, "radio": 0, "if": -400000 }, "chan_multiSF_4": { - /* Lora MAC channel, 125kHz, all SF, 867.3 MHz */ "enable": true, "radio": 0, "if": -200000 }, "chan_multiSF_5": { - /* Lora MAC channel, 125kHz, all SF, 867.5 MHz */ "enable": true, "radio": 0, "if": 0 }, "chan_multiSF_6": { - /* Lora MAC channel, 125kHz, all SF, 867.7 MHz */ "enable": true, "radio": 0, "if": 200000 }, "chan_multiSF_7": { - /* Lora MAC channel, 125kHz, all SF, 867.9 MHz */ "enable": true, "radio": 0, "if": 400000 }, "chan_Lora_std": { - /* Lora MAC channel, 250kHz, SF7, 868.3 MHz */ "enable": true, "radio": 1, "if": -200000, @@ -85,7 +76,6 @@ "spread_factor": 7 }, "chan_FSK": { - /* FSK 50kbps channel, 868.8 MHz */ "enable": true, "radio": 1, "if": 300000, @@ -93,130 +83,110 @@ "datarate": 50000 }, "tx_lut_0": { - /* TX gain table, index 0 */ "pa_gain": 0, "mix_gain": 9, "rf_power": -6, "dig_gain": 1 }, "tx_lut_1": { - /* TX gain table, index 1 */ "pa_gain": 0, "mix_gain": 12, "rf_power": -3, "dig_gain": 1 }, "tx_lut_2": { - /* TX gain table, index 2 */ "pa_gain": 1, "mix_gain": 8, "rf_power": 0, "dig_gain": 2 }, "tx_lut_3": { - /* TX gain table, index 3 */ "pa_gain": 1, "mix_gain": 11, "rf_power": 3, "dig_gain": 3 }, "tx_lut_4": { - /* TX gain table, index 4 */ "pa_gain": 1, "mix_gain": 10, "rf_power": 6, "dig_gain": 0 }, "tx_lut_5": { - /* TX gain table, index 5 */ "pa_gain": 2, "mix_gain": 11, "rf_power": 10, "dig_gain": 3 }, "tx_lut_6": { - /* TX gain table, index 6 */ "pa_gain": 2, "mix_gain": 9, "rf_power": 11, "dig_gain": 1 }, "tx_lut_7": { - /* TX gain table, index 7 */ "pa_gain": 2, "mix_gain": 9, "rf_power": 12, "dig_gain": 0 }, "tx_lut_8": { - /* TX gain table, index 8 */ "pa_gain": 2, "mix_gain": 11, "rf_power": 13, "dig_gain": 2 }, "tx_lut_9": { - /* TX gain table, index 9 */ "pa_gain": 2, "mix_gain": 11, "rf_power": 14, "dig_gain": 1 }, "tx_lut_10": { - /* TX gain table, index 10 */ "pa_gain": 2, "mix_gain": 12, "rf_power": 16, "dig_gain": 0 }, "tx_lut_11": { - /* TX gain table, index 11 */ "pa_gain": 3, "mix_gain": 10, "rf_power": 20, "dig_gain": 3 }, "tx_lut_12": { - /* TX gain table, index 12 */ "pa_gain": 3, "mix_gain": 9, "rf_power": 23, "dig_gain": 0 }, "tx_lut_13": { - /* TX gain table, index 13 */ "pa_gain": 3, "mix_gain": 12, "rf_power": 25, "dig_gain": 2 }, "tx_lut_14": { - /* TX gain table, index 14 */ "pa_gain": 3, "mix_gain": 13, "rf_power": 26, "dig_gain": 0 }, "tx_lut_15": { - /* TX gain table, index 15 */ "pa_gain": 3, "mix_gain": 15, "rf_power": 27, "dig_gain": 0 } }, - "gateway_conf": { - "gateway_ID": "AA555A0000000000", - /* change with default server address/ports, or overwrite in local_conf.json */ + "gateway_ID": "", "server_address": "localhost", "serv_port_up": 1680, "serv_port_down": 1680, - /* adjust the following parameters for your network */ "keepalive_interval": 10, "stat_interval": 30, "push_timeout_ms": 100, - /* forward only valid packets */ "forward_crc_valid": true, "forward_crc_error": false, "forward_crc_disabled": false -- cgit v1.2.3 From 49abc027832e86a0b919ea6e2ddf2fa2e24a2979 Mon Sep 17 00:00:00 2001 From: John Klug Date: Fri, 20 Jan 2017 16:32:04 -0600 Subject: Use flag ENABLED in /etc/default like other MTS services --- recipes-support/ntp/files/ntpd-init.patch | 36 +++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/recipes-support/ntp/files/ntpd-init.patch b/recipes-support/ntp/files/ntpd-init.patch index 136edac..41c7549 100644 --- a/recipes-support/ntp/files/ntpd-init.patch +++ b/recipes-support/ntp/files/ntpd-init.patch @@ -1,6 +1,6 @@ diff -Naur old/ntpd new/ntpd --- old/ntpd 2017-01-17 16:26:47.427368196 -0600 -+++ new/ntpd 2017-01-17 16:32:15.366116859 -0600 ++++ new/ntpd 2017-01-20 16:26:52.154738981 -0600 @@ -1,6 +1,8 @@ -#! /bin/sh +#! /bin/bash @@ -51,13 +51,37 @@ diff -Naur old/ntpd new/ntpd } stopdaemon(){ echo -n "Stopping ntpd: " -@@ -34,6 +55,9 @@ +@@ -34,24 +55,27 @@ case "$1" in start) -+ if ((NTPD_ENABLED != 1)) ; then -+ exit 0 -+ fi - settick +- settick ++ if ! [[ $ENABLED =~ ^[yY][eE][sS]$ ]] ; then ++ exit 0 ++ fi ++ settick + startdaemon -g + ;; + stop) +- stopdaemon ++ stopdaemon + ;; + force-reload) +- stopdaemon +- settick ++ stopdaemon ++ settick startdaemon -g ;; + restart) +- # Don't reset the tick here ++ # Don't reset the tick here + stopdaemon + startdaemon -g + ;; + reload) +- # Must do this by hand, but don't do -g ++ # Must do this by hand, but don't do -g + stopdaemon + startdaemon + ;; -- cgit v1.2.3 From a209a95cebfba75eff3f65836a79b33bc10bc701 Mon Sep 17 00:00:00 2001 From: John Klug Date: Fri, 20 Jan 2017 16:32:58 -0600 Subject: Use flag ENABLED in /etc/default like other MTS services --- recipes-navigation/gpsd/gpsd/gpsd | 14 +++++++------- recipes-navigation/gpsd/gpsd/gpsd-default | 3 +-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/recipes-navigation/gpsd/gpsd/gpsd b/recipes-navigation/gpsd/gpsd/gpsd index 6674028..ed86ecf 100755 --- a/recipes-navigation/gpsd/gpsd/gpsd +++ b/recipes-navigation/gpsd/gpsd/gpsd @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ### BEGIN INIT INFO # Provides: gpsd # Required-Start: $remote_fs $network @@ -51,9 +51,6 @@ fi # do_start() { - if ((GPSD_NOSTART != 0)) ; then - exit 0 - fi /usr/sbin/start-stop-daemon -N -20 --start --quiet --pidfile $PIDFILE --exec $DAEMON --test \ -- $GPSD_OPTIONS -P $PIDFILE $GPS_DEVICES > /dev/null \ || return 1 @@ -119,9 +116,12 @@ do_status() { case "$1" in start) - echo "Starting $DESC" "$NAME" - do_start - exit $? + if ! [[ $ENABLED =~ ^[yY][eE][sS]$ ]] ; then + exit 0 + fi + echo "Starting $DESC" "$NAME" + do_start + exit $? ;; stop) echo "Stopping $DESC" "$NAME" diff --git a/recipes-navigation/gpsd/gpsd/gpsd-default b/recipes-navigation/gpsd/gpsd/gpsd-default index f9c1bec..da697bc 100644 --- a/recipes-navigation/gpsd/gpsd/gpsd-default +++ b/recipes-navigation/gpsd/gpsd/gpsd-default @@ -1,3 +1,4 @@ +ENABLED="yes" GPSD_SOCKET="/var/run/gpsd.sock" GPSD_OPTIONS="-n -D 1" @@ -8,8 +9,6 @@ GPS_LINE=/dev/ttyXRUSB2 GPS_BAUD=115200 GPS_DEVICES="$GPS_LINE /dev/pps0" -GPSD_NOSTART=0 - GPS_FIXFILE=/var/run/gpsfix # GPSD/UBlox Lock requiremnt -- cgit v1.2.3 From 979946da3ed44d340c2840a454148ec51ebe79d4 Mon Sep 17 00:00:00 2001 From: John Klug Date: Fri, 20 Jan 2017 17:37:03 -0600 Subject: ublox 8 is 50ms faster than ublox 7 --- recipes-support/ntp/files/ntp.conf.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes-support/ntp/files/ntp.conf.patch b/recipes-support/ntp/files/ntp.conf.patch index 691d039..2fd26ef 100644 --- a/recipes-support/ntp/files/ntp.conf.patch +++ b/recipes-support/ntp/files/ntp.conf.patch @@ -35,9 +35,9 @@ diff -Naur old/ntp.conf new/ntp.conf +restrict -6 ::1 + +# GPS Serial data reference (NTP0) -+# This sets the GPS 80 milliseconds slower than the PPS. ++# This sets the GPS 50 milliseconds slower than the PPS. +server 127.127.28.0 -+fudge 127.127.28.0 time1 0.080 refid GPS ++fudge 127.127.28.0 time1 0.050 refid GPS + +# GPS PPS reference (NTP2) +server 127.127.28.2 prefer -- cgit v1.2.3 From 65b363bd0d5fda841ca73bf023093d3ec7538138 Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 23 Jan 2017 10:04:52 -0600 Subject: Remove code that contradicts ITU leap second standard --- .../gpsd/gpsd-3.16/0006-itu_r_tf_460_6.patch | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 recipes-navigation/gpsd/gpsd-3.16/0006-itu_r_tf_460_6.patch diff --git a/recipes-navigation/gpsd/gpsd-3.16/0006-itu_r_tf_460_6.patch b/recipes-navigation/gpsd/gpsd-3.16/0006-itu_r_tf_460_6.patch new file mode 100644 index 0000000..8e8d814 --- /dev/null +++ b/recipes-navigation/gpsd/gpsd-3.16/0006-itu_r_tf_460_6.patch @@ -0,0 +1,23 @@ +diff -Naur old/ntpshmwrite.c new/ntpshmwrite.c +--- old/ntpshmwrite.c 2017-01-23 10:00:05.497129473 -0600 ++++ new/ntpshmwrite.c 2017-01-23 09:47:58.881627772 -0600 +@@ -32,11 +32,18 @@ + * NTP expects leap pending for only 1 month prior to insertion + * Per http://bugs.ntp.org/1090 */ + (void)gmtime_r( &(td->real.tv_sec), &tm); ++/* This code contradicts page 3 section 2.1 of ITU-R RV.460-6 that ++ * leap second may occur at the last second of a month, with ++ * preference for December and June, 2nd preference to March and ++ * September. ++ * https://www.itu.int/dms_pubrec/itu-r/rec/tf/R-REC-TF.460-6-200202-I!!PDF-E.pdf ++ */ ++#ifdef NOTITU_R_TF_460_6 + if ( 5 != tm.tm_mon && 11 != tm.tm_mon ) { + /* Not june, not December, no way */ + leap_notify = LEAP_NOWARNING; + } +- ++#endif /* NOTITU_R_TF_460_6 */ + /* we use the shmTime mode 1 protocol + * + * ntpd does this: -- cgit v1.2.3 From e95f87c1f477f9f89491c4954fff2af1549d910a Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 23 Jan 2017 11:48:49 -0600 Subject: Remove gpsd code that contradicts ITU leap second standard --- .../gpsd/gpsd-3.16/0006-ubxtimelps.patch | 200 +++++++++++++++++++++ recipes-navigation/gpsd/gpsd/0006-ubxtimelps.patch | 200 --------------------- recipes-navigation/gpsd/gpsd_3.16.bb | 1 + 3 files changed, 201 insertions(+), 200 deletions(-) create mode 100644 recipes-navigation/gpsd/gpsd-3.16/0006-ubxtimelps.patch delete mode 100644 recipes-navigation/gpsd/gpsd/0006-ubxtimelps.patch diff --git a/recipes-navigation/gpsd/gpsd-3.16/0006-ubxtimelps.patch b/recipes-navigation/gpsd/gpsd-3.16/0006-ubxtimelps.patch new file mode 100644 index 0000000..e715847 --- /dev/null +++ b/recipes-navigation/gpsd/gpsd-3.16/0006-ubxtimelps.patch @@ -0,0 +1,200 @@ +diff -Naur old/driver_ubx.c new/driver_ubx.c +--- old/driver_ubx.c 2017-01-19 14:12:25.099231346 -0600 ++++ new/driver_ubx.c 2017-01-19 15:13:58.552152991 -0600 +@@ -57,6 +57,29 @@ + #define UBX_CFG_LEN 20 + #define outProtoMask 14 + ++#ifdef UBLOXTIMELS_ENABLE ++/* UBX-NAV-TIMELS support */ ++static char *srcOfCurrLs[] = { ++ "firmware", ++ "GPS GLONASS difference", ++ "GPS", ++ "SBAS", ++ "BeiDou", ++ "Galileo", ++ "Aided data", ++ "Configured" ++}; ++static char *srcOfLsChange[] = { ++ "No Source", ++ "Undefined", ++ "GPS", ++ "SBAS", ++ "BeiDou", ++ "Galileo", ++ "GLONOSS", ++}; ++#endif /* UBLOXTIMELS_ENABLE */ ++ + static gps_mask_t ubx_parse(struct gps_device_t *session, unsigned char *buf, + size_t len); + static gps_mask_t ubx_msg_nav_dop(struct gps_device_t *session, +@@ -237,6 +260,89 @@ + return mask; + } + ++#ifdef UBLOXTIMELS_ENABLE ++/** ++ * Navigation time to leap second ++ * ++ * Sets leap_notify if leap second is < 23 hours away. ++ */ ++static void ++ubx_msg_nav_timels(struct gps_device_t *session, unsigned char *buf, ++ size_t data_len) ++{ ++ int version; ++ unsigned int flags; ++ int valid_curr_ls; ++ int valid_time_to_ls_event; ++ ++ if (data_len != 24) { ++ gpsd_log(&session->context->errout, LOG_WARN, ++ "UBX-NAV-TIMELS: unexpected length %d, expecting 24\n", ++ data_len); ++ return; ++ } ++ version = getsb(buf,4); ++ /* Only version 0 is defined so far. */ ++ flags = (unsigned int)getub(buf, 23); ++ gpsd_log(&session->context->errout, LOG_DATA, ++ "UBX-NAV-TIMELS: flags 0x%x message version %d\n",flags, version); ++ valid_curr_ls = flags & UBX_TIMELS_VALID_CURR_LS; ++ valid_time_to_ls_event = flags & UBX_TIMELS_VALID_TIME_LS_EVT; ++ if(valid_curr_ls) { ++ unsigned int src_of_curr_ls = getub(buf,8); ++ int curr_ls = getsb(buf,9); ++ char *src = "Unknown"; ++ ++ if(src_of_curr_ls < (sizeof srcOfCurrLs/(sizeof srcOfCurrLs[0]))) ++ src = srcOfCurrLs[src_of_curr_ls]; ++ ++ gpsd_log(&session->context->errout, LOG_DATA, ++ "UBX-NAV-TIMELS: source_of_current_leapsecond=%u:%s curr_ls=%d\n", ++ src_of_curr_ls,src,curr_ls); ++ session->context->leap_seconds = curr_ls; ++ session->context->valid |= LEAP_SECOND_VALID; ++ } /* Valid current leap second */ ++ if(valid_time_to_ls_event) { ++ char *src="Unknown"; ++ unsigned int src_of_ls_change; ++ unsigned short dateOfLSGpsWn, dateOfLSGpsDn; ++ int lsChange = getsb(buf,11); ++ int timeToLsEvent = getles32(buf,12); ++ src_of_ls_change = getub(buf,10); ++ if(src_of_ls_change < (sizeof srcOfLsChange/(sizeof srcOfLsChange[0]))) ++ src = srcOfLsChange[src_of_ls_change]; ++ dateOfLSGpsWn = getles16(buf,16); ++ dateOfLSGpsDn = getles16(buf,18); ++ gpsd_log(&session->context->errout, LOG_DATA, ++ "UBX_NAV_TIMELS: source_of_leapsecond_change=%u:%s " ++ "leapSecondChage=%d timeToLsEvent=%d\n", ++ src_of_ls_change,src,lsChange,timeToLsEvent); ++ gpsd_log(&session->context->errout, LOG_DATA, ++ "UBX_NAV_TIMELS: dateOfLSGpsWn=%d dateOfLSGpsDn=%d\n", ++ dateOfLSGpsWn,dateOfLSGpsDn); ++ if(timeToLsEvent < 60*60*23 && timeToLsEvent > 0) { ++ if(lsChange == 0) ++ session->context->leap_notify = LEAP_NOWARNING; ++ else if (lsChange == 1) ++ session->context->leap_notify = LEAP_ADDSECOND; ++ else if (lsChange == -1) ++ session->context->leap_notify = LEAP_DELSECOND; ++ } else ++ session->context->leap_notify = LEAP_NOWARNING; ++ ++ if (session->context->leap_notify == LEAP_ADDSECOND) ++ gpsd_log(&session->context->errout,LOG_INF, ++ "UBX_NAV_TIMELS: Add leap second today\n"); ++ else if (session->context->leap_notify == LEAP_DELSECOND) ++ gpsd_log(&session->context->errout,LOG_INF, ++ "UBX_NAV_TIMELS: Remove leap second today\n"); ++ ++ gpsd_log(&session->context->errout, LOG_DATA, ++ "UBX_NAV_TIMELS: leaving: leap_notify=%d\n", ++ session->context->leap_notify); ++ } ++} ++#endif /* UBLOXTIMELS_ENABLE */ + /** + * Geodetic position solution message + */ +@@ -523,13 +629,22 @@ + case UBX_NAV_EKFSTATUS: + gpsd_log(&session->context->errout, LOG_DATA, "UBX_NAV_EKFSTATUS\n"); + break; +- ++ case UBX_NAV_TIMELS: ++ gpsd_log(&session->context->errout, LOG_DATA, "UBX_NAV_TIMELS\n"); ++#ifdef UBLOXTIMELS_ENABLE ++ ubx_msg_nav_timels(session, &buf[UBX_PREFIX_LEN],data_len); ++#endif // UBLOXTIMELS_ENABLE ++ break; + case UBX_RXM_RAW: + gpsd_log(&session->context->errout, LOG_DATA, "UBX_RXM_RAW\n"); + break; + case UBX_RXM_SFRB: ++ gpsd_log(&session->context->errout, LOG_DATA, "UBX_RXM_SFRB\n"); + mask = ubx_msg_sfrb(session, &buf[UBX_PREFIX_LEN]); + break; ++ case UBX_RXM_SFRBX: ++ gpsd_log(&session->context->errout, LOG_DATA, "UBX_RXM_SFRBX\n"); ++ break; + case UBX_RXM_SVSI: + gpsd_log(&session->context->errout, LOG_PROG, "UBX_RXM_SVSI\n"); + break; +@@ -955,6 +1070,12 @@ + msg[1] = 0x20; /* msg id = UBX_NAV_TIMEGPS */ + msg[2] = 0x01; /* rate */ + (void)ubx_write(session, 0x06u, 0x01, msg, 3); ++#ifdef UBLOXTIMELS_ENABLE ++ msg[0] = 0x01; /* class */ ++ msg[1] = 0x26; /* msg id = UBX_NAV_TIMELS */ ++ msg[2] = 0xff; /* rate */ ++#endif /* UBLOXTIMELS_ENABLE */ ++ (void)ubx_write(session, 0x06u, 0x01, msg, 3); + msg[0] = 0x01; /* class */ + msg[1] = 0x30; /* msg id = NAV-SVINFO */ + msg[2] = 0x0a; /* rate */ +diff -Naur old/driver_ubx.h new/driver_ubx.h +--- old/driver_ubx.h 2017-01-19 14:12:25.099231346 -0600 ++++ new/driver_ubx.h 2017-01-19 14:01:48.177653001 -0600 +@@ -35,6 +35,7 @@ + UBX_NAV_TIMEGPS = UBX_MSGID(UBX_CLASS_NAV, 0x20), + UBX_NAV_TIMEUTC = UBX_MSGID(UBX_CLASS_NAV, 0x21), + UBX_NAV_CLOCK = UBX_MSGID(UBX_CLASS_NAV, 0x22), ++ UBX_NAV_TIMELS = UBX_MSGID(UBX_CLASS_NAV, 0x26), + UBX_NAV_SVINFO = UBX_MSGID(UBX_CLASS_NAV, 0x30), + UBX_NAV_DGPS = UBX_MSGID(UBX_CLASS_NAV, 0x31), + UBX_NAV_SBAS = UBX_MSGID(UBX_CLASS_NAV, 0x32), +@@ -42,6 +43,7 @@ + + UBX_RXM_RAW = UBX_MSGID(UBX_CLASS_RXM, 0x10), + UBX_RXM_SFRB = UBX_MSGID(UBX_CLASS_RXM, 0x11), ++ UBX_RXM_SFRBX = UBX_MSGID(UBX_CLASS_RXM, 0x13), + UBX_RXM_SVSI = UBX_MSGID(UBX_CLASS_RXM, 0x20), + UBX_RXM_ALM = UBX_MSGID(UBX_CLASS_RXM, 0x30), + UBX_RXM_EPH = UBX_MSGID(UBX_CLASS_RXM, 0x31), +@@ -102,6 +104,9 @@ + #define UBX_SOL_VALID_WEEK 0x04 + #define UBX_SOL_VALID_TIME 0x08 + ++#define UBX_TIMELS_VALID_CURR_LS 0x01 ++#define UBX_TIMELS_VALID_TIME_LS_EVT 0x01 ++ + /* from UBX_NAV_SVINFO */ + #define UBX_SAT_USED 0x01 + #define UBX_SAT_DGPS 0x02 +diff -Naur old/SConstruct new/SConstruct +--- old/SConstruct 2017-01-19 14:51:35.638466569 -0600 ++++ new/SConstruct 2017-01-19 15:20:02.488159765 -0600 +@@ -113,6 +113,7 @@ + ("tripmate", True, "DeLorme TripMate support"), + ("tsip", True, "Trimble TSIP support"), + ("ublox", True, "u-blox Protocol support"), ++ ("ubloxtimels", False, "u-blox UBX-NAV-TIMELS support (leap second)"), + ("fury", True, "Jackson Labs Fury and Firefly support"), + ("nmea2000", True, "NMEA2000/CAN support"), + # Non-GPS protocols diff --git a/recipes-navigation/gpsd/gpsd/0006-ubxtimelps.patch b/recipes-navigation/gpsd/gpsd/0006-ubxtimelps.patch deleted file mode 100644 index e715847..0000000 --- a/recipes-navigation/gpsd/gpsd/0006-ubxtimelps.patch +++ /dev/null @@ -1,200 +0,0 @@ -diff -Naur old/driver_ubx.c new/driver_ubx.c ---- old/driver_ubx.c 2017-01-19 14:12:25.099231346 -0600 -+++ new/driver_ubx.c 2017-01-19 15:13:58.552152991 -0600 -@@ -57,6 +57,29 @@ - #define UBX_CFG_LEN 20 - #define outProtoMask 14 - -+#ifdef UBLOXTIMELS_ENABLE -+/* UBX-NAV-TIMELS support */ -+static char *srcOfCurrLs[] = { -+ "firmware", -+ "GPS GLONASS difference", -+ "GPS", -+ "SBAS", -+ "BeiDou", -+ "Galileo", -+ "Aided data", -+ "Configured" -+}; -+static char *srcOfLsChange[] = { -+ "No Source", -+ "Undefined", -+ "GPS", -+ "SBAS", -+ "BeiDou", -+ "Galileo", -+ "GLONOSS", -+}; -+#endif /* UBLOXTIMELS_ENABLE */ -+ - static gps_mask_t ubx_parse(struct gps_device_t *session, unsigned char *buf, - size_t len); - static gps_mask_t ubx_msg_nav_dop(struct gps_device_t *session, -@@ -237,6 +260,89 @@ - return mask; - } - -+#ifdef UBLOXTIMELS_ENABLE -+/** -+ * Navigation time to leap second -+ * -+ * Sets leap_notify if leap second is < 23 hours away. -+ */ -+static void -+ubx_msg_nav_timels(struct gps_device_t *session, unsigned char *buf, -+ size_t data_len) -+{ -+ int version; -+ unsigned int flags; -+ int valid_curr_ls; -+ int valid_time_to_ls_event; -+ -+ if (data_len != 24) { -+ gpsd_log(&session->context->errout, LOG_WARN, -+ "UBX-NAV-TIMELS: unexpected length %d, expecting 24\n", -+ data_len); -+ return; -+ } -+ version = getsb(buf,4); -+ /* Only version 0 is defined so far. */ -+ flags = (unsigned int)getub(buf, 23); -+ gpsd_log(&session->context->errout, LOG_DATA, -+ "UBX-NAV-TIMELS: flags 0x%x message version %d\n",flags, version); -+ valid_curr_ls = flags & UBX_TIMELS_VALID_CURR_LS; -+ valid_time_to_ls_event = flags & UBX_TIMELS_VALID_TIME_LS_EVT; -+ if(valid_curr_ls) { -+ unsigned int src_of_curr_ls = getub(buf,8); -+ int curr_ls = getsb(buf,9); -+ char *src = "Unknown"; -+ -+ if(src_of_curr_ls < (sizeof srcOfCurrLs/(sizeof srcOfCurrLs[0]))) -+ src = srcOfCurrLs[src_of_curr_ls]; -+ -+ gpsd_log(&session->context->errout, LOG_DATA, -+ "UBX-NAV-TIMELS: source_of_current_leapsecond=%u:%s curr_ls=%d\n", -+ src_of_curr_ls,src,curr_ls); -+ session->context->leap_seconds = curr_ls; -+ session->context->valid |= LEAP_SECOND_VALID; -+ } /* Valid current leap second */ -+ if(valid_time_to_ls_event) { -+ char *src="Unknown"; -+ unsigned int src_of_ls_change; -+ unsigned short dateOfLSGpsWn, dateOfLSGpsDn; -+ int lsChange = getsb(buf,11); -+ int timeToLsEvent = getles32(buf,12); -+ src_of_ls_change = getub(buf,10); -+ if(src_of_ls_change < (sizeof srcOfLsChange/(sizeof srcOfLsChange[0]))) -+ src = srcOfLsChange[src_of_ls_change]; -+ dateOfLSGpsWn = getles16(buf,16); -+ dateOfLSGpsDn = getles16(buf,18); -+ gpsd_log(&session->context->errout, LOG_DATA, -+ "UBX_NAV_TIMELS: source_of_leapsecond_change=%u:%s " -+ "leapSecondChage=%d timeToLsEvent=%d\n", -+ src_of_ls_change,src,lsChange,timeToLsEvent); -+ gpsd_log(&session->context->errout, LOG_DATA, -+ "UBX_NAV_TIMELS: dateOfLSGpsWn=%d dateOfLSGpsDn=%d\n", -+ dateOfLSGpsWn,dateOfLSGpsDn); -+ if(timeToLsEvent < 60*60*23 && timeToLsEvent > 0) { -+ if(lsChange == 0) -+ session->context->leap_notify = LEAP_NOWARNING; -+ else if (lsChange == 1) -+ session->context->leap_notify = LEAP_ADDSECOND; -+ else if (lsChange == -1) -+ session->context->leap_notify = LEAP_DELSECOND; -+ } else -+ session->context->leap_notify = LEAP_NOWARNING; -+ -+ if (session->context->leap_notify == LEAP_ADDSECOND) -+ gpsd_log(&session->context->errout,LOG_INF, -+ "UBX_NAV_TIMELS: Add leap second today\n"); -+ else if (session->context->leap_notify == LEAP_DELSECOND) -+ gpsd_log(&session->context->errout,LOG_INF, -+ "UBX_NAV_TIMELS: Remove leap second today\n"); -+ -+ gpsd_log(&session->context->errout, LOG_DATA, -+ "UBX_NAV_TIMELS: leaving: leap_notify=%d\n", -+ session->context->leap_notify); -+ } -+} -+#endif /* UBLOXTIMELS_ENABLE */ - /** - * Geodetic position solution message - */ -@@ -523,13 +629,22 @@ - case UBX_NAV_EKFSTATUS: - gpsd_log(&session->context->errout, LOG_DATA, "UBX_NAV_EKFSTATUS\n"); - break; -- -+ case UBX_NAV_TIMELS: -+ gpsd_log(&session->context->errout, LOG_DATA, "UBX_NAV_TIMELS\n"); -+#ifdef UBLOXTIMELS_ENABLE -+ ubx_msg_nav_timels(session, &buf[UBX_PREFIX_LEN],data_len); -+#endif // UBLOXTIMELS_ENABLE -+ break; - case UBX_RXM_RAW: - gpsd_log(&session->context->errout, LOG_DATA, "UBX_RXM_RAW\n"); - break; - case UBX_RXM_SFRB: -+ gpsd_log(&session->context->errout, LOG_DATA, "UBX_RXM_SFRB\n"); - mask = ubx_msg_sfrb(session, &buf[UBX_PREFIX_LEN]); - break; -+ case UBX_RXM_SFRBX: -+ gpsd_log(&session->context->errout, LOG_DATA, "UBX_RXM_SFRBX\n"); -+ break; - case UBX_RXM_SVSI: - gpsd_log(&session->context->errout, LOG_PROG, "UBX_RXM_SVSI\n"); - break; -@@ -955,6 +1070,12 @@ - msg[1] = 0x20; /* msg id = UBX_NAV_TIMEGPS */ - msg[2] = 0x01; /* rate */ - (void)ubx_write(session, 0x06u, 0x01, msg, 3); -+#ifdef UBLOXTIMELS_ENABLE -+ msg[0] = 0x01; /* class */ -+ msg[1] = 0x26; /* msg id = UBX_NAV_TIMELS */ -+ msg[2] = 0xff; /* rate */ -+#endif /* UBLOXTIMELS_ENABLE */ -+ (void)ubx_write(session, 0x06u, 0x01, msg, 3); - msg[0] = 0x01; /* class */ - msg[1] = 0x30; /* msg id = NAV-SVINFO */ - msg[2] = 0x0a; /* rate */ -diff -Naur old/driver_ubx.h new/driver_ubx.h ---- old/driver_ubx.h 2017-01-19 14:12:25.099231346 -0600 -+++ new/driver_ubx.h 2017-01-19 14:01:48.177653001 -0600 -@@ -35,6 +35,7 @@ - UBX_NAV_TIMEGPS = UBX_MSGID(UBX_CLASS_NAV, 0x20), - UBX_NAV_TIMEUTC = UBX_MSGID(UBX_CLASS_NAV, 0x21), - UBX_NAV_CLOCK = UBX_MSGID(UBX_CLASS_NAV, 0x22), -+ UBX_NAV_TIMELS = UBX_MSGID(UBX_CLASS_NAV, 0x26), - UBX_NAV_SVINFO = UBX_MSGID(UBX_CLASS_NAV, 0x30), - UBX_NAV_DGPS = UBX_MSGID(UBX_CLASS_NAV, 0x31), - UBX_NAV_SBAS = UBX_MSGID(UBX_CLASS_NAV, 0x32), -@@ -42,6 +43,7 @@ - - UBX_RXM_RAW = UBX_MSGID(UBX_CLASS_RXM, 0x10), - UBX_RXM_SFRB = UBX_MSGID(UBX_CLASS_RXM, 0x11), -+ UBX_RXM_SFRBX = UBX_MSGID(UBX_CLASS_RXM, 0x13), - UBX_RXM_SVSI = UBX_MSGID(UBX_CLASS_RXM, 0x20), - UBX_RXM_ALM = UBX_MSGID(UBX_CLASS_RXM, 0x30), - UBX_RXM_EPH = UBX_MSGID(UBX_CLASS_RXM, 0x31), -@@ -102,6 +104,9 @@ - #define UBX_SOL_VALID_WEEK 0x04 - #define UBX_SOL_VALID_TIME 0x08 - -+#define UBX_TIMELS_VALID_CURR_LS 0x01 -+#define UBX_TIMELS_VALID_TIME_LS_EVT 0x01 -+ - /* from UBX_NAV_SVINFO */ - #define UBX_SAT_USED 0x01 - #define UBX_SAT_DGPS 0x02 -diff -Naur old/SConstruct new/SConstruct ---- old/SConstruct 2017-01-19 14:51:35.638466569 -0600 -+++ new/SConstruct 2017-01-19 15:20:02.488159765 -0600 -@@ -113,6 +113,7 @@ - ("tripmate", True, "DeLorme TripMate support"), - ("tsip", True, "Trimble TSIP support"), - ("ublox", True, "u-blox Protocol support"), -+ ("ubloxtimels", False, "u-blox UBX-NAV-TIMELS support (leap second)"), - ("fury", True, "Jackson Labs Fury and Firefly support"), - ("nmea2000", True, "NMEA2000/CAN support"), - # Non-GPS protocols diff --git a/recipes-navigation/gpsd/gpsd_3.16.bb b/recipes-navigation/gpsd/gpsd_3.16.bb index 52aa9a9..d6c51f4 100644 --- a/recipes-navigation/gpsd/gpsd_3.16.bb +++ b/recipes-navigation/gpsd/gpsd_3.16.bb @@ -15,6 +15,7 @@ SRC_URI = "${SAVANNAH_GNU_MIRROR}/${BPN}/${BP}.tar.gz \ file://0001-include-sys-ttydefaults.h.patch \ file://0005-suppress-text-in-binary.patch \ file://0006-ubxtimelps.patch \ + file://0006-itu_r_tf_460_6.patch \ file://gpsd-default \ file://gpsd \ file://gpsd_ubx_fixed.sh \ -- cgit v1.2.3 From 599b7325d9eec4eeaf818ff9bd8f5f7a3d7638e2 Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 23 Jan 2017 11:57:53 -0600 Subject: Use flag ENABLED in /etc/default --- recipes-support/ntp/files/ntpd-default | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes-support/ntp/files/ntpd-default b/recipes-support/ntp/files/ntpd-default index d4e13bd..65e2119 100644 --- a/recipes-support/ntp/files/ntpd-default +++ b/recipes-support/ntp/files/ntpd-default @@ -1,4 +1,5 @@ -NTPD_ENABLED=1 +ENABLED="yes" + # The GPSD_* parameters in this file are ignored # if the uBlox GPS is not present. -- cgit v1.2.3