From 6c32071e09d7628272c21f3895d93c690ef09a8e Mon Sep 17 00:00:00 2001 From: John Klug Date: Thu, 23 May 2019 18:44:47 -0500 Subject: Bump mLinux to dev35 --- 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 c6dbe70..144f8a1 100644 --- a/conf/distro/mlinux.conf +++ b/conf/distro/mlinux.conf @@ -1,7 +1,7 @@ DISTRO = "mlinux" DISTRO_NAME = "mLinux" DISTRO_BASE_VERSION = "5.0" -DISTRO_VERSION = "${DISTRO_BASE_VERSION}.0dev34" +DISTRO_VERSION = "${DISTRO_BASE_VERSION}.0dev35" DISTRO_CODENAME = "" SDK_VENDOR = "-mlinux" SDK_VERSION := "${@'${DISTRO_VERSION}'.replace('snapshot-${DATE}','snapshot')}" -- cgit v1.2.3 From 48756c440e339af5a0e2b486978e7a183f6cc8a2 Mon Sep 17 00:00:00 2001 From: John Klug Date: Fri, 24 May 2019 13:53:53 -0500 Subject: Turn off ntpd for testing --- .../multitech/config/config-mths/default/ntpd | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 recipes-core/multitech/config/config-mths/default/ntpd diff --git a/recipes-core/multitech/config/config-mths/default/ntpd b/recipes-core/multitech/config/config-mths/default/ntpd new file mode 100644 index 0000000..a0d3bcf --- /dev/null +++ b/recipes-core/multitech/config/config-mths/default/ntpd @@ -0,0 +1,36 @@ +ENABLED="no" + + +CONFIGFILE=/etc/ntp.conf + +# 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. +# See /etc/default/gpsd for the states required. +GPSD_REQUIRED=0 + +# 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 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 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 +# before NTP is started. +SET_SYSTEM_CLOCK=1 + -- cgit v1.2.3 From 991ceb279ad22790b6814ea9a3cae17c062af85e Mon Sep 17 00:00:00 2001 From: John Klug Date: Tue, 28 May 2019 22:51:04 -0500 Subject: Patch ifplugd to allow for drivers being loaded, and allow symlinks in config paths. --- recipes-core/busybox/busybox_%.bbappend | 3 ++- recipes-core/busybox/files/ifplugd.init | 2 +- recipes-core/busybox/files/ifplugd.patch | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 recipes-core/busybox/files/ifplugd.patch diff --git a/recipes-core/busybox/busybox_%.bbappend b/recipes-core/busybox/busybox_%.bbappend index b8bbdf7..6ead22b 100644 --- a/recipes-core/busybox/busybox_%.bbappend +++ b/recipes-core/busybox/busybox_%.bbappend @@ -1,4 +1,4 @@ -PR .= ".mlinux3" +PR .= ".mlinux4" PACKAGES =+ "busybox-ifplugd" FILESEXTRAPATHS_prepend := ":${THISDIR}/files:" RDEPENDS_${PN} += "bash" @@ -9,6 +9,7 @@ SRC_URI += "file://udhcpd.conf.example \ file://ifplugd.init \ file://eth0.conf \ file://eth1.conf.example \ + file://ifplugd.patch \ " do_install_append () { diff --git a/recipes-core/busybox/files/ifplugd.init b/recipes-core/busybox/files/ifplugd.init index 87f2408..418b088 100755 --- a/recipes-core/busybox/files/ifplugd.init +++ b/recipes-core/busybox/files/ifplugd.init @@ -9,7 +9,7 @@ startdaemon(){ # Start the application echo -n "Starting ifplugd: " - CONFS=($(find /etc/ifplugd -name '*.conf')) + CONFS=($(find -L /etc/ifplugd -name '*.conf')) ((i=0)) logger -p daemon.info "Found ${#CONFS[@]} Configurations" while ((i < ${#CONFS[@]})) ; do diff --git a/recipes-core/busybox/files/ifplugd.patch b/recipes-core/busybox/files/ifplugd.patch new file mode 100644 index 0000000..839a8a2 --- /dev/null +++ b/recipes-core/busybox/files/ifplugd.patch @@ -0,0 +1,20 @@ +# +# This patch is found here: +# http://lists.busybox.net/pipermail/busybox/2018-March/086328.html +# Basically ifplugd will not stay up if the driver is loading. +# This is particularly apparent with gadget. +diff -arNu a/networking/ifplugd.c b/networking/ifplugd.c +--- a/networking/ifplugd.c 2019-05-28 18:11:43.836982315 -0500 ++++ b/networking/ifplugd.c 2019-05-28 18:13:13.088979672 -0500 +@@ -358,8 +358,10 @@ + ifrequest.ifr_flags |= IFF_UP; + /* Let user know we mess up with interface */ + bb_error_msg("upping interface"); +- if (network_ioctl(SIOCSIFFLAGS, &ifrequest, "setting interface flags") < 0) ++ if (network_ioctl(SIOCSIFFLAGS, &ifrequest, "setting interface flags") < 0) { ++ if (errno != ENODEV && errno != EADDRNOTAVAIL) + xfunc_die(); ++ } + } + + #if 0 /* why do we mess with IP addr? It's not our business */ -- cgit v1.2.3 From 3bb5d4ef3f599536de76ebaa0ca382fa7bf66472 Mon Sep 17 00:00:00 2001 From: John Klug Date: Tue, 28 May 2019 22:53:46 -0500 Subject: Fix up gadget and ifplugd for mLinux MTHS test image. --- .../multitech/config/config-mths/default/dnsmasq | 17 ++++++++++++ .../config/config-mths/default/usb-gadget | 6 +++++ .../config/config-mths/ifplugd/ifplugd.action | 30 ++++++++++++++++++++++ .../multitech/config/config-mths/ifplugd/usb0.conf | 2 ++ .../config/config-mths/network/interfaces.mths | 4 +-- 5 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 recipes-core/multitech/config/config-mths/default/usb-gadget create mode 100755 recipes-core/multitech/config/config-mths/ifplugd/ifplugd.action create mode 100644 recipes-core/multitech/config/config-mths/ifplugd/usb0.conf diff --git a/recipes-core/multitech/config/config-mths/default/dnsmasq b/recipes-core/multitech/config/config-mths/default/dnsmasq index a27c1c6..129fda1 100644 --- a/recipes-core/multitech/config/config-mths/default/dnsmasq +++ b/recipes-core/multitech/config/config-mths/default/dnsmasq @@ -1,3 +1,5 @@ +# MTHS dnsmasq +# and a hook to set up config files for MTHS ENABLED="yes" # This configuration is for manufacturing test. @@ -8,3 +10,18 @@ fi # Stop ntpd. ntpd default is in root. sed -i 's/ENABLED="yes"/ENABLED="no"/' /etc/default/ntpd +# Use the ifplugd in /var/config +if ! [[ -L /etc/ifplugd ]] ; then + rm -rf /etc/ifplugd + ln -s /var/config/ifplugd /etc/ifplugd + # ifplugd is already started (and probably bombed) + # restart it. + /etc/init.d/ifplugd stop + /etc/init.d/ifplugd start +fi + +if ! [[ -L /etc/default/usb-gadget ]] && [[ -f /var/config/default/usb-gadget ]] ; then + rm -rf /etc/default/usb-gadget + ln -s /var/config/default/usb-gadget /etc/default/usb-gadget +fi + diff --git a/recipes-core/multitech/config/config-mths/default/usb-gadget b/recipes-core/multitech/config/config-mths/default/usb-gadget new file mode 100644 index 0000000..944ef8a --- /dev/null +++ b/recipes-core/multitech/config/config-mths/default/usb-gadget @@ -0,0 +1,6 @@ +# set to "no" to disable usb-gadget +ENABLED="yes" + +USB_MODE="networking" +MODULE_OPTIONS="" + diff --git a/recipes-core/multitech/config/config-mths/ifplugd/ifplugd.action b/recipes-core/multitech/config/config-mths/ifplugd/ifplugd.action new file mode 100755 index 0000000..e7184c7 --- /dev/null +++ b/recipes-core/multitech/config/config-mths/ifplugd/ifplugd.action @@ -0,0 +1,30 @@ +#!/bin/sh +# $Id: ifplugd.action 99 2004-02-08 20:17:59Z lennart $ + +# This file is part of ifplugd. +# +# ifplugd is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# ifplugd is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with ifplugd; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +set -e + +if [ -z "$1" ] || [ -z "$2" ] ; then + echo "Wrong arguments" > /dev/stderr + exit 1 +fi + +[ "$2" = "up" ] && exec /sbin/ifup $1 +[ "$2" = "down" ] && exec /sbin/ifdown $1 + +exit 0 diff --git a/recipes-core/multitech/config/config-mths/ifplugd/usb0.conf b/recipes-core/multitech/config/config-mths/ifplugd/usb0.conf new file mode 100644 index 0000000..2fa70b3 --- /dev/null +++ b/recipes-core/multitech/config/config-mths/ifplugd/usb0.conf @@ -0,0 +1,2 @@ +INTERFACE="usb0" +ARGS="-M -fI -i ${INTERFACE} -u 0 -d 10 -r /etc/ifplugd/ifplugd.action" diff --git a/recipes-core/multitech/config/config-mths/network/interfaces.mths b/recipes-core/multitech/config/config-mths/network/interfaces.mths index 0f1541e..689ce0b 100644 --- a/recipes-core/multitech/config/config-mths/network/interfaces.mths +++ b/recipes-core/multitech/config/config-mths/network/interfaces.mths @@ -5,8 +5,8 @@ netmask 255.0.0.0 pre-up bash -c '([[ -d /sys/class/net/wifi1 ]] || /opt/rs9113/onebox_util rpine0 create_vap wifi1 ap)' # Gadget USB -auto usb1 -iface usb1 inet static +auto usb0 +iface usb0 inet static address 192.168.2.1 netmask 255.255.255.0 -- cgit v1.2.3 From b5a2ca08e91475eeaee33166d018f532e1c069f5 Mon Sep 17 00:00:00 2001 From: John Klug Date: Tue, 28 May 2019 22:57:07 -0500 Subject: Fix mtrv1 device tree USB, ifplugd/gadget for MTHS testing. --- 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 144f8a1..c0257a6 100644 --- a/conf/distro/mlinux.conf +++ b/conf/distro/mlinux.conf @@ -1,7 +1,7 @@ DISTRO = "mlinux" DISTRO_NAME = "mLinux" DISTRO_BASE_VERSION = "5.0" -DISTRO_VERSION = "${DISTRO_BASE_VERSION}.0dev35" +DISTRO_VERSION = "${DISTRO_BASE_VERSION}.0dev36" DISTRO_CODENAME = "" SDK_VENDOR = "-mlinux" SDK_VERSION := "${@'${DISTRO_VERSION}'.replace('snapshot-${DATE}','snapshot')}" -- cgit v1.2.3 From 1db3228526ff0a380a0170e21320fd8d0d345cbe Mon Sep 17 00:00:00 2001 From: Jason Reiss Date: Tue, 4 Jun 2019 14:16:52 -0500 Subject: lora: fix gps time stamping and synchronization, add patch for PKF deduplication to be incorporated into recipe later --- .../lora/lora-gateway/lora-gateway-gpsd.patch | 219 ++++++++++++++++++--- recipes-connectivity/lora/lora-gateway_5.0.1.bb | 3 +- .../lora-packet-forwarder-dedup-rx.patch | 47 +++++ .../lora-packet-forwarder-gpsd.patch | 9 + .../lora/lora-packet-forwarder_4.0.1.bb | 2 +- 5 files changed, 251 insertions(+), 29 deletions(-) create mode 100644 recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-dedup-rx.patch diff --git a/recipes-connectivity/lora/lora-gateway/lora-gateway-gpsd.patch b/recipes-connectivity/lora/lora-gateway/lora-gateway-gpsd.patch index 471cd82..08d566c 100644 --- a/recipes-connectivity/lora/lora-gateway/lora-gateway-gpsd.patch +++ b/recipes-connectivity/lora/lora-gateway/lora-gateway-gpsd.patch @@ -73,10 +73,18 @@ index 6dbd30b..59b2d37 100644 /** @brief Parse messages coming from the GPS system (or other GNSS) diff --git a/libloragw/src/loragw_gps.c b/libloragw/src/loragw_gps.c -index c0e0ded..d3d1ca1 100644 +index c0e0ded..f4774be 100644 --- a/libloragw/src/loragw_gps.c +++ b/libloragw/src/loragw_gps.c -@@ -251,109 +251,22 @@ int str_chop(char *s, int buff_size, char separator, int *idx_ary, int max_idx) +@@ -84,6 +84,7 @@ static double gps_mlo = 0.0; /* minutes of longitude */ + static char gps_olo = 0; /* orientation (E-W) of longitude */ + static short gps_alt = 0; /* altitude */ + static bool gps_pos_ok = false; ++static bool gps_lock_ok = false; + + static char gps_mod = 'N'; /* GPS mode (N no fix, A autonomous, D differential) */ + static short gps_sat = 0; /* number of satellites used for fix */ +@@ -251,109 +252,22 @@ int str_chop(char *s, int buff_size, char separator, int *idx_ary, int max_idx) /* -------------------------------------------------------------------------- */ /* --- PUBLIC FUNCTIONS DEFINITION ------------------------------------------ */ @@ -91,17 +99,27 @@ index c0e0ded..d3d1ca1 100644 - 0x01, 0x20, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, /* Enable NAV-TIMEGPS output on serial */ - 0x32, 0x94 }; /* Checksum */ - ssize_t num_written; -- ++int lgw_gps_enable(struct gps_data_t *gpsdata, struct fixsource_t *source) { + - /* check input parameters */ - CHECK_NULL(tty_path); - CHECK_NULL(fd_ptr); -- ++ unsigned int flags; ++ fd_set fds; ++ flags = WATCH_ENABLE; ++ flags |= WATCH_RAW; ++ flags |= WATCH_NMEA; ++ gpsd_source_spec(NULL, source); + - /* open TTY device */ - gps_tty_dev = open(tty_path, O_RDWR | O_NOCTTY); - if (gps_tty_dev <= 0) { - DEBUG_MSG("ERROR: TTY PORT FAIL TO OPEN, CHECK PATH AND ACCESS RIGHTS\n"); -- return LGW_GPS_ERROR; -- } ++ if (gps_open(source->server, source->port, gpsdata) != 0) { ++ DEBUG_MSG("gpspipe: could not connect to gpsd %s:%s, %s(%d)\n", ++ source->server, source->port, gps_errstr(errno), errno); + return LGW_GPS_ERROR; + } - *fd_ptr = gps_tty_dev; - - /* manage the different GPS modules families */ @@ -115,7 +133,7 @@ index c0e0ded..d3d1ca1 100644 - /* see lgw_parse_ubx() function for details */ - DEBUG_MSG("WARNING: this version of GPS module may not be supported\n"); - } -- + - /* manage the target bitrate */ - if (target_brate != 0) { - DEBUG_MSG("WARNING: target_brate parameter ignored for now\n"); // TODO @@ -173,22 +191,10 @@ index c0e0ded..d3d1ca1 100644 - i = tcsetattr(gps_tty_dev, TCSANOW, &ttyopt); - if (i != 0){ - DEBUG_MSG("ERROR: IMPOSSIBLE TO UPDATE TTY PORT CONFIGURATION\n"); -+int lgw_gps_enable(struct gps_data_t *gpsdata, struct fixsource_t *source) { -+ -+ unsigned int flags; -+ fd_set fds; -+ flags = WATCH_ENABLE; -+ flags |= WATCH_RAW; -+ flags |= WATCH_NMEA; -+ gpsd_source_spec(NULL, source); -+ -+ if (gps_open(source->server, source->port, gpsdata) != 0) { -+ DEBUG_MSG("gpspipe: could not connect to gpsd %s:%s, %s(%d)\n", -+ source->server, source->port, gps_errstr(errno), errno); - return LGW_GPS_ERROR; - } +- return LGW_GPS_ERROR; +- } - tcflush(gps_tty_dev, TCIOFLUSH); - +- - /* Send UBX CFG NAV-TIMEGPS message to tell GPS module to output native GPS time */ - /* This is a binary message, serial port has to be properly configured to handle this */ - num_written = write (gps_tty_dev, ubx_cmd_timegps, UBX_MSG_NAVTIMEGPS_LEN); @@ -199,7 +205,7 @@ index c0e0ded..d3d1ca1 100644 /* get timezone info */ tzset(); -@@ -368,20 +281,13 @@ int lgw_gps_enable(char *tty_path, char *gps_family, speed_t target_brate, int * +@@ -368,20 +282,13 @@ int lgw_gps_enable(char *tty_path, char *gps_family, speed_t target_brate, int * /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ @@ -225,7 +231,44 @@ index c0e0ded..d3d1ca1 100644 return LGW_GPS_ERROR; } -@@ -526,7 +432,7 @@ enum gps_msg lgw_parse_nmea(const char *serial_buff, int buff_size) { +@@ -457,7 +364,8 @@ enum gps_msg lgw_parse_ubx(const char *serial_buff, size_t buff_size, size_t *ms + gps_week = (uint8_t)serial_buff[14]; + gps_week |= (uint8_t)serial_buff[15] << 8; /* GPS week number */ + +- gps_time_ok = true; ++ ++ + #if 0 + /* For debug */ + { +@@ -472,11 +380,24 @@ enum gps_msg lgw_parse_ubx(const char *serial_buff, size_t buff_size, size_t *ms + printf(" GPS time = %02d:%02d:%02d\n", ubx_gps_hou, ubx_gps_min, ubx_gps_sec); + } + #endif +- } else { /* valid */ ++ if (gps_lock_ok) ++ gps_time_ok = true; ++ ++ return UBX_NAV_TIMEGPS; ++ } else { + gps_time_ok = false; ++ return INVALID; ++ } ++ } else if ((serial_buff[2] == 0x01) && (serial_buff[3] == 0x04)) { ++ if (serial_buff[10] == 0x0F && serial_buff[11] == 0x27 ++ && serial_buff[10] == 0x0F && serial_buff[11] == 0x27 ++ && serial_buff[10] == 0x0F && serial_buff[11] == 0x27 ++ && serial_buff[10] == 0x0F && serial_buff[11] == 0x27) { ++ gps_time_ok = false; ++ gps_lock_ok = false; + } + +- return UBX_NAV_TIMEGPS; ++ return UBX_NAV_TIMEUTC; + } else if ((serial_buff[2] == 0x05) && (serial_buff[3] == 0x00)) { + DEBUG_MSG("NOTE: UBX ACK-NAK received\n"); + return IGNORED; +@@ -526,7 +447,7 @@ enum gps_msg lgw_parse_nmea(const char *serial_buff, int buff_size) { } else if (!validate_nmea_checksum(serial_buff, buff_size)) { DEBUG_MSG("Warning: invalid NMEA sentence (bad checksum)\n"); return INVALID; @@ -234,7 +277,7 @@ index c0e0ded..d3d1ca1 100644 /* NMEA sentence format: $xxRMC,time,status,lat,NS,long,EW,spd,cog,date,mv,mvEW,posMode*cs Valid fix: $GPRMC,083559.34,A,4717.11437,N,00833.91522,E,0.004,77.52,091202,,,A*00 -@@ -535,19 +441,19 @@ enum gps_msg lgw_parse_nmea(const char *serial_buff, int buff_size) { +@@ -535,33 +456,32 @@ enum gps_msg lgw_parse_nmea(const char *serial_buff, int buff_size) { memcpy(parser_buf, serial_buff, buff_size); parser_buf[buff_size] = '\0'; nb_fields = str_chop(parser_buf, buff_size, ',', str_index, ARRAY_SIZE(str_index)); @@ -255,9 +298,17 @@ index c0e0ded..d3d1ca1 100644 - if ((i == 4) && (j == 3)) { + if ((i == 3) && (j == 3)) { if ((gps_mod == 'A') || (gps_mod == 'D')) { - gps_time_ok = true; +- gps_time_ok = true; ++ gps_lock_ok = true; DEBUG_MSG("Note: Valid RMC sentence, GPS locked, date: 20%02d-%02d-%02dT%02d:%02d:%06.3fZ\n", gps_yea, gps_mon, gps_day, gps_hou, gps_min, gps_fra + (float)gps_sec); -@@ -561,7 +467,7 @@ enum gps_msg lgw_parse_nmea(const char *serial_buff, int buff_size) { + } else { +- gps_time_ok = false; ++ gps_lock_ok = false; + DEBUG_MSG("Note: Valid RMC sentence, no satellite fix, estimated date: 20%02d-%02d-%02dT%02d:%02d:%06.3fZ\n", gps_yea, gps_mon, gps_day, gps_hou, gps_min, gps_fra + (float)gps_sec); + } + } else { + /* could not get a valid hour AND date */ +- gps_time_ok = false; DEBUG_MSG("Note: Valid RMC sentence, mode %c, no date\n", gps_mod); } return NMEA_RMC; @@ -266,6 +317,120 @@ index c0e0ded..d3d1ca1 100644 /* NMEA sentence format: $xxGGA,time,lat,NS,long,EW,quality,numSV,HDOP,alt,M,sep,M,diffAge,diffStation*cs Valid fix: $GPGGA,092725.00,4717.11399,N,00833.91590,E,1,08,1.01,499.6,M,48.0,M,,*5B +@@ -587,6 +507,8 @@ enum gps_msg lgw_parse_nmea(const char *serial_buff, int buff_size) { + } else { + /* could not get a valid latitude, longitude AND altitude */ + gps_pos_ok = false; ++ gps_time_ok = false; ++ gps_lock_ok = false; + DEBUG_MSG("Note: Valid GGA sentence, %d sat, no coordinates\n", gps_sat); + } + return NMEA_GGA; +@@ -662,72 +580,60 @@ int lgw_gps_get(struct timespec *utc, struct timespec *gps_time, struct coord_s + /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + + int lgw_gps_sync(struct tref *ref, uint32_t count_us, struct timespec utc, struct timespec gps_time) { ++ bool update = false; + double cnt_diff; /* internal concentrator time difference (in seconds) */ + double utc_diff; /* UTC time difference (in seconds) */ +- double slope; /* time slope between new reference and old reference (for sanity check) */ +- +- bool aber_n0; /* is the update value for synchronization aberrant or not ? */ +- static bool aber_min1 = false; /* keep track of whether value at sync N-1 was aberrant or not */ +- static bool aber_min2 = false; /* keep track of whether value at sync N-2 was aberrant or not */ ++ double slope = 1.0; /* time slope between new reference and old reference (for sanity check) */ ++ static bool calibrating = true; + + CHECK_NULL(ref); + + /* calculate the slope */ + +- cnt_diff = (double)(count_us - ref->count_us) / (double)(TS_CPS); /* uncorrected by xtal_err */ +- utc_diff = (double)(utc.tv_sec - (ref->utc).tv_sec) + (1E-9 * (double)(utc.tv_nsec - (ref->utc).tv_nsec)); ++ if (ref->systime != 0) { ++ ++ cnt_diff = (double)(count_us - ref->count_us) / (double)(TS_CPS); /* uncorrected by xtal_err */ ++ utc_diff = (double)(utc.tv_sec - (ref->utc).tv_sec) + (1E-9 * (double)(utc.tv_nsec - (ref->utc).tv_nsec)); + +- /* detect aberrant points by measuring if slope limits are exceeded */ +- if (utc_diff != 0) { // prevent divide by zero +- slope = cnt_diff/utc_diff; +- if ((slope > PLUS_10PPM) || (slope < MINUS_10PPM)) { +- DEBUG_MSG("Warning: correction range exceeded\n"); +- aber_n0 = true; ++ if (cnt_diff != 0 && utc_diff != 0) { // prevent divide by zero ++ slope = cnt_diff/utc_diff; + } else { +- aber_n0 = false; ++ slope = 0.0; ++ } ++ ++ if (gps_lock_ok && gps_time_ok && cnt_diff > 1.5) { ++ update = true; ++ } ++ ++ update = (slope >= MINUS_10PPM && slope <= PLUS_10PPM); ++ ++ if (!calibrating && utc_diff < 10.0) { ++ return LGW_GPS_ERROR; + } ++ ++ if (calibrating && !update && utc_diff > 1.5) { ++ update = true; ++ } else if (update) { ++ calibrating = false; ++ } ++ + } else { +- DEBUG_MSG("Warning: aberrant UTC value for synchronization\n"); +- aber_n0 = true; ++ update = true; ++ slope = 0.0; + } + +- /* watch if the 3 latest sync point were aberrant or not */ +- if (aber_n0 == false) { +- /* value no aberrant -> sync with smoothed slope */ +- ref->systime = time(NULL); ++ if (update || calibrating) { ++ ref->systime = time(NULL); + ref->count_us = count_us; + ref->utc.tv_sec = utc.tv_sec; + ref->utc.tv_nsec = utc.tv_nsec; + ref->gps.tv_sec = gps_time.tv_sec; + ref->gps.tv_nsec = gps_time.tv_nsec; + ref->xtal_err = slope; +- aber_min2 = aber_min1; +- aber_min1 = aber_n0; + return LGW_GPS_SUCCESS; +- } else if (aber_n0 && aber_min1 && aber_min2) { +- /* 3 successive aberrant values -> sync reset (keep xtal_err) */ +- ref->systime = time(NULL); +- ref->count_us = count_us; +- ref->utc.tv_sec = utc.tv_sec; +- ref->utc.tv_nsec = utc.tv_nsec; +- ref->gps.tv_sec = gps_time.tv_sec; +- ref->gps.tv_nsec = gps_time.tv_nsec; +- /* reset xtal_err only if the present value is out of range */ +- if ((ref->xtal_err > PLUS_10PPM) || (ref->xtal_err < MINUS_10PPM)) { +- ref->xtal_err = 1.0; +- } +- DEBUG_MSG("Warning: 3 successive aberrant sync attempts, sync reset\n"); +- aber_min2 = aber_min1; +- aber_min1 = aber_n0; +- return LGW_GPS_SUCCESS; +- } else { +- /* only 1 or 2 successive aberrant values -> ignore and return an error */ +- aber_min2 = aber_min1; +- aber_min1 = aber_n0; +- return LGW_GPS_ERROR; + } + +- return LGW_GPS_SUCCESS; ++ return LGW_GPS_ERROR; + } + + /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ diff --git a/libloragw/tst/test_loragw_gps.c b/libloragw/tst/test_loragw_gps.c index a4164a3..e4b1546 100644 --- a/libloragw/tst/test_loragw_gps.c diff --git a/recipes-connectivity/lora/lora-gateway_5.0.1.bb b/recipes-connectivity/lora/lora-gateway_5.0.1.bb index 23538a9..faec985 100644 --- a/recipes-connectivity/lora/lora-gateway_5.0.1.bb +++ b/recipes-connectivity/lora/lora-gateway_5.0.1.bb @@ -7,7 +7,8 @@ LICENSE = "Proprietary" LIC_FILES_CHKSUM = "file://LICENSE;md5=a2bdef95625509f821ba00460e3ae0eb" DEPENDS = "libgps24" RDEPENDS_${PN} = "libgps24" -PR = "r11" +PR = "r12" + SRCREV = "v${PV}" SRC_URI = "git://github.com/Lora-net/lora_gateway.git;protocol=git \ diff --git a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-dedup-rx.patch b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-dedup-rx.patch new file mode 100644 index 0000000..b80bb26 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-dedup-rx.patch @@ -0,0 +1,47 @@ +diff --git a/lora_pkt_fwd/src/lora_pkt_fwd.c b/lora_pkt_fwd/src/lora_pkt_fwd.c +index 801f28d..7c94308 100644 +--- a/lora_pkt_fwd/src/lora_pkt_fwd.c ++++ b/lora_pkt_fwd/src/lora_pkt_fwd.c +@@ -1536,6 +1556,41 @@ void thread_up(void) { + memcpy((void *)(buff_up + buff_index), (void *)"{\"rxpk\":[", 9); + buff_index += 9; + ++ if (nb_pkt > 1) { ++ uint32_t check_addr = 0; ++ uint16_t check_fcnt = 0; ++ float check_snr = -30.0; ++ ++ for (i=0; i < nb_pkt; ++i) { ++ p = &rxpkt[i]; ++ check_addr = p->payload[1]; ++ check_addr |= p->payload[2] << 8; ++ check_addr |= p->payload[3] << 16; ++ check_addr |= p->payload[4] << 24; ++ ++ check_fcnt = p->payload[6]; ++ check_fcnt |= p->payload[7] << 8; ++ ++ check_snr = p->snr; ++ ++ for (j=0; j < nb_pkt; ++j) { ++ p = &rxpkt[j]; ++ mote_addr = p->payload[1]; ++ mote_addr |= p->payload[2] << 8; ++ mote_addr |= p->payload[3] << 16; ++ mote_addr |= p->payload[4] << 24; ++ ++ mote_fcnt = p->payload[6]; ++ mote_fcnt |= p->payload[7] << 8; ++ ++ if (check_addr == mote_addr && check_fcnt == mote_fcnt && p->snr < check_snr) { ++ // set status of duplicate packets rx'd on wrong channel ++ p->status = 1; ++ } ++ } ++ } ++ } ++ + /* serialize Lora packets metadata and payload */ + pkt_in_dgram = 0; + for (i=0; i < nb_pkt; ++i) { + diff --git a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-gpsd.patch b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-gpsd.patch index 1c3c698..02bef12 100644 --- a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-gpsd.patch +++ b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-gpsd.patch @@ -115,6 +115,15 @@ index 801f28d..6bca482 100644 if (i == LGW_HAL_SUCCESS) { MSG("INFO: GPS closed successfully\n"); } else { +@@ -2683,7 +2731,7 @@ static void gps_process_sync(void) { + i = lgw_gps_sync(&time_reference_gps, trig_tstamp, utc, gps_time); + pthread_mutex_unlock(&mx_timeref); + if (i != LGW_GPS_SUCCESS) { +- MSG("WARNING: [gps] GPS out of sync, keeping previous time reference\n"); ++// MSG("WARNING: [gps] GPS out of sync, keeping previous time reference\n"); + } + } + @@ -2691,7 +2695,7 @@ static void gps_process_coords(void) { /* position variable */ struct coord_s coord; diff --git a/recipes-connectivity/lora/lora-packet-forwarder_4.0.1.bb b/recipes-connectivity/lora/lora-packet-forwarder_4.0.1.bb index d55e511..1430c6c 100644 --- a/recipes-connectivity/lora/lora-packet-forwarder_4.0.1.bb +++ b/recipes-connectivity/lora/lora-packet-forwarder_4.0.1.bb @@ -7,7 +7,7 @@ LICENSE = "Proprietary" LIC_FILES_CHKSUM = "file://LICENSE;md5=22af7693d7b76ef0fc76161c4be76c45" DEPENDS = "lora-gateway logrotate lora-logging" RDEPENDS_${PN} += "bash" -PR = "r17" +PR = "r18" SRCREV = "v${PV}" -- cgit v1.2.3 From cc8d044b694d5b1238e9f1a15d23edc9a9466929 Mon Sep 17 00:00:00 2001 From: Jason Reiss Date: Wed, 5 Jun 2019 09:55:20 -0500 Subject: lora: update network server to 2.2.25 --- .../lora/lora-network-server_2.2.18.bb | 48 ---------------------- .../lora/lora-network-server_2.2.25.bb | 48 ++++++++++++++++++++++ 2 files changed, 48 insertions(+), 48 deletions(-) delete mode 100644 recipes-connectivity/lora/lora-network-server_2.2.18.bb create mode 100644 recipes-connectivity/lora/lora-network-server_2.2.25.bb diff --git a/recipes-connectivity/lora/lora-network-server_2.2.18.bb b/recipes-connectivity/lora/lora-network-server_2.2.18.bb deleted file mode 100644 index a0442d9..0000000 --- a/recipes-connectivity/lora/lora-network-server_2.2.18.bb +++ /dev/null @@ -1,48 +0,0 @@ -DESCRIPTION = "MultiTech LoRa Network Server" -PRIORITY = "optional" -SECTION = "console/utils" -LICENSE = "Proprietary" -LIC_FILES_CHKSUM = "file://LICENSE;md5=2b9a30a3082ddccd2c695a4dbeeab80d" -DEPENDS = "jsoncpp libmts mosquitto sqlite3 curl gnutls" -RDEPENDS_${PN} += "lora-packet-forwarder logrotate bash lora-logging" -PR = "r8" -CONFFILES_${PN} += "${sysconfdir}/default/lora-network-server ${sysconfdir}/init.d/lora-network-server" - -SRC_URI = "http://multitech.net/downloads/lora-network-server_${TUNE_PKGARCH}_${PV}.tar.gz \ - file://lora-network-server.init \ - file://lora-network-server.default \ - " - -SRC_URI[md5sum] = "b774c019f2e6f2ff684fd51e62de81aa" -SRC_URI[sha256sum] = "18b1a07b43da70b9a6bdee2c9fdd547af3e924099791aedef138cb13c1027a4e" - -# 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-mlinux-4 ${D}${LORA_DIR}/lora-network-server - install -m 0755 lora-v21-keygen ${D}${LORA_DIR}/lora-v21-keygen - install -m 0644 config/lora-network-server.conf.sample ${D}${LORA_DIR}/lora-network-server.conf.sample - install -m 0644 config/lora-network-server.conf.full ${D}${LORA_DIR}/lora-network-server.conf.full - - 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 -} - -FILES_${PN} += "${LORA_DIR}" -FILES_${PN}-dbg += "${LORA_DIR}/.debug" diff --git a/recipes-connectivity/lora/lora-network-server_2.2.25.bb b/recipes-connectivity/lora/lora-network-server_2.2.25.bb new file mode 100644 index 0000000..bf39c4f --- /dev/null +++ b/recipes-connectivity/lora/lora-network-server_2.2.25.bb @@ -0,0 +1,48 @@ +DESCRIPTION = "MultiTech LoRa Network Server" +PRIORITY = "optional" +SECTION = "console/utils" +LICENSE = "Proprietary" +LIC_FILES_CHKSUM = "file://LICENSE;md5=2b9a30a3082ddccd2c695a4dbeeab80d" +DEPENDS = "jsoncpp libmts mosquitto sqlite3 curl gnutls" +RDEPENDS_${PN} += "lora-packet-forwarder logrotate bash lora-logging" +PR = "r8" +CONFFILES_${PN} += "${sysconfdir}/default/lora-network-server ${sysconfdir}/init.d/lora-network-server" + +SRC_URI = "http://multitech.net/downloads/lora-network-server_${TUNE_PKGARCH}_${PV}.tar.gz \ + file://lora-network-server.init \ + file://lora-network-server.default \ + " + +SRC_URI[md5sum] = "256452241125ef7ba2f5ac822315d6b9" +SRC_URI[sha256sum] = "be1187424789c8a605883bee6272ad062407222de082dd61cd7cff9f703f4391" + +# 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-mlinux-4 ${D}${LORA_DIR}/lora-network-server + install -m 0755 lora-v21-keygen ${D}${LORA_DIR}/lora-v21-keygen + install -m 0644 config/lora-network-server.conf.sample ${D}${LORA_DIR}/lora-network-server.conf.sample + install -m 0644 config/lora-network-server.conf.full ${D}${LORA_DIR}/lora-network-server.conf.full + + 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 +} + +FILES_${PN} += "${LORA_DIR}" +FILES_${PN}-dbg += "${LORA_DIR}/.debug" -- cgit v1.2.3 From 82cf797b6093c83b5a4ae8734ae8c02a1f7ef5ff Mon Sep 17 00:00:00 2001 From: Jason Reiss Date: Thu, 6 Jun 2019 07:47:50 -0500 Subject: lora: update network server to v2.2.26 --- .../lora/lora-network-server_2.2.25.bb | 48 ---------------------- .../lora/lora-network-server_2.2.26.bb | 48 ++++++++++++++++++++++ 2 files changed, 48 insertions(+), 48 deletions(-) delete mode 100644 recipes-connectivity/lora/lora-network-server_2.2.25.bb create mode 100644 recipes-connectivity/lora/lora-network-server_2.2.26.bb diff --git a/recipes-connectivity/lora/lora-network-server_2.2.25.bb b/recipes-connectivity/lora/lora-network-server_2.2.25.bb deleted file mode 100644 index bf39c4f..0000000 --- a/recipes-connectivity/lora/lora-network-server_2.2.25.bb +++ /dev/null @@ -1,48 +0,0 @@ -DESCRIPTION = "MultiTech LoRa Network Server" -PRIORITY = "optional" -SECTION = "console/utils" -LICENSE = "Proprietary" -LIC_FILES_CHKSUM = "file://LICENSE;md5=2b9a30a3082ddccd2c695a4dbeeab80d" -DEPENDS = "jsoncpp libmts mosquitto sqlite3 curl gnutls" -RDEPENDS_${PN} += "lora-packet-forwarder logrotate bash lora-logging" -PR = "r8" -CONFFILES_${PN} += "${sysconfdir}/default/lora-network-server ${sysconfdir}/init.d/lora-network-server" - -SRC_URI = "http://multitech.net/downloads/lora-network-server_${TUNE_PKGARCH}_${PV}.tar.gz \ - file://lora-network-server.init \ - file://lora-network-server.default \ - " - -SRC_URI[md5sum] = "256452241125ef7ba2f5ac822315d6b9" -SRC_URI[sha256sum] = "be1187424789c8a605883bee6272ad062407222de082dd61cd7cff9f703f4391" - -# 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-mlinux-4 ${D}${LORA_DIR}/lora-network-server - install -m 0755 lora-v21-keygen ${D}${LORA_DIR}/lora-v21-keygen - install -m 0644 config/lora-network-server.conf.sample ${D}${LORA_DIR}/lora-network-server.conf.sample - install -m 0644 config/lora-network-server.conf.full ${D}${LORA_DIR}/lora-network-server.conf.full - - 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 -} - -FILES_${PN} += "${LORA_DIR}" -FILES_${PN}-dbg += "${LORA_DIR}/.debug" diff --git a/recipes-connectivity/lora/lora-network-server_2.2.26.bb b/recipes-connectivity/lora/lora-network-server_2.2.26.bb new file mode 100644 index 0000000..087b7df --- /dev/null +++ b/recipes-connectivity/lora/lora-network-server_2.2.26.bb @@ -0,0 +1,48 @@ +DESCRIPTION = "MultiTech LoRa Network Server" +PRIORITY = "optional" +SECTION = "console/utils" +LICENSE = "Proprietary" +LIC_FILES_CHKSUM = "file://LICENSE;md5=2b9a30a3082ddccd2c695a4dbeeab80d" +DEPENDS = "jsoncpp libmts mosquitto sqlite3 curl gnutls" +RDEPENDS_${PN} += "lora-packet-forwarder logrotate bash lora-logging" +PR = "r8" +CONFFILES_${PN} += "${sysconfdir}/default/lora-network-server ${sysconfdir}/init.d/lora-network-server" + +SRC_URI = "http://multitech.net/downloads/lora-network-server_${TUNE_PKGARCH}_${PV}.tar.gz \ + file://lora-network-server.init \ + file://lora-network-server.default \ + " + +SRC_URI[md5sum] = "d8c717c6aa14469842f964dd4d166d6b" +SRC_URI[sha256sum] = "0854ae5d2ed1411c5ceb86232db09e9084141451df0e982e1cb6b6db2ee7dc12" + +# 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-mlinux-4 ${D}${LORA_DIR}/lora-network-server + install -m 0755 lora-v21-keygen ${D}${LORA_DIR}/lora-v21-keygen + install -m 0644 config/lora-network-server.conf.sample ${D}${LORA_DIR}/lora-network-server.conf.sample + install -m 0644 config/lora-network-server.conf.full ${D}${LORA_DIR}/lora-network-server.conf.full + + 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 +} + +FILES_${PN} += "${LORA_DIR}" +FILES_${PN}-dbg += "${LORA_DIR}/.debug" -- cgit v1.2.3 From e3cbbc95e3a923a90c911137dcf7e2aff9688bc0 Mon Sep 17 00:00:00 2001 From: Jason Reiss Date: Fri, 7 Jun 2019 08:03:01 -0500 Subject: lora: update network server to 2.2.27 --- .../lora/lora-network-server_2.2.26.bb | 48 ---------------------- .../lora/lora-network-server_2.2.27.bb | 48 ++++++++++++++++++++++ 2 files changed, 48 insertions(+), 48 deletions(-) delete mode 100644 recipes-connectivity/lora/lora-network-server_2.2.26.bb create mode 100644 recipes-connectivity/lora/lora-network-server_2.2.27.bb diff --git a/recipes-connectivity/lora/lora-network-server_2.2.26.bb b/recipes-connectivity/lora/lora-network-server_2.2.26.bb deleted file mode 100644 index 087b7df..0000000 --- a/recipes-connectivity/lora/lora-network-server_2.2.26.bb +++ /dev/null @@ -1,48 +0,0 @@ -DESCRIPTION = "MultiTech LoRa Network Server" -PRIORITY = "optional" -SECTION = "console/utils" -LICENSE = "Proprietary" -LIC_FILES_CHKSUM = "file://LICENSE;md5=2b9a30a3082ddccd2c695a4dbeeab80d" -DEPENDS = "jsoncpp libmts mosquitto sqlite3 curl gnutls" -RDEPENDS_${PN} += "lora-packet-forwarder logrotate bash lora-logging" -PR = "r8" -CONFFILES_${PN} += "${sysconfdir}/default/lora-network-server ${sysconfdir}/init.d/lora-network-server" - -SRC_URI = "http://multitech.net/downloads/lora-network-server_${TUNE_PKGARCH}_${PV}.tar.gz \ - file://lora-network-server.init \ - file://lora-network-server.default \ - " - -SRC_URI[md5sum] = "d8c717c6aa14469842f964dd4d166d6b" -SRC_URI[sha256sum] = "0854ae5d2ed1411c5ceb86232db09e9084141451df0e982e1cb6b6db2ee7dc12" - -# 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-mlinux-4 ${D}${LORA_DIR}/lora-network-server - install -m 0755 lora-v21-keygen ${D}${LORA_DIR}/lora-v21-keygen - install -m 0644 config/lora-network-server.conf.sample ${D}${LORA_DIR}/lora-network-server.conf.sample - install -m 0644 config/lora-network-server.conf.full ${D}${LORA_DIR}/lora-network-server.conf.full - - 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 -} - -FILES_${PN} += "${LORA_DIR}" -FILES_${PN}-dbg += "${LORA_DIR}/.debug" diff --git a/recipes-connectivity/lora/lora-network-server_2.2.27.bb b/recipes-connectivity/lora/lora-network-server_2.2.27.bb new file mode 100644 index 0000000..22023ee --- /dev/null +++ b/recipes-connectivity/lora/lora-network-server_2.2.27.bb @@ -0,0 +1,48 @@ +DESCRIPTION = "MultiTech LoRa Network Server" +PRIORITY = "optional" +SECTION = "console/utils" +LICENSE = "Proprietary" +LIC_FILES_CHKSUM = "file://LICENSE;md5=2b9a30a3082ddccd2c695a4dbeeab80d" +DEPENDS = "jsoncpp libmts mosquitto sqlite3 curl gnutls" +RDEPENDS_${PN} += "lora-packet-forwarder logrotate bash lora-logging" +PR = "r8" +CONFFILES_${PN} += "${sysconfdir}/default/lora-network-server ${sysconfdir}/init.d/lora-network-server" + +SRC_URI = "http://multitech.net/downloads/lora-network-server_${TUNE_PKGARCH}_${PV}.tar.gz \ + file://lora-network-server.init \ + file://lora-network-server.default \ + " + +SRC_URI[md5sum] = "7a8a86272cccc454f634f14ba0b6cab7" +SRC_URI[sha256sum] = "f5ed505d7a0dfa6eb42363d9a27464d3e1953d2d3acfdefd919b2f2b6a7cb2a8" + +# 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-mlinux-4 ${D}${LORA_DIR}/lora-network-server + install -m 0755 lora-v21-keygen ${D}${LORA_DIR}/lora-v21-keygen + install -m 0644 config/lora-network-server.conf.sample ${D}${LORA_DIR}/lora-network-server.conf.sample + install -m 0644 config/lora-network-server.conf.full ${D}${LORA_DIR}/lora-network-server.conf.full + + 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 +} + +FILES_${PN} += "${LORA_DIR}" +FILES_${PN}-dbg += "${LORA_DIR}/.debug" -- cgit v1.2.3 From 99f29054bd72b3f57bf5745ad4b9f8f990369f71 Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 10 Jun 2019 10:57:46 -0500 Subject: Add usb0 to DHCP for MTHS, use address 192.168.3.1 to reduce conflict. --- recipes-core/multitech/config/config-mths/dnsmasq.d/dhcp.conf | 4 ++++ recipes-core/multitech/config/config-mths/network/interfaces.mths | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/recipes-core/multitech/config/config-mths/dnsmasq.d/dhcp.conf b/recipes-core/multitech/config/config-mths/dnsmasq.d/dhcp.conf index 837d0e2..47eb1c0 100644 --- a/recipes-core/multitech/config/config-mths/dnsmasq.d/dhcp.conf +++ b/recipes-core/multitech/config/config-mths/dnsmasq.d/dhcp.conf @@ -6,3 +6,7 @@ dhcp-option=option:netmask,255.255.255.0 dhcp-option=option:router,10.0.0.1 dhcp-option=option:dns-server,10.0.0.1 dhcp-authoritative +interface=usb0 +dhcp-range=192.168.3.100,192.168.3.250,12h +dhcp-option=option:router,192.168.3.1 +dhcp-option=option:dns-server,192.168.3.1 diff --git a/recipes-core/multitech/config/config-mths/network/interfaces.mths b/recipes-core/multitech/config/config-mths/network/interfaces.mths index 689ce0b..2463e0a 100644 --- a/recipes-core/multitech/config/config-mths/network/interfaces.mths +++ b/recipes-core/multitech/config/config-mths/network/interfaces.mths @@ -7,6 +7,6 @@ pre-up bash -c '([[ -d /sys/class/net/wifi1 ]] || /opt/rs9113/onebox_util rpine0 # Gadget USB auto usb0 iface usb0 inet static -address 192.168.2.1 +address 192.168.3.1 netmask 255.255.255.0 -- cgit v1.2.3 From 33be6e867de482010cb84d2ea57ee0e4f2790114 Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 10 Jun 2019 11:21:21 -0500 Subject: Bump mLinux version --- 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 c0257a6..cbe8f6c 100644 --- a/conf/distro/mlinux.conf +++ b/conf/distro/mlinux.conf @@ -1,7 +1,7 @@ DISTRO = "mlinux" DISTRO_NAME = "mLinux" DISTRO_BASE_VERSION = "5.0" -DISTRO_VERSION = "${DISTRO_BASE_VERSION}.0dev36" +DISTRO_VERSION = "${DISTRO_BASE_VERSION}.0dev37" DISTRO_CODENAME = "" SDK_VENDOR = "-mlinux" SDK_VERSION := "${@'${DISTRO_VERSION}'.replace('snapshot-${DATE}','snapshot')}" -- cgit v1.2.3 From aa56d1bc09d4b7de4137db08cb6aa3cad9196d48 Mon Sep 17 00:00:00 2001 From: Jason Reiss Date: Tue, 18 Jun 2019 09:36:21 -0500 Subject: lora: add best packet filter patch to v1.5 packet forwarder --- .../lora-packet-forwarder-dedup-rx.patch | 57 ++++++++++++++-------- .../lora/lora-packet-forwarder_4.0.1.bb | 3 +- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-dedup-rx.patch b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-dedup-rx.patch index b80bb26..c368033 100644 --- a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-dedup-rx.patch +++ b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-dedup-rx.patch @@ -1,39 +1,59 @@ diff --git a/lora_pkt_fwd/src/lora_pkt_fwd.c b/lora_pkt_fwd/src/lora_pkt_fwd.c -index 801f28d..7c94308 100644 +index 801f28d..c35c64f 100644 --- a/lora_pkt_fwd/src/lora_pkt_fwd.c +++ b/lora_pkt_fwd/src/lora_pkt_fwd.c -@@ -1536,6 +1556,41 @@ void thread_up(void) { +@@ -126,8 +126,9 @@ volatile bool quit_sig = false; /* 1 -> application terminates without shutting + static bool fwd_valid_pkt = true; /* packets with PAYLOAD CRC OK are forwarded */ + static bool fwd_error_pkt = false; /* packets with PAYLOAD CRC ERROR are NOT forwarded */ + static bool fwd_nocrc_pkt = false; /* packets with NO PAYLOAD CRC are NOT forwarded */ ++static bool fwd_best_pkt = true; /* duplicate packets with low SNR are NOT forwarded */ + + /* network configuration variables */ + static uint64_t lgwm = 0; /* Lora gateway MAC address */ + static char serv_addr[64] = STR(DEFAULT_SERVER); /* address of the server (host name or IPv4/IPv6) */ + static char serv_port_up[8] = STR(DEFAULT_PORT_UP); /* server port for upstream traffic */ +@@ -731,6 +742,12 @@ static int parse_gateway_configuration(const char * conf_file) { + } + + /* packet filtering parameters */ ++ val = json_object_get_value(conf_obj, "best_packet_filter"); ++ if (json_value_get_type(val) == JSONBoolean) { ++ fwd_best_pkt = (bool)json_value_get_boolean(val); ++ } ++ MSG("INFO: duplicate packets received with low SNR will%s be forwarded\n", (!fwd_best_pkt ? "" : " NOT")); ++ + val = json_object_get_value(conf_obj, "forward_crc_valid"); + if (json_value_get_type(val) == JSONBoolean) { + fwd_valid_pkt = (bool)json_value_get_boolean(val); +@@ -1536,6 +1562,38 @@ void thread_up(void) { memcpy((void *)(buff_up + buff_index), (void *)"{\"rxpk\":[", 9); buff_index += 9; -+ if (nb_pkt > 1) { ++ if (fwd_best_pkt && nb_pkt > 1) { + uint32_t check_addr = 0; ++ uint32_t check_mic = 0; + uint16_t check_fcnt = 0; + float check_snr = -30.0; + + for (i=0; i < nb_pkt; ++i) { + p = &rxpkt[i]; -+ check_addr = p->payload[1]; -+ check_addr |= p->payload[2] << 8; -+ check_addr |= p->payload[3] << 16; -+ check_addr |= p->payload[4] << 24; ++ if (p->size < 12) ++ continue; ++ ++ memcpy(&check_addr, p->payload + 1, 4); ++ memcpy(&check_fcnt, p->payload + 6, 2); ++ memcpy(&check_mic, p->payload + p->size - 4, 4); + -+ check_fcnt = p->payload[6]; -+ check_fcnt |= p->payload[7] << 8; -+ + check_snr = p->snr; + + for (j=0; j < nb_pkt; ++j) { + p = &rxpkt[j]; -+ mote_addr = p->payload[1]; -+ mote_addr |= p->payload[2] << 8; -+ mote_addr |= p->payload[3] << 16; -+ mote_addr |= p->payload[4] << 24; -+ -+ mote_fcnt = p->payload[6]; -+ mote_fcnt |= p->payload[7] << 8; + -+ if (check_addr == mote_addr && check_fcnt == mote_fcnt && p->snr < check_snr) { ++ if (p->size >= 12 ++ && memcmp(&check_addr, p->payload + 1, 4) == 0 ++ && memcmp(&check_fcnt, p->payload + 6, 2) == 0 ++ && memcmp(&check_mic, p->payload + p->size - 4, 4) == 0 ++ && p->snr < check_snr) { + // set status of duplicate packets rx'd on wrong channel + p->status = 1; + } @@ -44,4 +64,3 @@ index 801f28d..7c94308 100644 /* serialize Lora packets metadata and payload */ pkt_in_dgram = 0; for (i=0; i < nb_pkt; ++i) { - diff --git a/recipes-connectivity/lora/lora-packet-forwarder_4.0.1.bb b/recipes-connectivity/lora/lora-packet-forwarder_4.0.1.bb index 1430c6c..ca061da 100644 --- a/recipes-connectivity/lora/lora-packet-forwarder_4.0.1.bb +++ b/recipes-connectivity/lora/lora-packet-forwarder_4.0.1.bb @@ -7,7 +7,7 @@ LICENSE = "Proprietary" LIC_FILES_CHKSUM = "file://LICENSE;md5=22af7693d7b76ef0fc76161c4be76c45" DEPENDS = "lora-gateway logrotate lora-logging" RDEPENDS_${PN} += "bash" -PR = "r18" +PR = "r19" SRCREV = "v${PV}" @@ -40,6 +40,7 @@ SRC_URI = "git://github.com/Lora-net/packet_forwarder.git;protocol=git \ file://lora-packet-forwarder-gpsd.patch \ file://lora-packet-forwarder-beacon-rfu-fix.patch \ file://lora-packet-forwarder-jit-queue-increase-peek-and-remove-sort-from-dequeue.patch \ + file://lora-packet-forwarder-dedup-rx.patch \ " -- cgit v1.2.3