diff options
author | Jeff Hatch <jhatch@multitech.com> | 2020-06-15 12:01:01 -0500 |
---|---|---|
committer | Jeff Hatch <jhatch@multitech.com> | 2020-06-15 12:01:01 -0500 |
commit | 612ffa7c85d856c9706064e62448a3debe5c3379 (patch) | |
tree | 7ce893519ee65180783ef3c248bd04c6f3f817c5 /recipes-connectivity/lora | |
parent | 0a3f99fc26efa34e65d0105ae18888bd750e5ab6 (diff) | |
parent | a117c7a2ccc99c9903764658fc3640e06ffe4661 (diff) | |
download | meta-mlinux-612ffa7c85d856c9706064e62448a3debe5c3379.tar.gz meta-mlinux-612ffa7c85d856c9706064e62448a3debe5c3379.tar.bz2 meta-mlinux-612ffa7c85d856c9706064e62448a3debe5c3379.zip |
Merge branch 'udev-rules-refactoring' to better reflect architecture dependencies in architecture specific layers.
Diffstat (limited to 'recipes-connectivity/lora')
28 files changed, 1694 insertions, 69 deletions
diff --git a/recipes-connectivity/lora/lora-basic-station/lora-basic-station-disable-device-mode.patch b/recipes-connectivity/lora/lora-basic-station/lora-basic-station-disable-device-mode.patch new file mode 100644 index 0000000..d81d041 --- /dev/null +++ b/recipes-connectivity/lora/lora-basic-station/lora-basic-station-disable-device-mode.patch @@ -0,0 +1,15 @@ +diff --git a/src/sx1301conf.c b/src/sx1301conf.c +index bca649c..c2681a4 100644 +--- a/src/sx1301conf.c ++++ b/src/sx1301conf.c +@@ -433,7 +433,10 @@ int sx1301conf_start (struct sx1301conf* sx1301conf, u4_t cca_region) { + } + + LOG(MOD_RAL|INFO, "Station device: %s (PPS capture %sabled)", sx1301conf->device, sx1301conf->pps ? "en":"dis"); ++ ++#ifndef CFG_prod + lgwx_device_mode = sys_deviceMode; ++#endif + int err = lgw_start(); + if( err == LGW_HAL_SUCCESS ) { + lgw_reg_w(LGW_GPS_EN, sx1301conf->pps ? 1 : 0); diff --git a/recipes-connectivity/lora/lora-basic-station/lora-basic-station-fix-clksrc-0.patch b/recipes-connectivity/lora/lora-basic-station/lora-basic-station-fix-clksrc-0.patch new file mode 100644 index 0000000..c534460 --- /dev/null +++ b/recipes-connectivity/lora/lora-basic-station/lora-basic-station-fix-clksrc-0.patch @@ -0,0 +1,14 @@ +diff --git a/src/sx1301conf.c b/src/sx1301conf.c +index bca649c..fe62351 100644 +--- a/src/sx1301conf.c ++++ b/src/sx1301conf.c +@@ -193,7 +193,8 @@ static void parse_sx1301_conf (ujdec_t* D, struct sx1301conf* sx1301conf) { + break; + } + case J_clksrc: { + sx1301conf->boardconf.clksrc = uj_intRange(D, 0, LGW_RF_CHAIN_NB-1); ++ sx1301conf->boardconf.clksrc = 0; + break; + } + case J_tx_gain_lut: { + diff --git a/recipes-connectivity/lora/lora-basic-station/lora-basic-station-sys-linux-log-fix.patch b/recipes-connectivity/lora/lora-basic-station/lora-basic-station-sys-linux-log-fix.patch new file mode 100644 index 0000000..83be080 --- /dev/null +++ b/recipes-connectivity/lora/lora-basic-station/lora-basic-station-sys-linux-log-fix.patch @@ -0,0 +1,14 @@ +diff --git a/src-linux/sys_linux.c b/src-linux/sys_linux.c +index f8286c8..7afc073 100644 +--- a/src-linux/sys_linux.c ++++ b/src-linux/sys_linux.c +@@ -724,7 +724,7 @@ static int parseStationConf () { + case J_nodc: + case J_nodwell: + case J_device_mode: { +- LOG(MOD_S2E|WARNING, "Feature not supported in production level code (station.conf) - ignored: %s", D->field.name); +- uj_skipValue(D); ++ LOG(MOD_S2E|WARNING, "Feature not supported in production level code (station.conf) - ignored: %s", D.field.name); ++ uj_skipValue(&D); + break; + } diff --git a/recipes-connectivity/lora/lora-basic-station/lora-basic-station.default b/recipes-connectivity/lora/lora-basic-station/lora-basic-station.default new file mode 100644 index 0000000..0f92640 --- /dev/null +++ b/recipes-connectivity/lora/lora-basic-station/lora-basic-station.default @@ -0,0 +1,2 @@ +# set to "yes" or "no" to control starting on boot +ENABLED="no" diff --git a/recipes-connectivity/lora/lora-basic-station/lora-basic-station.init b/recipes-connectivity/lora/lora-basic-station/lora-basic-station.init new file mode 100755 index 0000000..45c6eee --- /dev/null +++ b/recipes-connectivity/lora/lora-basic-station/lora-basic-station.init @@ -0,0 +1,165 @@ +#!/bin/bash + + +NAME="lora-basic-station" +ENABLED="yes" + + +[ -f /etc/default/$NAME ] && source /etc/default/$NAME + +run_dir=/var/run/lora +opt_conf_dir=/opt/lora +conf_dir=/var/config/lora +conf_file=$conf_dir/station.conf +tc_uri_file=$conf_dir/tc.uri +tc_key_file=$conf_dir/tc.key +tc_trust_file=$conf_dir/tc.trust + +pkt_fwd=$run_dir/1/station +pkt_fwd_pidfile=$run_dir/station.pid + +port1=/sys/devices/platform/mts-io/ap1 +port2=/sys/devices/platform/mts-io/ap2 + +lora_mtac_id="MTAC-LORA" +lora_1_0_hw="MTAC-LORA-1.0" +lora_1_5_h_hw="MTAC-LORA-1.5" +lora_2_1_hw="MTAC-LORA-2.1" + +lora_mtac_id="MTAC-LORA" +lora_mtac_id915="MTAC-LORA-915" +lora_mtac_id868="MTAC-LORA-868" +lora_mtac_h_id915="MTAC-LORA-H-915" +lora_mtac_h_id868="MTAC-LORA-H-868" + +lora_mtcap_id="MTCAP-LORA" +lora_mtcap_id868="MTCAP-LORA-868" +lora_mtcap_id915="MTCAP-LORA-915" + +lora_mtac_g_id="MTAC-LORA-G" +lora_mtac_g16_id868="MTAC-LORA-G16-868" +lora_mtac_g16_id915="MTAC-LORA-G16-915" +lora_mtac_g64_id868="MTAC-LORA-G64-868" +lora_mtac_g64_id915="MTAC-LORA-G64-915" + +pkt_fwd_options="" + +gps_path="/dev/gps0" + +read_lora_hw_info() { + lora_id=$(mts-io-sysfs show lora/product-id 2> /dev/null) + lora_hw=$(mts-io-sysfs show lora/hw-version 2> /dev/null) + lora_eui=$(mts-io-sysfs show lora/eui 2> /dev/null) + lora_eui_raw=${lora_eui//:/} +} + +hardware_found() { + if [[ "$lora_id" =~ "$lora_mtac_g_id" ]]; then + setup_mtcdt_2_1 + elif [[ "$lora_id" =~ "$lora_mtcap_id" ]]; then + setup_mtcap + elif [[ "$lora_id" =~ "$lora_mtac_id" ]]; then + setup_mtcdt + else + return 1 + fi + return 0 +} + +setup_mtcdt() { + if [ -d $port1 ] && [[ $(cat $port1/hw-version) = $lora_hw ]]; then + ln -sf /dev/spidev32766.2 /dev/spidev0.0 + elif [ -d $port2 ] && [[ $(cat $port2/hw-version) = $lora_hw ]]; then + ln -sf /dev/spidev32765.2 /dev/spidev0.0 + fi + + ln -sf /opt/lora/station $pkt_fwd +} + +setup_mtcap() { + + ln -sf /opt/lora/station $pkt_fwd +} + +setup_mtcdt_2_1() { + echo LORA-2.1 not supported + return 1 +} + +do_start() { + + mkdir -p $run_dir/1 + rm -rf $run_dir/1/* + + read_lora_hw_info + + if hardware_found; then + echo "Found $lora_id with $lora_hw hardware. Configuring" + else + echo "$0: LORA card not detected" + exit 1 + fi + + if ! [ -f $conf_file ]; then + echo "$0: $conf_file missing" + exit 1 + fi + + # + # copy conf files to the run directory + # + cp $conf_file $run_dir/1/ + cp $tc_uri_file $run_dir/1/ + cp $tc_key_file $run_dir/1/ + cp $tc_trust_file $run_dir/1/ + + sed -i.bak "s/\(.*routerid\"\s*\:\s*\"\)<.*>[^\"]*\(.*\)/\1${lora_eui_raw}\2/g" /var/run/lora/1/station.conf + + # + # start packet forwarder + # + echo -n "Starting $NAME: " + + /usr/sbin/start-stop-daemon --chdir $run_dir/1 --background --start --make-pidfile \ + --pidfile $pkt_fwd_pidfile --startas /bin/bash -- -c "exec $pkt_fwd $pkt_fwd_options" + + renice -n -20 -p $(pgrep $(basename $pkt_fwd)) + + echo "OK" +} + + +do_stop() { + echo -n "Stopping $NAME: " + start-stop-daemon --stop --quiet --oknodo --pidfile $pkt_fwd_pidfile --retry 5 + rm -f $pkt_fwd_pidfile + echo "OK" +} + + +if [ "$ENABLED" != "yes" ]; then + echo "$NAME: disabled in /etc/default" + exit +fi + + +case "$1" in + "start") + do_start + ;; + "stop") + do_stop + ;; + "restart") + ## Stop the service and regardless of whether it was + ## running or not, start it again. + do_stop + do_start + ;; + *) + ## If no parameters are given, print which are avaiable. + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac + diff --git a/recipes-connectivity/lora/lora-basic-station/setup.gmk b/recipes-connectivity/lora/lora-basic-station/setup.gmk new file mode 100644 index 0000000..1319e79 --- /dev/null +++ b/recipes-connectivity/lora/lora-basic-station/setup.gmk @@ -0,0 +1,91 @@ +# -*- makefile -*- + +# Top dir of s2core +# - override accordingly in makefile including this setup.gmk + +platform ?= mlinux +variant ?= std + + +ARCH ?= +CROSS_COMPILE ?= +export + +# TOOLPREFIX=${CROSS_COMPILE} + + +BD=build-${platform}-${variant} + +# -- Architecture specific +CFG.arm-linux-gnueabihf = mlinux +# CFG.x86_64-linux-gnu = linux + +# -- Variant specific +# testsim runs libloragw inside master process +# testms uses a master slave model +#CFG.testsim = logini_lvl=DEBUG selftests tlsdebug lgwsim ral_lgw +#CFG.testms = logini_lvl=DEBUG selftests tlsdebug lgwsim ral_master_slave +#CFG.testfs = logini_lvl=DEBUG selftests tlsdebug lgwsim ral_lgw +#CFG.testpin = logini_lvl=INFO tlsdebug ral_lgw testpin +#CFG.std = logini_lvl=INFO tlsdebug ral_lgw +#CFG.stdn = logini_lvl=INFO tlsdebug ral_master_slave +#CFG.debug = logini_lvl=DEBUG selftests tlsdebug ral_lgw +#CFG.debugn = logini_lvl=DEBUG selftests tlsdebug ral_master_slave + +# -- Platform specific +CFG.linux = linux lgw1 no_leds +CFG.rpi = linux lgw1 no_leds +CFG.kerlink = linux lgw1 no_leds +CFG.mlinux = linux lgw1 no_leds ral_lgw prod + +SD.default = src-linux + +SD = $(or ${SD.${platform}}, ${SD.default}) + +UTILS.linux = mtuns + +UTILS = $(or ${UTILS.${platform}}, ${UTILS.default}) + +PERSO.default = +PERSO = $(or ${PERSO.${platform}}, ${PERSO.default}) +PERSOH = $(if ${PERSO},perso.h,) + +# Paths to dependencies +MBEDLIBS = -lmbedtls -lmbedx509 -lmbedcrypto + +# -lm: Needed for lgw which uses pow/ceil +ifneq (minihub,$(platform)) +SYSLIBS = -lm +endif + +CFLAGS.linux.testsim = -g -O0 --coverage +CFLAGS.linux.testms = -g -O0 --coverage +CFLAGS.linux.testfs = -g -O0 --coverage +CFLAGS.linux.testpin = -g -O3 +CFLAGS.linux.std = -g -O3 +CFLAGS.mlinux.std = -g -O3 + +LIBS.mlinux = -lloragw ${MBEDLIBS} -lrt -lm -lpthread +LIBS.linux = -llgw ${MBEDLIBS} -lpthread +LIBS.rpi = -llgw ${MBEDLIBS} -lpthread +LIBS.kerlink = -llgw ${MBEDLIBS} -lrt -lpthread + +xCFG = ${CFG.${ARCH}} ${CFG.${platform}} ${CFG.${variant}} ${CFG.${platform}.${variant}} +xCFLAGS = ${CFLAGS.${ARCH}} ${CFLAGS.${platform}} ${CFLAGS.${variant}} ${CFLAGS.${platform}.${variant}} +xINCS = ${INCS.${ARCH}} ${INCS.${platform}} ${INCS.${variant}} +xLDFLAGS = ${LDFLAGS.${ARCH}} ${LDFLAGS.${platform}} ${LDFLAGS.${variant}} +xLIBS = ${LIBS.${ARCH}} ${LIBS.${platform}} ${LIBS.${variant}} +xFILES = ${FILES.${ARCH}} ${FILES.${platform}} ${FILES.${variant}} +xOCFLAGS = ${OCFLAGS.${ARCH}} ${OCFLAGS.${platform}} ${OCFLAGS.${variant}} + +DEFS = -DCFG_platform_${platform} -DCFG_platform=\"${platform}\" -DCFG_variant_${variant} -DCFG_variant=\"${variant}\" +DEFS += -DCFG_bdate='"$(shell date -u '+%Y-%m-%d %H:%M:%S')"' +DEFS += -DCFG_version='"$(shell if [ -f ${TD}/VERSION.txt ]; then cat ${TD}/VERSION.txt; else git describe --tag; fi)(${platform}/${variant})"' +DEFS += -DCFG_commit='"$(shell if git rev-parse --git-dir >/dev/null 2>&1; then git rev-parse --short HEAD; else echo -; fi)"' +DEFS += ${xCFG:%=-DCFG_%} +INCS = ${VPATH:%=-I%} -I ${TD}/${BD}/include ${xINCS} +CFLAGS += -std=gnu11 ${INCS} ${DEFS} ${xCFLAGS} ${MORECFLAGS} +LDFLAGS += -L ${TD}/${BD}/lib ${xLDFLAGS} +LIBS = ${xLIBS} ${SYSLIBS} +FILES = ${xFILES} +OCFLAGS = ${xOCFLAGS} diff --git a/recipes-connectivity/lora/lora-basic-station/tc.uri b/recipes-connectivity/lora/lora-basic-station/tc.uri new file mode 100644 index 0000000..62ad13e --- /dev/null +++ b/recipes-connectivity/lora/lora-basic-station/tc.uri @@ -0,0 +1 @@ +wss://127.0.0.1:9002 diff --git a/recipes-connectivity/lora/lora-basic-station_2.0.3.bb b/recipes-connectivity/lora/lora-basic-station_2.0.3.bb new file mode 100644 index 0000000..2db6a14 --- /dev/null +++ b/recipes-connectivity/lora/lora-basic-station_2.0.3.bb @@ -0,0 +1,58 @@ +DESCRIPTION = "LoRa Basic Station" +HOMEPAGE = "https://github.com/lorabasics/basicstation" +PRIORITY = "optional" +SECTION = "console/utils" +# Semtech license is a modified BSD-style license +LICENSE = "Proprietary" +LIC_FILES_CHKSUM = "file://LICENSE;md5=7706b51ea6d730e45568141c660072d5" +DEPENDS = "lora-gateway logrotate lora-logging mbedtls" +RDEPENDS_${PN} += "bash" +PR = "r1" + +SRCREV = "v${PV}" + +SRC_URI = "git://github.com/lorabasics/basicstation.git;protocol=git \ + file://setup.gmk \ + file://lora-basic-station.init \ + file://lora-basic-station.default \ + file://tc.uri \ + file://lora-basic-station-disable-device-mode.patch \ + file://lora-basic-station-sys-linux-log-fix.patch \ + file://lora-basic-station-fix-clksrc-0.patch \ +" + + +S = "${WORKDIR}/git" +B = "${S}" + +LORA_DIR = "/opt/lora" + +export LGW_PATH = "${STAGING_LIBDIR}/lora" +export LGW_INC = "${STAGING_INCDIR}/lora" + +CFLAGS += "-I${STAGING_INCDIR} -I${STAGING_INCDIR}/lora -I${WORKDIR}/git/deps -Iinc -I. -std=gnu11 -L${STAGING_LIBDIR}/lora" + +do_compile() { + rm -fr ${S}/deps/lgw + ln -s ${STAGING_INCDIR}/lora ${S}/deps/lgw + cp ${WORKDIR}/setup.gmk ${S}/setup.gmk + oe_runmake +} + +do_install() { + install -d ${D}${LORA_DIR} + install -m 755 ${S}/build-mlinux-std/bin/station ${D}${LORA_DIR}/ + install -m 755 ${WORKDIR}/tc.uri ${D}${LORA_DIR}/ + + install -d ${D}${sysconfdir}/default + install -m 0644 ${WORKDIR}/lora-basic-station.default ${D}${sysconfdir}/default/lora-basic-station + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/lora-basic-station.init ${D}${sysconfdir}/init.d/lora-basic-station +} + +FILES_${PN} += "${LORA_DIR}" + +# disable this on purpose for dev purposes +do_rm_work() { + echo "skipping" +} diff --git a/recipes-connectivity/lora/lora-gateway-geolocation_5.1.0.bb b/recipes-connectivity/lora/lora-gateway-geolocation_5.1.0.bb index 403670a..511a8b3 100644 --- a/recipes-connectivity/lora/lora-gateway-geolocation_5.1.0.bb +++ b/recipes-connectivity/lora/lora-gateway-geolocation_5.1.0.bb @@ -27,6 +27,9 @@ do_compile() { } do_install() { +} + +do_install_append_mtcdt() { install -d ${D}${includedir}/lora install -d ${D}${libdir}/lora install -m 0644 mlinux4/libsx1301ar/* ${D}${includedir}/lora diff --git a/recipes-connectivity/lora/lora-gateway_5.0.1.bb b/recipes-connectivity/lora/lora-gateway_5.0.1.bb index faec985..a86b23a 100644 --- a/recipes-connectivity/lora/lora-gateway_5.0.1.bb +++ b/recipes-connectivity/lora/lora-gateway_5.0.1.bb @@ -5,25 +5,17 @@ SECTION = "console/utils" # Semtech license is a modified BSD-style license LICENSE = "Proprietary" LIC_FILES_CHKSUM = "file://LICENSE;md5=a2bdef95625509f821ba00460e3ae0eb" -DEPENDS = "libgps24" -RDEPENDS_${PN} = "libgps24" -PR = "r12" +DEPENDS = "gpsd" +RDEPENDS_${PN} = "gpsd" -SRCREV = "v${PV}" +PR = "r24" +SRCREV = "dea57d6f29246434173c33c56850708c51fc5b23" -SRC_URI = "git://github.com/Lora-net/lora_gateway.git;protocol=git \ - file://lora-gateway-add-fpga-version-28-31-33.patch \ +SRC_URI = "git://git@gitlab.multitech.net/lora_enterprise/lora_gateway_mtac_full.git;protocol=ssh;branch=master \ file://library_4.0.cfg \ - file://lora-gateway-add-spi-path-function.patch \ file://ln-lora-spi-dev.sh \ - file://lora-gateway-change-util-tx-continuous-clksrc.patch \ - file://lora-gateway-v28-skip-IQ-invert.patch \ - file://lora-gateway-spectral-scan-skip-fpga-reset.patch \ - file://lora-gateway-gpsd.patch \ " -SRC_URI[md5sum] = "9e06a3733a9fea39a3d61f77b412badf" -SRC_URI[sha256sum] = "28fbfe098013908794b32e51d1fed4427f20dd6c8adbbca78df2e1800f5c84dc" S = "${WORKDIR}/git" @@ -74,4 +66,3 @@ FILES_${PN}-staticdev = "${libdir}/lora/libloragw.a" do_rm_work() { echo "skipping" } - diff --git a/recipes-connectivity/lora/lora-logging.bb b/recipes-connectivity/lora/lora-logging.bb index 752b63b..4691458 100644 --- a/recipes-connectivity/lora/lora-logging.bb +++ b/recipes-connectivity/lora/lora-logging.bb @@ -4,7 +4,7 @@ SECTION = "console/utils" LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" DEPENDS = "" -PR = "r3" +PR = "r4" RDEPENDS_${PN} += "logrotate bash" SRC_URI = "file://lora-logging.logrotate.conf \ diff --git a/recipes-connectivity/lora/lora-logging/lora-logging.logrotate.conf b/recipes-connectivity/lora/lora-logging/lora-logging.logrotate.conf index 5f26561..6fc191c 100644 --- a/recipes-connectivity/lora/lora-logging/lora-logging.logrotate.conf +++ b/recipes-connectivity/lora/lora-logging/lora-logging.logrotate.conf @@ -6,7 +6,6 @@ missingok postrotate set -e; - /usr/bin/killall -HUP lora_pkt_fwd || true; /usr/bin/killall -HUP lora-network-server || true; endscript } diff --git a/recipes-connectivity/lora/lora-network-server/lora-network-server.init b/recipes-connectivity/lora/lora-network-server/lora-network-server.init index b8b1f6f..61af0f4 100755 --- a/recipes-connectivity/lora/lora-network-server/lora-network-server.init +++ b/recipes-connectivity/lora/lora-network-server/lora-network-server.init @@ -38,6 +38,12 @@ lora_mtcap_id="MTCAP-LORA" lora_mtcap_id868="MTCAP-LORA-868" lora_mtcap_id915="MTCAP-LORA-915" +mtcdt3_id="MTCDT3" +lora_mtcdt3_id="MTCDT3-LORA" +lora_mtcdt3_id868="MTCDT3-LORA-868" +lora_mtcdt3_id915="MTCDT3-LORA-915" + + lora_mtac_g_id="MTAC-LORA-G" lora_mtac_g16_id868="MTAC-LORA-G16-868" lora_mtac_g16_id915="MTAC-LORA-G16-915" @@ -49,6 +55,8 @@ dual_cards_installed=false gps_path="/dev/gps0" read_lora_hw_info() { + hw_id=$(mts-io-sysfs show product-id 2> /dev/null) + # product-id of first lora card lora_id=$(mts-io-sysfs show lora/product-id 2> /dev/null) lora_eui=$(mts-io-sysfs show lora/eui 2> /dev/null) @@ -69,8 +77,22 @@ read_lora_hw_info() { fi } +setup_mtcdt3() { + dual_cards_installed=true + ln -sf /opt/lora/lora_pkt_fwd $pkt_fwd + ln -sf /opt/lora/lora_pkt_fwd $pkt_fwd_2 + + lora_eui=$(mts-io-sysfs show lora/eui) + lora_2_eui=$(mts-io-sysfs show lora-2/eui) + + lora_2_hw=$lora_hw + lora_2_id=$lora_id +} + hardware_found() { - if [[ "$lora_id" =~ "$lora_mtac_g_id" ]]; then + if [[ "$hw_id" =~ "$mtcdt3_id" ]]; then + setup_mtcdt3 + elif [[ "$lora_id" =~ "$lora_mtac_g_id" ]]; then setup_mtcdt_2_1 elif [[ "$lora_id" =~ "$lora_mtac_id" ]]; then setup_mtcdt @@ -137,10 +159,20 @@ setup_mtcdt() { } setup_mtcap() { + hw=$(mts-io-sysfs show hw-version 2> /dev/null) + if [ "$lora_id" = "$lora_mtcap_id868" ]; then - GLOBAL_CONF=/opt/lora/global_conf.json.MTCAP_LORA_1_5.EU868 + if [ "$hw" = "MTCAP-0.2" ]; then + GLOBAL_CONF=/opt/lora/global_conf.json.MTCAP2_LORA_1_5.EU868 + else + GLOBAL_CONF=/opt/lora/global_conf.json.MTCAP_LORA_1_5.EU868 + fi elif [ "$lora_id" = "$lora_mtcap_id915" ]; then - GLOBAL_CONF=/opt/lora/global_conf.json.MTCAP_LORA_1_5.US915 + if [ "$hw" = "MTCAP-0.2" ]; then + GLOBAL_CONF=/opt/lora/global_conf.json.MTCAP2_LORA_1_5.US915 + else + GLOBAL_CONF=/opt/lora/global_conf.json.MTCAP_LORA_1_5.US915 + fi else return 1 fi @@ -171,16 +203,30 @@ do_start() { if hardware_found; then echo "Found $lora_id with $lora_hw hardware" - mts-io-sysfs store lora/reset 0 - if [ "$dual_cards_installed" == true ]; then - mts-io-sysfs store lora-2/reset 0 - fi - sleep 0.25 - mts-io-sysfs store lora/reset 1 - if [ "$dual_cards_installed" == true ]; then - mts-io-sysfs store lora-2/reset 1 + + if [[ "$hw_id" =~ "$mtcdt3_id" ]]; then + mts-io-sysfs store lora/reset 0 + mts-io-sysfs store lora-2/reset 0 + sleep 0.25 + mts-io-sysfs store lora/reset 1 + mts-io-sysfs store lora-2/reset 1 + sleep 0.25 + elif [[ "$lora_id" =~ "$lora_mtac_g_id" ]]; then + echo Resetting 2.1 LoRa + /usr/sbin/mts-util-lora2-reset -g -f >/dev/null 2>&1 + sleep 0.25 + else + mts-io-sysfs store lora/reset 0 + if [ "$dual_cards_installed" == true ]; then + mts-io-sysfs store lora-2/reset 0 + fi + sleep 0.25 + mts-io-sysfs store lora/reset 1 + if [ "$dual_cards_installed" == true ]; then + mts-io-sysfs store lora-2/reset 1 + fi + sleep 0.25 fi - sleep 0.25 else echo "$0: Lora hardware not detected" # Use MAC Address for lora eui @@ -205,21 +251,26 @@ do_start() { if [ "$no_lora_hw" != "true" ]; then # start packet forwarder - sleep 4 + if [[ "$hw_id" =~ "$mtcdt3_id" ]]; then + sleep 0.5 + else + sleep 4 + fi /usr/sbin/start-stop-daemon --chdir $run_dir/1 --start --background --make-pidfile \ --pidfile $pkt_fwd_pidfile --startas /bin/bash \ - -- -c "exec $angel $pkt_fwd $pkt_fwd_options 2>&1 >> $pkt_fwd_log" + -- -c "exec $angel $pkt_fwd $pkt_fwd_options 2>&1" if [ "$dual_cards_installed" == "true" ]; then /usr/sbin/start-stop-daemon --chdir $run_dir/2 --start --background --make-pidfile \ --pidfile $pkt_fwd_2_pidfile --startas /bin/bash \ - -- -c "exec $angel $pkt_fwd_2 $pkt_fwd_options 2>&1 >> $pkt_fwd_2_log" + -- -c "exec $angel $pkt_fwd_2 $pkt_fwd_options -l $pkt_fwd_2_log" fi fi - renice -n -20 -p $(pgrep lora-network-se) - renice -n -20 -p $(pgrep $(basename $pkt_fwd)) - + if [[ ! "$hw_id" =~ "$mtcdt3_id" ]]; then + renice -n -20 -p $(pgrep lora-network-se) + renice -n -20 -p $(pgrep $(basename $pkt_fwd)) + fi echo "OK" } @@ -229,6 +280,7 @@ do_stop() { echo -n "Stopping $NAME: " start-stop-daemon --stop --quiet --oknodo --pidfile $net_server_pidfile --retry TERM/60/KILL/5 start-stop-daemon --stop --quiet --oknodo --pidfile $pkt_fwd_pidfile --retry 5 + start-stop-daemon --stop --quiet --oknodo --pidfile $pkt_fwd_2_pidfile --retry 5 rm -f $net_server_pidfile $pkt_fwd_pidfile echo "OK" } @@ -239,12 +291,12 @@ if [ "$ENABLED" != "yes" ]; then exit fi -force_stop() { - do_stop - rm -fr $LOCK -} - -function try_lock() { +force_stop() { + do_stop + rm -fr $LOCK +} + +function try_lock() { if mkdir $LOCK; then trap "rm -fr $LOCK" EXIT else diff --git a/recipes-connectivity/lora/lora-network-server_2.2.30.bb b/recipes-connectivity/lora/lora-network-server_2.3.9.bb index 6c05481..7e63635 100644 --- a/recipes-connectivity/lora/lora-network-server_2.2.30.bb +++ b/recipes-connectivity/lora/lora-network-server_2.3.9.bb @@ -4,7 +4,7 @@ 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" +RDEPENDS_${PN} += "lora-packet-forwarder logrotate bash lora-logging jsoncpp" PR = "r0" CONFFILES_${PN} += "${sysconfdir}/default/lora-network-server ${sysconfdir}/init.d/lora-network-server" @@ -13,8 +13,8 @@ SRC_URI = "http://multitech.net/downloads/lora-network-server_${PV}.tar.gz \ file://lora-network-server.default \ " -SRC_URI[md5sum] = "c8b1589023b413e16fc3939d01a01e35" -SRC_URI[sha256sum] = "70bc0f6e703ec346efa195922ce2392a53f2069aa1a0fa63f2998af8e9a22922" +SRC_URI[md5sum] = "88110a6a04b7c8ed02ee30102ba31e49" +SRC_URI[sha256sum] = "a2f0305b0eb48d55a53b1dc358bde4618688ccf952c79f5d9d2e2d7474f28042" # binaries are already stripped, so suppress warning INSANE_SKIP_${PN} = "already-stripped" @@ -33,8 +33,8 @@ 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 0755 lora-network-server-arm926ejste-mlinux-5.2 ${D}${LORA_DIR}/lora-network-server + install -m 0755 lora-v21-keygen-arm926ejste-mlinux-5.2 ${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 diff --git a/recipes-connectivity/lora/lora-packet-forwarder-geolocation_5.1.0.bb b/recipes-connectivity/lora/lora-packet-forwarder-geolocation_5.1.0.bb index fa5232a..b42bd31 100644 --- a/recipes-connectivity/lora/lora-packet-forwarder-geolocation_5.1.0.bb +++ b/recipes-connectivity/lora/lora-packet-forwarder-geolocation_5.1.0.bb @@ -41,6 +41,9 @@ do_compile() { } do_install() { +} + +do_install_append_mtcdt() { install -d ${D}${LORA_DIR} install -m 755 mlinux4/pkt_forwarder ${D}${LORA_DIR}/ install -m 755 ${WORKDIR}/global_conf.json.MTAC_LORA_2_1* ${D}${LORA_DIR}/ diff --git a/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.AS923 b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.AS923 new file mode 100644 index 0000000..fd3800b --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.AS923 @@ -0,0 +1,117 @@ +{ + "SX1301_conf": { + "antenna_gain": 0, + "chan_FSK": { + "bandwidth": 125000, + "datarate": 50000, + "enable": true, + "freq_deviation": 25000, + "if": 300000, + "radio": 0 + }, + "chan_Lora_std": { + "bandwidth": 250000, + "enable": true, + "if": -200000, + "radio": 0, + "spread_factor": 7 + }, + "chan_multiSF_0": { + "enable": true, + "if": -400000, + "radio": 0 + }, + "chan_multiSF_1": { + "enable": true, + "if": -200000, + "radio": 0 + }, + "chan_multiSF_2": { + "enable": true, + "if": 0, + "radio": 0 + }, + "chan_multiSF_3": { + "enable": true, + "if": -400000, + "radio": 1 + }, + "chan_multiSF_4": { + "enable": true, + "if": -200000, + "radio": 1 + }, + "chan_multiSF_5": { + "enable": true, + "if": 0, + "radio": 1 + }, + "chan_multiSF_6": { + "enable": true, + "if": 200000, + "radio": 1 + }, + "chan_multiSF_7": { + "enable": true, + "if": 400000, + "radio": 1 + }, + "clksrc": 0, + "lbt_cfg": { + "chan_cfg": [ + ], + "enable": false, + "rssi_target": -80, + "sx127x_rssi_offset": -4 + }, + "lorawan_public": true, + "radio_0": { + "enable": true, + "freq": 923600000, + "rssi_offset": -162, + "tx_enable": true, + "tx_freq_max": 928000000, + "tx_freq_min": 920000000, + "type": "SX1257" + }, + "radio_1": { + "enable": true, + "freq": 922600000, + "rssi_offset": -162, + "tx_enable": false, + "type": "SX1257" + }, + "tx_lut_0":{"dig_gain":0,"mix_gain":12,"pa_gain":1,"rf_power":10}, + "tx_lut_1":{"dig_gain":3,"mix_gain":11,"pa_gain":2,"rf_power":11}, + "tx_lut_2":{"dig_gain":0,"mix_gain":14,"pa_gain":1,"rf_power":12}, + "tx_lut_3":{"dig_gain":0,"mix_gain":9,"pa_gain":2,"rf_power":13}, + "tx_lut_4":{"dig_gain":2,"mix_gain":11,"pa_gain":2,"rf_power":14}, + "tx_lut_5":{"dig_gain":3,"mix_gain":8,"pa_gain":3,"rf_power":15}, + "tx_lut_6":{"dig_gain":0,"mix_gain":11,"pa_gain":2,"rf_power":16}, + "tx_lut_7":{"dig_gain":3,"mix_gain":9,"pa_gain":3,"rf_power":17}, + "tx_lut_8":{"dig_gain":1,"mix_gain":8,"pa_gain":3,"rf_power":20}, + "tx_lut_9":{"dig_gain":0,"mix_gain":8,"pa_gain":3,"rf_power":21}, + "tx_lut_10":{"dig_gain":2,"mix_gain":10,"pa_gain":3,"rf_power":23}, + "tx_lut_11":{"dig_gain":1,"mix_gain":10,"pa_gain":3,"rf_power":24}, + "tx_lut_12":{"dig_gain":0,"mix_gain":10,"pa_gain":3,"rf_power":25}, + "tx_lut_13":{"dig_gain":2,"mix_gain":12,"pa_gain":3,"rf_power":26}, + "tx_lut_14":{"dig_gain":0,"mix_gain":13,"pa_gain":3,"rf_power":28}, + "tx_lut_15":{"dig_gain":0,"mix_gain":15,"pa_gain":3,"rf_power":29} + }, + "gateway_conf": { + "gateway_ID": "<WILL-BE-AUTO-REPLACED-WITH-LORA-EUI>", + "server_address": "52.3.215.147", + "serv_port_up": 20000, + "serv_port_down": 20000, + "keepalive_interval": 10, + "stat_interval": 30, + "push_timeout_ms": 100, + "forward_crc_valid": true, + "forward_crc_error": true, + "forward_crc_disabled": false, + "synch_word": 52, + "autoquit_threshold": 60 + } +} + + diff --git a/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.AS923-LBT b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.AS923-LBT new file mode 100644 index 0000000..c5f9308 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.AS923-LBT @@ -0,0 +1,149 @@ +{ + "SX1301_conf": { +"antenna_gain": 0, + "chan_FSK": { + "bandwidth": 125000, + "datarate": 50000, + "enable": true, + "freq_deviation": 25000, + "if": 300000, + "radio": 0 + }, + "chan_Lora_std": { + "bandwidth": 250000, + "enable": true, + "if": -200000, + "radio": 0, + "spread_factor": 7 + }, + "chan_multiSF_0": { + "enable": true, + "if": -400000, + "radio": 0 + }, + "chan_multiSF_1": { + "enable": true, + "if": -200000, + "radio": 0 + }, + "chan_multiSF_2": { + "enable": true, + "if": 0, + "radio": 0 + }, + "chan_multiSF_3": { + "enable": true, + "if": -400000, + "radio": 1 + }, + "chan_multiSF_4": { + "enable": true, + "if": -200000, + "radio": 1 + }, + "chan_multiSF_5": { + "enable": true, + "if": 0, + "radio": 1 + }, + "chan_multiSF_6": { + "enable": true, + "if": 200000, + "radio": 1 + }, + "chan_multiSF_7": { + "enable": true, + "if": 400000, + "radio": 1 + }, + "clksrc": 0, + "lbt_cfg": { + "chan_cfg": [ + { + "freq_hz": 923200000, + "scan_time_us": 5000 + }, + { + "freq_hz": 923400000, + "scan_time_us": 5000 + }, + { + "freq_hz": 923600000, + "scan_time_us": 5000 + }, + { + "freq_hz": 922200000, + "scan_time_us": 5000 + }, + { + "freq_hz": 922400000, + "scan_time_us": 5000 + }, + { + "freq_hz": 922600000, + "scan_time_us": 5000 + }, + { + "freq_hz": 922800000, + "scan_time_us": 5000 + }, + { + "freq_hz": 923000000, + "scan_time_us": 5000 + } + ], + "enable": true, + "rssi_target": -80, + "sx127x_rssi_offset": -4 + }, + "lorawan_public": true, + "radio_0": { + "enable": true, + "freq": 923600000, + "rssi_offset": -162, + "tx_enable": true, + "tx_freq_max": 928000000, + "tx_freq_min": 920000000, + "type": "SX1257" + }, + "radio_1": { + "enable": true, + "freq": 922600000, + "rssi_offset": -162, + "tx_enable": false, + "type": "SX1257" + }, + "tx_lut_0":{"dig_gain":0,"mix_gain":12,"pa_gain":1,"rf_power":10}, + "tx_lut_1":{"dig_gain":3,"mix_gain":11,"pa_gain":2,"rf_power":11}, + "tx_lut_2":{"dig_gain":0,"mix_gain":14,"pa_gain":1,"rf_power":12}, + "tx_lut_3":{"dig_gain":0,"mix_gain":9,"pa_gain":2,"rf_power":13}, + "tx_lut_4":{"dig_gain":2,"mix_gain":11,"pa_gain":2,"rf_power":14}, + "tx_lut_5":{"dig_gain":3,"mix_gain":8,"pa_gain":3,"rf_power":15}, + "tx_lut_6":{"dig_gain":0,"mix_gain":11,"pa_gain":2,"rf_power":16}, + "tx_lut_7":{"dig_gain":3,"mix_gain":9,"pa_gain":3,"rf_power":17}, + "tx_lut_8":{"dig_gain":1,"mix_gain":8,"pa_gain":3,"rf_power":20}, + "tx_lut_9":{"dig_gain":0,"mix_gain":8,"pa_gain":3,"rf_power":21}, + "tx_lut_10":{"dig_gain":2,"mix_gain":10,"pa_gain":3,"rf_power":23}, + "tx_lut_11":{"dig_gain":1,"mix_gain":10,"pa_gain":3,"rf_power":24}, + "tx_lut_12":{"dig_gain":0,"mix_gain":10,"pa_gain":3,"rf_power":25}, + "tx_lut_13":{"dig_gain":2,"mix_gain":12,"pa_gain":3,"rf_power":26}, + "tx_lut_14":{"dig_gain":0,"mix_gain":13,"pa_gain":3,"rf_power":28}, + "tx_lut_15":{"dig_gain":0,"mix_gain":15,"pa_gain":3,"rf_power":29} + }, + "gateway_conf": { + "gateway_ID": "<WILL-BE-AUTO-REPLACED-WITH-LORA-EUI>", + "server_address": "52.3.215.147", + "serv_port_up": 20000, + "serv_port_down": 20000, + "keepalive_interval": 10, + "stat_interval": 30, + "push_timeout_ms": 100, + "forward_crc_valid": true, + "forward_crc_error": true, + "forward_crc_disabled": false, + "synch_word": 52, + "autoquit_threshold": 60 + } +} + + diff --git a/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.AU915 b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.AU915 new file mode 100644 index 0000000..ff8ec89 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.AU915 @@ -0,0 +1,115 @@ +{ + "SX1301_conf": { + "lorawan_public": true, + "antenna_gain": 0, + "clksrc": 0, + "radio_0": { + "enable": true, + "freq": 915600000, + "rssi_offset": -162, + "tx_enable": true, + "tx_freq_max": 928000000, + "tx_freq_min": 902000000, + "type": "SX1257" + }, + "radio_1": { + "enable": true, + "freq": 916400000, + "rssi_offset": -162, + "tx_enable": false, + "type": "SX1257" + }, + "chan_FSK": { + "enable": false, + "radio": 0 + }, + "chan_Lora_std": { + "bandwidth": 500000, + "enable": true, + "if": 300000, + "radio": 0, + "spread_factor": 8 + }, + "chan_multiSF_0": { + "enable": true, + "if": -400000, + "radio": 0 + }, + "chan_multiSF_1": { + "enable": true, + "if": -200000, + "radio": 0 + }, + "chan_multiSF_2": { + "enable": true, + "if": 0, + "radio": 0 + }, + "chan_multiSF_3": { + "enable": true, + "if": 200000, + "radio": 0 + }, + "chan_multiSF_4": { + "enable": true, + "if": -400000, + "radio": 1 + }, + "chan_multiSF_5": { + "enable": true, + "if": -200000, + "radio": 1 + }, + "chan_multiSF_6": { + "enable": true, + "if": 0, + "radio": 1 + }, + "chan_multiSF_7": { + "enable": true, + "if": 200000, + "radio": 1 + }, + "lbt_cfg": { + "enable": false, + "nb_channel": 1, + "rssi_target": 160, + "scan_time_us": 5000, + "start_freq": 869525000, + "tx_delay_1ch_us": 4000000, + "tx_delay_2ch_us": 4000000 + }, + "tx_lut_0":{"dig_gain":0,"mix_gain":12,"pa_gain":1,"rf_power":10}, + "tx_lut_1":{"dig_gain":3,"mix_gain":11,"pa_gain":2,"rf_power":11}, + "tx_lut_2":{"dig_gain":0,"mix_gain":14,"pa_gain":1,"rf_power":12}, + "tx_lut_3":{"dig_gain":0,"mix_gain":9,"pa_gain":2,"rf_power":13}, + "tx_lut_4":{"dig_gain":2,"mix_gain":11,"pa_gain":2,"rf_power":14}, + "tx_lut_5":{"dig_gain":3,"mix_gain":8,"pa_gain":3,"rf_power":15}, + "tx_lut_6":{"dig_gain":0,"mix_gain":11,"pa_gain":2,"rf_power":16}, + "tx_lut_7":{"dig_gain":3,"mix_gain":9,"pa_gain":3,"rf_power":17}, + "tx_lut_8":{"dig_gain":1,"mix_gain":8,"pa_gain":3,"rf_power":20}, + "tx_lut_9":{"dig_gain":0,"mix_gain":8,"pa_gain":3,"rf_power":21}, + "tx_lut_10":{"dig_gain":2,"mix_gain":10,"pa_gain":3,"rf_power":23}, + "tx_lut_11":{"dig_gain":1,"mix_gain":10,"pa_gain":3,"rf_power":24}, + "tx_lut_12":{"dig_gain":0,"mix_gain":10,"pa_gain":3,"rf_power":25}, + "tx_lut_13":{"dig_gain":2,"mix_gain":12,"pa_gain":3,"rf_power":26}, + "tx_lut_14":{"dig_gain":0,"mix_gain":13,"pa_gain":3,"rf_power":28}, + "tx_lut_15":{"dig_gain":0,"mix_gain":15,"pa_gain":3,"rf_power":29} + }, + "gateway_conf": { + "gateway_ID": "<WILL-BE-AUTO-REPLACED-WITH-LORA-EUI>", + "server_address": "52.3.215.147", + "serv_port_up": 20000, + "serv_port_down": 20000, + "keepalive_interval": 10, + "stat_interval": 30, + "push_timeout_ms": 100, + "forward_crc_valid": true, + "forward_crc_error": true, + "forward_crc_disabled": false, + "synch_word": 52, + "autoquit_threshold": 60 + } +} + + diff --git a/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.EU868 b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.EU868 new file mode 100644 index 0000000..ee56dd4 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.EU868 @@ -0,0 +1,60 @@ +{ + "SX1301_conf": { + "lorawan_public": true, + "clksrc": 0, + "lbt_cfg": { + "enable": false, + "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": 0, + "radio_0": { "enable": true, "type": "SX1257", "freq": 867500000, "rssi_offset": -162, "tx_enable": true, "tx_freq_min": 863000000, "tx_freq_max": 870000000 }, + "radio_1": { "enable": true, "type": "SX1257", "freq": 868500000, "rssi_offset": -162, "tx_enable": false }, + "chan_multiSF_0": { "enable": true, "radio": 1, "if": -400000 }, + "chan_multiSF_1": { "enable": true, "radio": 1, "if": -200000 }, + "chan_multiSF_2": { "enable": true, "radio": 1, "if": 0 }, + "chan_multiSF_3": { "enable": true, "radio": 0, "if": -400000 }, + "chan_multiSF_4": { "enable": true, "radio": 0, "if": -200000 }, + "chan_multiSF_5": { "enable": true, "radio": 0, "if": 0 }, + "chan_multiSF_6": { "enable": true,"radio": 0, "if": 200000 }, + "chan_multiSF_7": { "enable": true, "radio": 0, "if": 400000 }, + "chan_Lora_std": { "enable": true, "radio": 1, "if": -200000, "bandwidth": 250000, "spread_factor": 7 }, + "chan_FSK": { "enable": true, "radio": 1, "if": 300000, "bandwidth": 125000, "datarate": 50000 }, + "tx_lut_0":{"dig_gain":0,"mix_gain":12,"pa_gain":1,"rf_power":10}, + "tx_lut_1":{"dig_gain":3,"mix_gain":11,"pa_gain":2,"rf_power":11}, + "tx_lut_2":{"dig_gain":0,"mix_gain":14,"pa_gain":1,"rf_power":12}, + "tx_lut_3":{"dig_gain":0,"mix_gain":9,"pa_gain":2,"rf_power":13}, + "tx_lut_4":{"dig_gain":2,"mix_gain":11,"pa_gain":2,"rf_power":14}, + "tx_lut_5":{"dig_gain":3,"mix_gain":8,"pa_gain":3,"rf_power":15}, + "tx_lut_6":{"dig_gain":0,"mix_gain":11,"pa_gain":2,"rf_power":16}, + "tx_lut_7":{"dig_gain":3,"mix_gain":9,"pa_gain":3,"rf_power":17}, + "tx_lut_8":{"dig_gain":1,"mix_gain":8,"pa_gain":3,"rf_power":20}, + "tx_lut_9":{"dig_gain":0,"mix_gain":8,"pa_gain":3,"rf_power":21}, + "tx_lut_10":{"dig_gain":2,"mix_gain":10,"pa_gain":3,"rf_power":23}, + "tx_lut_11":{"dig_gain":1,"mix_gain":10,"pa_gain":3,"rf_power":24}, + "tx_lut_12":{"dig_gain":0,"mix_gain":10,"pa_gain":3,"rf_power":25}, + "tx_lut_13":{"dig_gain":2,"mix_gain":12,"pa_gain":3,"rf_power":26}, + "tx_lut_14":{"dig_gain":0,"mix_gain":13,"pa_gain":3,"rf_power":28}, + "tx_lut_15":{"dig_gain":0,"mix_gain":15,"pa_gain":3,"rf_power":29} + }, + "gateway_conf": { + "gateway_ID": "<WILL-BE-AUTO-REPLACED-WITH-LORA-EUI>", + "server_address": "52.3.215.147", + "serv_port_up": 20000, + "serv_port_down": 20000, + "keepalive_interval": 10, + "stat_interval": 30, + "push_timeout_ms": 100, + "forward_crc_valid": true, + "forward_crc_error": true, + "forward_crc_disabled": false, + "synch_word": 52, + "autoquit_threshold": 60 + } +} + + diff --git a/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.IN865 b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.IN865 new file mode 100644 index 0000000..4c91d78 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.IN865 @@ -0,0 +1,118 @@ +{ + "SX1301_conf": { + "antenna_gain": 0, + "chan_FSK": { + "bandwidth": 125000, + "datarate": 50000, + "enable": true, + "freq_deviation": 25000, + "if": 300000, + "radio": 1 + }, + "chan_Lora_std": { + "bandwidth": 250000, + "enable": true, + "if": 0, + "radio": 0, + "spread_factor": 7 + }, + "chan_multiSF_": { + "radio": null + }, + "chan_multiSF_0": { + "enable": true, + "if": -137500, + "radio": 0 + }, + "chan_multiSF_1": { + "enable": true, + "if": 202500, + "radio": 0 + }, + "chan_multiSF_2": { + "enable": true, + "if": 32500, + "radio": 0 + }, + "chan_multiSF_3": { + "enable": true, + "if": -400000, + "radio": 1 + }, + "chan_multiSF_4": { + "enable": true, + "if": -200000, + "radio": 1 + }, + "chan_multiSF_5": { + "enable": true, + "if": 0, + "radio": 1 + }, + "chan_multiSF_6": { + "enable": true, + "if": 200000, + "radio": 1 + }, + "chan_multiSF_7": { + "enable": true, + "if": 400000, + "radio": 1 + }, + "clksrc": 0, + "lbt_cfg": { + "enable": false, + "rssi_target": 160 + }, + "lorawan_public": true, + "radio_0": { + "enable": true, + "freq": 865200000, + "rssi_offset": -162, + "tx_enable": true, + "tx_freq_max": 867000000, + "tx_freq_min": 865000000, + "tx_notch_freq": 129000, + "type": "SX1257" + }, + "radio_1": { + "enable": true, + "freq": 866385000, + "rssi_offset": -162, + "tx_enable": false, + "type": "SX1257" + }, + "tx_lut_0":{"dig_gain":0,"mix_gain":12,"pa_gain":1,"rf_power":10}, + "tx_lut_1":{"dig_gain":3,"mix_gain":11,"pa_gain":2,"rf_power":11}, + "tx_lut_2":{"dig_gain":0,"mix_gain":14,"pa_gain":1,"rf_power":12}, + "tx_lut_3":{"dig_gain":0,"mix_gain":9,"pa_gain":2,"rf_power":13}, + "tx_lut_4":{"dig_gain":2,"mix_gain":11,"pa_gain":2,"rf_power":14}, + "tx_lut_5":{"dig_gain":3,"mix_gain":8,"pa_gain":3,"rf_power":15}, + "tx_lut_6":{"dig_gain":0,"mix_gain":11,"pa_gain":2,"rf_power":16}, + "tx_lut_7":{"dig_gain":3,"mix_gain":9,"pa_gain":3,"rf_power":17}, + "tx_lut_8":{"dig_gain":1,"mix_gain":8,"pa_gain":3,"rf_power":20}, + "tx_lut_9":{"dig_gain":0,"mix_gain":8,"pa_gain":3,"rf_power":21}, + "tx_lut_10":{"dig_gain":2,"mix_gain":10,"pa_gain":3,"rf_power":23}, + "tx_lut_11":{"dig_gain":1,"mix_gain":10,"pa_gain":3,"rf_power":24}, + "tx_lut_12":{"dig_gain":0,"mix_gain":10,"pa_gain":3,"rf_power":25}, + "tx_lut_13":{"dig_gain":2,"mix_gain":12,"pa_gain":3,"rf_power":26}, + "tx_lut_14":{"dig_gain":0,"mix_gain":13,"pa_gain":3,"rf_power":28}, + "tx_lut_15":{"dig_gain":0,"mix_gain":15,"pa_gain":3,"rf_power":29} + }, + "gateway_conf": { + "gateway_ID": "<WILL-BE-AUTO-REPLACED-WITH-LORA-EUI>", + "server_address": "52.3.215.147", + "serv_port_up": 20000, + "serv_port_down": 20000, + "keepalive_interval": 10, + "stat_interval": 30, + "push_timeout_ms": 100, + "forward_crc_valid": true, + "forward_crc_error": true, + "forward_crc_disabled": false, + "synch_word": 52, + "autoquit_threshold": 60 + } +} + + diff --git a/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.KR920-LBT b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.KR920-LBT new file mode 100644 index 0000000..397f7f7 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.KR920-LBT @@ -0,0 +1,148 @@ +{ + "SX1301_conf": { + "antenna_gain": 0, + "chan_FSK": { + "bandwidth": 125000, + "datarate": 50000, + "enable": false, + "if": 300000, + "radio": 0 + }, + "chan_Lora_std": { + "bandwidth": 250000, + "enable": false, + "if": -200000, + "radio": 0, + "spread_factor": 7 + }, + "chan_multiSF_0": { + "enable": true, + "if": -400000, + "radio": 0 + }, + "chan_multiSF_1": { + "enable": true, + "if": -200000, + "radio": 0 + }, + "chan_multiSF_2": { + "enable": true, + "if": 0, + "radio": 0 + }, + "chan_multiSF_3": { + "enable": true, + "if": -400000, + "radio": 1 + }, + "chan_multiSF_4": { + "enable": true, + "if": -200000, + "radio": 1 + }, + "chan_multiSF_5": { + "enable": true, + "if": 0, + "radio": 1 + }, + "chan_multiSF_6": { + "enable": true, + "if": 200000, + "radio": 1 + }, + "chan_multiSF_7": { + "enable": true, + "if": 400000, + "radio": 1 + }, + "clksrc": 0, + "lbt_cfg": { + "chan_cfg": [ + { + "freq_hz": 922100000, + "scan_time_us": 5000 + }, + { + "freq_hz": 922300000, + "scan_time_us": 5000 + }, + { + "freq_hz": 922500000, + "scan_time_us": 5000 + }, + { + "freq_hz": 922700000, + "scan_time_us": 5000 + }, + { + "freq_hz": 922900000, + "scan_time_us": 5000 + }, + { + "freq_hz": 923100000, + "scan_time_us": 5000 + }, + { + "freq_hz": 923300000, + "scan_time_us": 5000 + }, + { + "freq_hz": 921900000, + "scan_time_us": 5000 + } + ], + "enable": true, + "rssi_target": -65, + "sx127x_rssi_offset": -4 + }, + "lorawan_public": true, + "radio_0": { + "enable": true, + "freq": 922500000, + "rssi_offset": -162, + "tx_enable": true, + "tx_freq_max": 923300000, + "tx_freq_min": 920900000, + "type": "SX1257" + }, + "radio_1": { + "enable": true, + "freq": 922900000, + "rssi_offset": -162, + "tx_enable": false, + "type": "SX1257" + }, + "tx_lut_0":{"dig_gain":0,"mix_gain":12,"pa_gain":1,"rf_power":10}, + "tx_lut_1":{"dig_gain":3,"mix_gain":11,"pa_gain":2,"rf_power":11}, + "tx_lut_2":{"dig_gain":0,"mix_gain":14,"pa_gain":1,"rf_power":12}, + "tx_lut_3":{"dig_gain":0,"mix_gain":9,"pa_gain":2,"rf_power":13}, + "tx_lut_4":{"dig_gain":2,"mix_gain":11,"pa_gain":2,"rf_power":14}, + "tx_lut_5":{"dig_gain":3,"mix_gain":8,"pa_gain":3,"rf_power":15}, + "tx_lut_6":{"dig_gain":0,"mix_gain":11,"pa_gain":2,"rf_power":16}, + "tx_lut_7":{"dig_gain":3,"mix_gain":9,"pa_gain":3,"rf_power":17}, + "tx_lut_8":{"dig_gain":1,"mix_gain":8,"pa_gain":3,"rf_power":20}, + "tx_lut_9":{"dig_gain":0,"mix_gain":8,"pa_gain":3,"rf_power":21}, + "tx_lut_10":{"dig_gain":2,"mix_gain":10,"pa_gain":3,"rf_power":23}, + "tx_lut_11":{"dig_gain":1,"mix_gain":10,"pa_gain":3,"rf_power":24}, + "tx_lut_12":{"dig_gain":0,"mix_gain":10,"pa_gain":3,"rf_power":25}, + "tx_lut_13":{"dig_gain":2,"mix_gain":12,"pa_gain":3,"rf_power":26}, + "tx_lut_14":{"dig_gain":0,"mix_gain":13,"pa_gain":3,"rf_power":28}, + "tx_lut_15":{"dig_gain":0,"mix_gain":15,"pa_gain":3,"rf_power":29} + }, + "gateway_conf": { + "gateway_ID": "<WILL-BE-AUTO-REPLACED-WITH-LORA-EUI>", + "server_address": "52.3.215.147", + "serv_port_up": 20000, + "serv_port_down": 20000, + "keepalive_interval": 10, + "stat_interval": 30, + "push_timeout_ms": 100, + "forward_crc_valid": true, + "forward_crc_error": true, + "forward_crc_disabled": false, + "synch_word": 52, + "autoquit_threshold": 60 + } +} + + diff --git a/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.RU864 b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.RU864 new file mode 100644 index 0000000..0bdf557 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.RU864 @@ -0,0 +1,118 @@ +{ + "SX1301_conf": { + "lorawan_public": true, + "clksrc": 0, + "lbt_cfg": { + "enable": false, + "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": 0, + "radio_0": { + "enable": true, + "type": "SX1257", + "freq": 869100000, + "rssi_offset": -162, + "tx_enable": true, + "tx_freq_min": 864000000, + "tx_freq_max": 870000000 + }, + "radio_1": { + "enable": true, + "type": "SX1257", + "freq": 868100000, + "rssi_offset": -162, + "tx_enable": false + }, + "chan_multiSF_0": { + "enable": true, + "radio": 0, + "if": -400000 + }, + "chan_multiSF_1": { + "enable": true, + "radio": 0, + "if": -200000 + }, + "chan_multiSF_2": { + "enable": true, + "radio": 0, + "if": 0 + }, + "chan_multiSF_3": { + "enable": true, + "radio": 1, + "if": -400000 + }, + "chan_multiSF_4": { + "enable": true, + "radio": 1, + "if": -200000 + }, + "chan_multiSF_5": { + "enable": true, + "radio": 1, + "if": 0 + }, + "chan_multiSF_6": { + "enable": true, + "radio": 1, + "if": 200000 + }, + "chan_multiSF_7": { + "enable": true, + "radio": 1, + "if": 400000 + }, + "chan_Lora_std": { + "enable": true, + "radio": 0, + "if": -200000, + "bandwidth": 250000, + "spread_factor": 7 + }, + "chan_FSK": { + "enable": true, + "radio": 1, + "if": 0, + "bandwidth": 125000, + "datarate": 50000 + }, + "tx_lut_0":{"dig_gain":0,"mix_gain":12,"pa_gain":1,"rf_power":10}, + "tx_lut_1":{"dig_gain":3,"mix_gain":11,"pa_gain":2,"rf_power":11}, + "tx_lut_2":{"dig_gain":0,"mix_gain":14,"pa_gain":1,"rf_power":12}, + "tx_lut_3":{"dig_gain":0,"mix_gain":9,"pa_gain":2,"rf_power":13}, + "tx_lut_4":{"dig_gain":2,"mix_gain":11,"pa_gain":2,"rf_power":14}, + "tx_lut_5":{"dig_gain":3,"mix_gain":8,"pa_gain":3,"rf_power":15}, + "tx_lut_6":{"dig_gain":0,"mix_gain":11,"pa_gain":2,"rf_power":16}, + "tx_lut_7":{"dig_gain":3,"mix_gain":9,"pa_gain":3,"rf_power":17}, + "tx_lut_8":{"dig_gain":1,"mix_gain":8,"pa_gain":3,"rf_power":20}, + "tx_lut_9":{"dig_gain":0,"mix_gain":8,"pa_gain":3,"rf_power":21}, + "tx_lut_10":{"dig_gain":2,"mix_gain":10,"pa_gain":3,"rf_power":23}, + "tx_lut_11":{"dig_gain":1,"mix_gain":10,"pa_gain":3,"rf_power":24}, + "tx_lut_12":{"dig_gain":0,"mix_gain":10,"pa_gain":3,"rf_power":25}, + "tx_lut_13":{"dig_gain":2,"mix_gain":12,"pa_gain":3,"rf_power":26}, + "tx_lut_14":{"dig_gain":0,"mix_gain":13,"pa_gain":3,"rf_power":28}, + "tx_lut_15":{"dig_gain":0,"mix_gain":15,"pa_gain":3,"rf_power":29} + }, + "gateway_conf": { + "gateway_ID": "<WILL-BE-AUTO-REPLACED-WITH-LORA-EUI>", + "server_address": "52.3.215.147", + "serv_port_up": 20000, + "serv_port_down": 20000, + "keepalive_interval": 10, + "stat_interval": 30, + "push_timeout_ms": 100, + "forward_crc_valid": true, + "forward_crc_error": true, + "forward_crc_disabled": false, + "synch_word": 52, + "autoquit_threshold": 60 + } +} + + diff --git a/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.US915 b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.US915 new file mode 100644 index 0000000..223cc64 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/global_conf.json.MTCAP2-LORA-1.5.US915 @@ -0,0 +1,131 @@ +{ + "SX1301_conf": { +"antenna_gain" : 0, + "chan_FSK" : + { + "bandwidth" : 125000, + "datarate" : 50000, + "enable" : false, + "if" : 300000, + "radio" : 0 + }, + "chan_Lora_std" : + { + "bandwidth" : 500000, + "enable" : true, + "if" : 300000, + "radio" : 0, + "spread_factor" : 8 + }, + "chan_multiSF_0" : + { + "enable" : true, + "if" : -400000, + "radio" : 0 + }, + "chan_multiSF_1" : + { + "enable" : true, + "if" : -200000, + "radio" : 0 + }, + "chan_multiSF_2" : + { + "enable" : true, + "if" : 0, + "radio" : 0 + }, + "chan_multiSF_3" : + { + "enable" : true, + "if" : 200000, + "radio" : 0 + }, + "chan_multiSF_4" : + { + "enable" : true, + "if" : -400000, + "radio" : 1 + }, + "chan_multiSF_5" : + { + "enable" : true, + "if" : -200000, + "radio" : 1 + }, + "chan_multiSF_6" : + { + "enable" : true, + "if" : 0, + "radio" : 1 + }, + "chan_multiSF_7" : + { + "enable" : true, + "if" : 200000, + "radio" : 1 + }, + "clksrc" : 0, + "lbt_cfg" : + { + "enable" : false, + "nb_channel" : 1, + "rssi_target" : 160, + "scan_time_us" : 5000, + "start_freq" : 869525000, + "tx_delay_1ch_us" : 4000000, + "tx_delay_2ch_us" : 4000000 + }, + "lorawan_public" : true, + "radio_0" : + { + "enable" : true, + "freq" : 902700000, + "rssi_offset" : -162, + "tx_enable" : true, + "tx_freq_max" : 928000000, + "tx_freq_min" : 902000000, + "type" : "SX1257" + }, + "radio_1" : + { + "enable" : true, + "freq" : 903500000, + "rssi_offset" : -162, + "tx_enable" : false, + "type" : "SX1257" + }, + "tx_lut_0":{"dig_gain":0,"mix_gain":12,"pa_gain":1,"rf_power":10}, + "tx_lut_1":{"dig_gain":3,"mix_gain":11,"pa_gain":2,"rf_power":11}, + "tx_lut_2":{"dig_gain":0,"mix_gain":14,"pa_gain":1,"rf_power":12}, + "tx_lut_3":{"dig_gain":0,"mix_gain":9,"pa_gain":2,"rf_power":13}, + "tx_lut_4":{"dig_gain":2,"mix_gain":11,"pa_gain":2,"rf_power":14}, + "tx_lut_5":{"dig_gain":3,"mix_gain":8,"pa_gain":3,"rf_power":15}, + "tx_lut_6":{"dig_gain":0,"mix_gain":11,"pa_gain":2,"rf_power":16}, + "tx_lut_7":{"dig_gain":3,"mix_gain":9,"pa_gain":3,"rf_power":17}, + "tx_lut_8":{"dig_gain":1,"mix_gain":8,"pa_gain":3,"rf_power":20}, + "tx_lut_9":{"dig_gain":0,"mix_gain":8,"pa_gain":3,"rf_power":21}, + "tx_lut_10":{"dig_gain":2,"mix_gain":10,"pa_gain":3,"rf_power":23}, + "tx_lut_11":{"dig_gain":1,"mix_gain":10,"pa_gain":3,"rf_power":24}, + "tx_lut_12":{"dig_gain":0,"mix_gain":10,"pa_gain":3,"rf_power":25}, + "tx_lut_13":{"dig_gain":2,"mix_gain":12,"pa_gain":3,"rf_power":26}, + "tx_lut_14":{"dig_gain":0,"mix_gain":13,"pa_gain":3,"rf_power":28}, + "tx_lut_15":{"dig_gain":0,"mix_gain":15,"pa_gain":3,"rf_power":29} + }, + "gateway_conf": { + "gateway_ID": "<WILL-BE-AUTO-REPLACED-WITH-LORA-EUI>", + "server_address": "52.3.215.147", + "serv_port_up": 20000, + "serv_port_down": 20000, + "keepalive_interval": 10, + "stat_interval": 30, + "push_timeout_ms": 100, + "forward_crc_valid": true, + "forward_crc_error": true, + "forward_crc_disabled": false, + "synch_word": 52, + "autoquit_threshold": 60 + } +} + + diff --git a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.init b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.init index 99463f6..c514e18 100755 --- a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.init +++ b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.init @@ -12,11 +12,17 @@ opt_conf_dir=/opt/lora conf_dir=/var/config/lora conf_file=$conf_dir/global_conf.json conf_file_local=$conf_dir/local_conf.json +conf_file_2=$conf_dir/global_conf_2.json +conf_file_local_2=$conf_dir/local_conf_2.json pkt_fwd=$run_dir/1/lora_pkt_fwd pkt_fwd_log=/var/log/lora-pkt-fwd-1.log pkt_fwd_pidfile=$run_dir/lora-pkt-fwd-1.pid +pkt_fwd_2=$run_dir/2/lora_pkt_fwd +pkt_fwd_2_log=/var/log/lora-pkt-fwd-2.log +pkt_fwd_2_pidfile=$run_dir/lora-pkt-fwd-2.pid + port1=/sys/devices/platform/mts-io/ap1 port2=/sys/devices/platform/mts-io/ap2 @@ -30,11 +36,23 @@ lora_mtac_id915="MTAC-LORA-915" lora_mtac_id868="MTAC-LORA-868" lora_mtac_h_id915="MTAC-LORA-H-915" lora_mtac_h_id868="MTAC-LORA-H-868" +mtac_spi_device="/dev/spidev0.0" +mtac_spi_device_2="spidev32765.2" + +# spidev32765.2 spidev32766.2 lora_mtcap_id="MTCAP-LORA" lora_mtcap_id868="MTCAP-LORA-868" lora_mtcap_id915="MTCAP-LORA-915" +mtcdt3_id="MTCDT3" +lora_mtcdt3_id="MTCDT3-LORA" +lora_mtcdt3_id868="MTCDT3-LORA-868" +lora_mtcdt3_id915="MTCDT3-LORA-915" +mtcdt3_spi_device="/dev/spidev0.0" +mtcdt3_spi_device_2="/dev/spidev1.0" + + lora_mtac_g_id="MTAC-LORA-G" lora_mtac_g16_id868="MTAC-LORA-G16-868" lora_mtac_g16_id915="MTAC-LORA-G16-915" @@ -46,14 +64,32 @@ pkt_fwd_options="" gps_path="/dev/gps0" read_lora_hw_info() { + hw_id=$(mts-io-sysfs show product-id 2> /dev/null) + + # product-id of first lora card lora_id=$(mts-io-sysfs show lora/product-id 2> /dev/null) - lora_hw=$(mts-io-sysfs show lora/hw-version 2> /dev/null) lora_eui=$(mts-io-sysfs show lora/eui 2> /dev/null) - lora_eui_raw=${lora_eui//:/} + # remove all colons + lora_eui_raw=${lora_eui//:} + lora_hw=$(mts-io-sysfs show lora/hw-version 2> /dev/null) + if [ -d $port2 ] && [[ $(cat $port2/hw-version) =~ "LORA-1.5" ]]; then + # product-id of first lora card + lora_2_id=$(mts-io-sysfs show lora-2/product-id 2> /dev/null) + lora_2_hw=$(mts-io-sysfs show lora-2/hw-version 2> /dev/null) + lora_2_eui=$(mts-io-sysfs show lora-2/eui 2> /dev/null) + # remove all colons + lora_2_eui_raw=${lora_2_eui//:} + fi + + if [ -d $port1 ] && [[ $(cat $port1/hw-version) =~ "LORA-1.5" ]] && [ -d $port2 ] && [[ $(cat $port2/hw-version) =~ "LORA-1.5" ]]; then + dual_cards_installed=true + fi } hardware_found() { - if [[ "$lora_id" =~ "$lora_mtac_g_id" ]]; then + if [[ "$hw_id" =~ "$mtcdt3_id" ]]; then + setup_mtcdt3 + elif [[ "$lora_id" =~ "$lora_mtac_g_id" ]]; then setup_mtcdt_2_1 elif [[ "$lora_id" =~ "$lora_mtcap_id" ]]; then setup_mtcap @@ -65,6 +101,45 @@ hardware_found() { return 0 } +setup_mtcdt3() { + dual_cards_installed=true + ln -sf /opt/lora/lora_pkt_fwd $pkt_fwd + ln -sf /opt/lora/lora_pkt_fwd $pkt_fwd_2 + + lora_eui=$(mts-io-sysfs show lora/eui) + lora_2_eui=$(mts-io-sysfs show lora-2/eui) + lora_eui_raw=${lora_eui//:} + lora_2_eui_raw=${lora_2_eui//:} + + lora_id=$(mts-io-sysfs show lora/product-id) + lora_2_id=$(mts-io-sysfs show lora-2/product-id) + + lora_hw=$(mts-io-sysfs show lora/hw-version) + lora_2_hw=$(mts-io-sysfs show lora-2/hw-version) + + GLOBAL_CONF=/opt/lora/global_conf.json.MTAC_LORA_1_5.US915 + + if [[ "$lora_id" =~ "868" ]]; then + GLOBAL_CONF=/opt/lora/global_conf.json.MTAC_LORA_1_5.EU868 + fi + + ln -sf /opt/lora/lora_pkt_fwd $pkt_fwd + ln -sf /opt/lora/lora_pkt_fwd $pkt_fwd_2 + + opt_conf_file=$opt_conf_dir/global_conf.json + opt_conf_file_local=$opt_conf_dir/local_conf.json + + cp $GLOBAL_CONF $opt_conf_file + + if ! [ -f $conf_file ]; then + mkdir -p /var/config/lora/ + cp $opt_conf_file $conf_file + cp $opt_conf_file_local $conf_file_local + cp $opt_conf_file $conf_file_2 + cp $opt_conf_file_local $conf_file_local_2 + fi +} + setup_mtcdt() { if [ -d $port1 ] && [[ $(cat $port1/hw-version) = $lora_hw ]]; then ln -sf /dev/spidev32766.2 /dev/spidev0.0 @@ -74,9 +149,9 @@ setup_mtcdt() { if [ "$lora_hw" = "$lora_1_0_hw" ] && [[ ! "$lora_id" =~ .*-SPI ]]; then if [ "$lora_id" = "$lora_mtac_id868" ]; then - GLOBAL_CONF=/opt/lora/global_conf.json.MTCDT_LORA_1_0.EU868 + GLOBAL_CONF=/opt/lora/global_conf.json.MTAC_LORA_1_0.EU868 elif [ "$lora_id" = "$lora_mtac_id915" ]; then - GLOBAL_CONF=/opt/lora/global_conf.json.MTCDT_LORA_1_0.US915 + GLOBAL_CONF=/opt/lora/global_conf.json.MTAC_LORA_1_0.US915 else echo "No valid configuration found for mtcdt exiting." exit 1 @@ -84,14 +159,15 @@ setup_mtcdt() { ln -sf /opt/lora/basic_pkt_fwd-usb $pkt_fwd else if [ "$lora_id" = "$lora_mtac_h_id868" ]; then - GLOBAL_CONF=/opt/lora/global_conf.json.MTCDT_LORA_1_5.EU868 + GLOBAL_CONF=/opt/lora/global_conf.json.MTAC_LORA_1_5.EU868 elif [ "$lora_id" = "$lora_mtac_h_id915" ]; then - GLOBAL_CONF=/opt/lora/global_conf.json.MTCDT_LORA_1_5.US915 + GLOBAL_CONF=/opt/lora/global_conf.json.MTAC_LORA_1_5.US915 else echo "No valid configuration found for mtcdt exiting." exit 1 fi ln -sf /opt/lora/lora_pkt_fwd $pkt_fwd + ln -sf /opt/lora/lora_pkt_fwd $pkt_fwd_2 fi opt_conf_file=$opt_conf_dir/global_conf.json @@ -103,17 +179,28 @@ setup_mtcdt() { mkdir -p /var/config/lora/ cp $opt_conf_file $conf_file cp $opt_conf_file_local $conf_file_local + cp $opt_conf_file $conf_file_2 + cp $opt_conf_file_local $conf_file_local_2 fi } setup_mtcap() { + hw=$(mts-io-sysfs show hw-version 2> /dev/null) + if [ "$lora_id" = "$lora_mtcap_id868" ]; then - GLOBAL_CONF=/opt/lora/global_conf.json.MTCAP_LORA_1_5.EU868 + if [ "$hw" = "MTCAP-0.2" ]; then + GLOBAL_CONF=/opt/lora/global_conf.json.MTCAP2_LORA_1_5.EU868 + else + GLOBAL_CONF=/opt/lora/global_conf.json.MTCAP_LORA_1_5.EU868 + fi elif [ "$lora_id" = "$lora_mtcap_id915" ]; then - GLOBAL_CONF=/opt/lora/global_conf.json.MTCAP_LORA_1_5.US915 + if [ "$hw" = "MTCAP-0.2" ]; then + GLOBAL_CONF=/opt/lora/global_conf.json.MTCAP2_LORA_1_5.US915 + else + GLOBAL_CONF=/opt/lora/global_conf.json.MTCAP_LORA_1_5.US915 + fi else - echo "No valid configuration found for mtcap exiting." - exit 1 + return 1 fi opt_conf_file=$opt_conf_dir/global_conf.json @@ -164,10 +251,38 @@ do_start() { mkdir -p $run_dir/1 rm -rf $run_dir/1/* + mkdir -p $run_dir/2 + rm -rf $run_dir/2/* + read_lora_hw_info if hardware_found; then echo "Found $lora_id with $lora_hw hardware. Configuring" + + if [[ "$hw_id" =~ "$mtcdt3_id" ]]; then + mts-io-sysfs store lora/reset 0 + mts-io-sysfs store lora-2/reset 0 + sleep 0.25 + mts-io-sysfs store lora/reset 1 + mts-io-sysfs store lora-2/reset 1 + sleep 0.25 + elif [[ "$lora_id" =~ "$lora_mtac_g_id" ]]; then + echo Resetting 2.1 LoRa + /usr/sbin/mts-util-lora2-reset -g -f >/dev/null 2>&1 + sleep 0.25 + else + mts-io-sysfs store lora/reset 0 + if [ "$dual_cards_installed" == true ]; then + mts-io-sysfs store lora-2/reset 0 + fi + sleep 0.25 + mts-io-sysfs store lora/reset 1 + if [ "$dual_cards_installed" == true ]; then + mts-io-sysfs store lora-2/reset 1 + fi + sleep 0.25 + fi + else echo "$0: LORA card not detected" exit 1 @@ -189,15 +304,34 @@ do_start() { sed -i.bak "s/\(.*gateway_ID\"\s*\:\s*\"\)<.*>[^\"]*\(.*\)/\1${lora_eui_raw}\2/g" /var/run/lora/1/global_conf.json + if [ "$dual_cards_installed" == "true" ]; then + cp $conf_file_2 $run_dir/2/global_conf.json + if [ -f $conf_file_local_2 ]; then + cp $conf_file_local_2 $run_dir/2/local_conf.json + sed -i.bak "s/\(.*gateway_ID\"\s*\:\s*\"\)<.*>[^\"]*\(.*\)/\1${lora_2_eui_raw}\2/g" /var/run/lora/2/local_conf.json + fi + + sed -i.bak "s/\(.*gateway_ID\"\s*\:\s*\"\)<.*>[^\"]*\(.*\)/\1${lora_2_eui_raw}\2/g" /var/run/lora/2/global_conf.json + fi + # # start packet forwarder # echo -n "Starting $NAME: " /usr/sbin/start-stop-daemon --chdir $run_dir/1 --background --start --make-pidfile \ - --pidfile $pkt_fwd_pidfile --startas /bin/bash -- -c "exec $pkt_fwd $pkt_fwd_options" + --pidfile $pkt_fwd_pidfile --startas /bin/bash -- -c "exec $pkt_fwd $pkt_fwd_options -l $pkt_fwd_log" + - renice -n -20 -p $(pgrep $(basename $pkt_fwd)) + if [ "$dual_cards_installed" == "true" ]; then + /usr/sbin/start-stop-daemon --chdir $run_dir/2 --start --background --make-pidfile \ + --pidfile $pkt_fwd_2_pidfile --startas /bin/bash \ + -- -c "exec $pkt_fwd_2 $pkt_fwd_options -l $pkt_fwd_2_log" + fi + + if [[ ! "$hw_id" =~ "$mtcdt3_id" ]]; then + renice -n -20 -p $(pgrep $(basename $pkt_fwd)) + fi echo "OK" } @@ -206,6 +340,7 @@ do_start() { do_stop() { echo -n "Stopping $NAME: " start-stop-daemon --stop --quiet --oknodo --pidfile $pkt_fwd_pidfile --retry 5 + start-stop-daemon --stop --quiet --oknodo --pidfile $pkt_fwd_2_pidfile --retry 5 rm -f $pkt_fwd_pidfile echo "OK" } diff --git a/recipes-connectivity/lora/lora-packet-forwarder/mtcdt3/lora-packet-forwarder.default b/recipes-connectivity/lora/lora-packet-forwarder/mtcdt3/lora-packet-forwarder.default new file mode 100644 index 0000000..0f92640 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/mtcdt3/lora-packet-forwarder.default @@ -0,0 +1,2 @@ +# set to "yes" or "no" to control starting on boot +ENABLED="no" 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 ca061da..2a44df4 100644 --- a/recipes-connectivity/lora/lora-packet-forwarder_4.0.1.bb +++ b/recipes-connectivity/lora/lora-packet-forwarder_4.0.1.bb @@ -5,13 +5,15 @@ SECTION = "console/utils" # Semtech license is a modified BSD-style license LICENSE = "Proprietary" LIC_FILES_CHKSUM = "file://LICENSE;md5=22af7693d7b76ef0fc76161c4be76c45" -DEPENDS = "lora-gateway logrotate lora-logging" +DEPENDS = "lora-gateway logrotate lora-logging gpsd" RDEPENDS_${PN} += "bash" -PR = "r19" +FILESEXTRAPATHS_append_mtcdt3hs := ":${THISDIR}/lora-packet-forwarder/mtcdt3" +PR = "r23" +SRCREV = "28b9dff2eb06fb88421cf32771d380a178079fce" +PACKAGE_ARCH = "${MACHINE_ARCH}" -SRCREV = "v${PV}" -SRC_URI = "git://github.com/Lora-net/packet_forwarder.git;protocol=git \ +SRC_URI = "git://git@gitlab.multitech.net/lora_enterprise/packet_forwarder_mtac_full.git;protocol=ssh;branch=master \ file://README.md \ file://lora-packet-forwarder.init \ file://lora-packet-forwarder.default \ @@ -34,18 +36,22 @@ SRC_URI = "git://github.com/Lora-net/packet_forwarder.git;protocol=git \ file://global_conf.json.3.1.0.MTCAP-LORA-1-5.IN865.basic \ file://global_conf.json.3.1.0.MTCAP-LORA-1-5.KR920-LBT.basic \ file://global_conf.json.3.1.0.MTCAP-LORA-1-5.RU864.basic \ + file://global_conf.json.MTCAP2-LORA-1.5.AS923 \ + file://global_conf.json.MTCAP2-LORA-1.5.AS923-LBT \ + file://global_conf.json.MTCAP2-LORA-1.5.AU915 \ + file://global_conf.json.MTCAP2-LORA-1.5.EU868 \ + file://global_conf.json.MTCAP2-LORA-1.5.IN865 \ + file://global_conf.json.MTCAP2-LORA-1.5.KR920-LBT \ + file://global_conf.json.MTCAP2-LORA-1.5.RU864 \ + file://global_conf.json.MTCAP2-LORA-1.5.US915 \ file://local_conf.json \ - file://lora-packet-forwarder-add-spi-dev-path.patch \ - file://lora-packet-forwarder-remove-jit-power-check.patch \ - 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 \ " S = "${WORKDIR}/git" B = "${S}" +TARGET_CC_ARCH += "${LDFLAGS}" + LORA_DIR = "/opt/lora" @@ -100,8 +106,50 @@ do_install_append_mtcap() { install -m 755 ${WORKDIR}/global_conf.json.3.1.0.MTCAP-LORA-1-5.AS923-LBT.basic ${D}${LORA_DIR}/global_conf.json.MTCAP_LORA_1_5.AS923-LBT install -m 755 ${WORKDIR}/global_conf.json.3.1.0.MTCAP-LORA-1-5.KR920-LBT.basic ${D}${LORA_DIR}/global_conf.json.MTCAP_LORA_1_5.KR920-LBT install -m 755 ${WORKDIR}/global_conf.json.3.1.0.MTCAP-LORA-1-5.IN865.basic ${D}${LORA_DIR}/global_conf.json.MTCAP_LORA_1_5.IN865 + + install -m 755 ${WORKDIR}/global_conf.json.MTCAP2-LORA-1.5.EU868 ${D}${LORA_DIR}/global_conf.json.MTCAP2_LORA_1_5.EU868 + install -m 755 ${WORKDIR}/global_conf.json.MTCAP2-LORA-1.5.RU864 ${D}${LORA_DIR}/global_conf.json.MTCAP2_LORA_1_5.RU864 + install -m 755 ${WORKDIR}/global_conf.json.MTCAP2-LORA-1.5.US915 ${D}${LORA_DIR}/global_conf.json.MTCAP2_LORA_1_5.US915 + install -m 755 ${WORKDIR}/global_conf.json.MTCAP2-LORA-1.5.AU915 ${D}${LORA_DIR}/global_conf.json.MTCAP2_LORA_1_5.AU915 + install -m 755 ${WORKDIR}/global_conf.json.MTCAP2-LORA-1.5.AS923 ${D}${LORA_DIR}/global_conf.json.MTCAP2_LORA_1_5.AS923 + install -m 755 ${WORKDIR}/global_conf.json.MTCAP2-LORA-1.5.AS923-LBT ${D}${LORA_DIR}/global_conf.json.MTCAP2_LORA_1_5.AS923-LBT + install -m 755 ${WORKDIR}/global_conf.json.MTCAP2-LORA-1.5.KR920-LBT ${D}${LORA_DIR}/global_conf.json.MTCAP2_LORA_1_5.KR920-LBT + install -m 755 ${WORKDIR}/global_conf.json.MTCAP2-LORA-1.5.IN865 ${D}${LORA_DIR}/global_conf.json.MTCAP2_LORA_1_5.IN865 +} + +do_install_append_mtcdt3() { + 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 -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.EU868 + 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.EU868 + install -m 755 ${WORKDIR}/global_conf.json.3.0.0.MTAC_LORA_1_5.RU864.basic.clksrc0 ${D}${LORA_DIR}/global_conf.json.MTAC_LORA_1_5.RU864 + install -m 755 ${WORKDIR}/global_conf.json.3.0.0.MTAC_LORA_1_0.US915.basic.clksrc0 ${D}${LORA_DIR}/global_conf.json.MTAC_LORA_1_0.US915 + install -m 755 ${WORKDIR}/global_conf.json.3.0.0.MTAC_LORA_1_5.US915.basic.clksrc0 ${D}${LORA_DIR}/global_conf.json.MTAC_LORA_1_5.US915 + install -m 755 ${WORKDIR}/global_conf.json.3.0.0.MTAC_LORA_1_5.AU915.basic.clksrc0 ${D}${LORA_DIR}/global_conf.json.MTAC_LORA_1_5.AU915 + install -m 755 ${WORKDIR}/global_conf.json.3.0.0.MTAC_LORA_1_5.AS923.basic.clksrc0 ${D}${LORA_DIR}/global_conf.json.MTAC_LORA_1_5.AS923 + install -m 755 ${WORKDIR}/global_conf.json.3.0.0.MTAC_LORA_1_5.AS923-LBT.basic.clksrc0 ${D}${LORA_DIR}/global_conf.json.MTAC_LORA_1_5.AS923-LBT + install -m 755 ${WORKDIR}/global_conf.json.3.0.0.MTAC_LORA_1_5.KR920-LBT.basic.clksrc0 ${D}${LORA_DIR}/global_conf.json.MTAC_LORA_1_5.KR920-LBT + install -m 755 ${WORKDIR}/global_conf.json.3.0.0.MTAC_LORA_1_5.IN865.basic.clksrc0 ${D}${LORA_DIR}/global_conf.json.MTAC_LORA_1_5.IN865 } +do_install_append_mtcdt3hs() { + 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 -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.EU868 + 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.EU868 + install -m 755 ${WORKDIR}/global_conf.json.3.0.0.MTAC_LORA_1_5.RU864.basic.clksrc0 ${D}${LORA_DIR}/global_conf.json.MTAC_LORA_1_5.RU864 + install -m 755 ${WORKDIR}/global_conf.json.3.0.0.MTAC_LORA_1_0.US915.basic.clksrc0 ${D}${LORA_DIR}/global_conf.json.MTAC_LORA_1_0.US915 + install -m 755 ${WORKDIR}/global_conf.json.3.0.0.MTAC_LORA_1_5.US915.basic.clksrc0 ${D}${LORA_DIR}/global_conf.json.MTAC_LORA_1_5.US915 + install -m 755 ${WORKDIR}/global_conf.json.3.0.0.MTAC_LORA_1_5.AU915.basic.clksrc0 ${D}${LORA_DIR}/global_conf.json.MTAC_LORA_1_5.AU915 + install -m 755 ${WORKDIR}/global_conf.json.3.0.0.MTAC_LORA_1_5.AS923.basic.clksrc0 ${D}${LORA_DIR}/global_conf.json.MTAC_LORA_1_5.AS923 + install -m 755 ${WORKDIR}/global_conf.json.3.0.0.MTAC_LORA_1_5.AS923-LBT.basic.clksrc0 ${D}${LORA_DIR}/global_conf.json.MTAC_LORA_1_5.AS923-LBT + install -m 755 ${WORKDIR}/global_conf.json.3.0.0.MTAC_LORA_1_5.KR920-LBT.basic.clksrc0 ${D}${LORA_DIR}/global_conf.json.MTAC_LORA_1_5.KR920-LBT + install -m 755 ${WORKDIR}/global_conf.json.3.0.0.MTAC_LORA_1_5.IN865.basic.clksrc0 ${D}${LORA_DIR}/global_conf.json.MTAC_LORA_1_5.IN865 +} + + FILES_${PN} += "${LORA_DIR}" FILES_${PN}-dbg += "${LORA_DIR}/.debug ${LORA_DIR}/forwarder-utils/.debug" diff --git a/recipes-connectivity/lora/lora-query/Makefile b/recipes-connectivity/lora/lora-query/Makefile new file mode 100644 index 0000000..2079a0d --- /dev/null +++ b/recipes-connectivity/lora/lora-query/Makefile @@ -0,0 +1,75 @@ + +includedir ?= /usr/include +libdir ?= /usr/lib + +CFLAGS += + +LIBS := -lmts -ljsoncpp -lpthread + +OBJS += \ +Version.o \ +main.o + +CPP_DEPS += \ +Version.d \ +main.d + + +all: postbuild + +prebuild: + @echo PRE-BUILD + @echo 'Removing previous version components started' + -$(RM) Version.o + -$(RM) Version.d + -$(RM) Version.cpp + @echo 'Removing previous version components complete' + @echo ' ' + +postbuild: mainbuild + @echo POST-BUILD + @echo ' ' + +mainbuild: prebuild + @echo MAIN-BUILD + @$(MAKE) --no-print-directory target + +target: $(OBJS) + @echo 'Building target: $@' + $(CXX) $(CFLAGS) $(LDFLAGS) -o lora-query $(OBJS) $(LIBS) + @echo 'Finished building target: $@' + @echo ' ' + +Version.o: Version.cpp + @echo 'Building file: $<' + $(CXX) $(CFLAGS) -Iinclude -Wall -c -std=c++0x -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + +Version.cpp: + @echo 'Creating file: Version.cpp' + /bin/echo -e "//Pre-Build Auto-Generated Source\n#include \"Version.h\"\n\nconst std::string Version::version(\"$(shell git describe)\");" > Version.cpp + @echo 'Finished creating: Version.cpp' + @echo ' ' + +main.o: main.cpp + @echo 'Building file: $<' + $(CXX) $(CFLAGS) -I=$(includedir)/jsoncpp -Wall -c -std=c++0x -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + +install: + install -d $(DESTDIR)/usr/bin + install -m 0755 lora-query $(DESTDIR)/usr/bin + +strip: + $(STRIP) lora-query + +clean: + -$(RM) $(OBJS) $(CPP_DEPS) lora-query + -@echo ' ' + +.PHONY: all clean dependents install strip target +.SECONDARY: + + diff --git a/recipes-connectivity/lora/lora-query_1.0.4.bb b/recipes-connectivity/lora/lora-query_1.0.4.bb index 730266f..60bcc42 100644 --- a/recipes-connectivity/lora/lora-query_1.0.4.bb +++ b/recipes-connectivity/lora/lora-query_1.0.4.bb @@ -3,7 +3,8 @@ HOMEPAGE = "http://www.multitech.net/" LICENSE = "GPL-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=94d55d512a9ba36caa9b7df079bae19f" DEPENDS = "jsoncpp libmts" -PR = "r1" +RDEPENDS_${PN} += "jsoncpp" +PR = "r2" SRCREV = "${PV}" |