diff options
author | Jason Reiss <jreiss@multitech.com> | 2016-10-14 10:05:23 -0500 |
---|---|---|
committer | Brandon Bayer <bbayer@multitech.com> | 2016-10-18 16:37:18 -0500 |
commit | 8000c124387080ddf9cb8b64402eb93961a531a6 (patch) | |
tree | 16401d2af380562299fc1a6dc05dc62db78c7190 /recipes-connectivity/lora | |
parent | c0c3d4e1eac3943988e71e6fe8606be2c73ccb1d (diff) | |
download | meta-mlinux-8000c124387080ddf9cb8b64402eb93961a531a6.tar.gz meta-mlinux-8000c124387080ddf9cb8b64402eb93961a531a6.tar.bz2 meta-mlinux-8000c124387080ddf9cb8b64402eb93961a531a6.zip |
lora: move old usb packet forwarder and library utilities to new recipes
add spi device path option to packet forwarder and library
Diffstat (limited to 'recipes-connectivity/lora')
24 files changed, 372 insertions, 123 deletions
diff --git a/recipes-connectivity/lora/lora-gateway/library.cfg b/recipes-connectivity/lora/lora-gateway-usb/library.cfg index 01b066d..01b066d 100644 --- a/recipes-connectivity/lora/lora-gateway/library.cfg +++ b/recipes-connectivity/lora/lora-gateway-usb/library.cfg diff --git a/recipes-connectivity/lora/lora-gateway/lora-gateway-debug.patch b/recipes-connectivity/lora/lora-gateway-usb/lora-gateway-debug.patch index dba4392..dba4392 100644 --- a/recipes-connectivity/lora/lora-gateway/lora-gateway-debug.patch +++ b/recipes-connectivity/lora/lora-gateway-usb/lora-gateway-debug.patch diff --git a/recipes-connectivity/lora/lora-gateway/lora-gateway-sync-word.patch b/recipes-connectivity/lora/lora-gateway-usb/lora-gateway-sync-word.patch index e51e02a..e51e02a 100644 --- a/recipes-connectivity/lora/lora-gateway/lora-gateway-sync-word.patch +++ b/recipes-connectivity/lora/lora-gateway-usb/lora-gateway-sync-word.patch diff --git a/recipes-connectivity/lora/lora-gateway_1.7.0mts.bb b/recipes-connectivity/lora/lora-gateway-usb_1.7.0mts.bb index 13cffd8..64ad81f 100644 --- a/recipes-connectivity/lora/lora-gateway_1.7.0mts.bb +++ b/recipes-connectivity/lora/lora-gateway-usb_1.7.0mts.bb @@ -38,16 +38,16 @@ do_install() { install -m 0644 libloragw/inc/* ${D}${includedir}/lora install -d ${D}/opt/lora - install -m 0755 libloragw/test_* ${D}/opt/lora/ - install -m 0755 util_pkt_logger/util_pkt_logger ${D}/opt/lora/ - install -m 0755 util_band_survey/util_band_survey ${D}/opt/lora/ - install -m 0755 util_spi_stress/util_spi_stress ${D}/opt/lora/ - install -m 0755 util_tx_test/util_tx_test ${D}/opt/lora/ + install -d ${D}/opt/lora/gateway-utils-usb + install -m 0755 util_pkt_logger/util_pkt_logger ${D}/opt/lora/gateway-utils-usb/util_pkt_logger-usb + install -m 0755 util_band_survey/util_band_survey ${D}/opt/lora/gateway-utils-usb/util_band_survey-usb + install -m 0755 util_spi_stress/util_spi_stress ${D}/opt/lora/gateway-utils-usb/util_spi_stress-usb + install -m 0755 util_tx_test/util_tx_test ${D}/opt/lora/gateway-utils-usb/util_tx_test-usb } PACKAGES += "${PN}-utils ${PN}-utils-dbg" -FILES_${PN}-utils = "/opt/lora/*" +FILES_${PN}-utils = "/opt/lora/gateway-utils-usb/*" FILES_${PN}-utils-dbg = "/opt/lora/.debug" FILES_${PN}-dev = "${includedir}/lora ${libdir}/lora/library.cfg" FILES_${PN}-staticdev = "${libdir}/lora/libloragw.a" diff --git a/recipes-connectivity/lora/lora-gateway/library_4.0.cfg b/recipes-connectivity/lora/lora-gateway/library_4.0.cfg index d9d3055..641206f 100644 --- a/recipes-connectivity/lora/lora-gateway/library_4.0.cfg +++ b/recipes-connectivity/lora/lora-gateway/library_4.0.cfg @@ -5,8 +5,8 @@ # Warning: that makes the module *very verbose*, do not use for production DEBUG_AUX= 0 -DEBUG_SPI= 0 -DEBUG_REG= 0 +DEBUG_SPI= 0 +DEBUG_REG= 0 # jjg - turning this on is useful to get HAL-related error messages that # don't print out otherwise. It doesn't seem to add that much printing # under normal operation. diff --git a/recipes-connectivity/lora/lora-gateway/lora-gateway-add-spi-path-function.patch b/recipes-connectivity/lora/lora-gateway/lora-gateway-add-spi-path-function.patch new file mode 100644 index 0000000..fa5e68c --- /dev/null +++ b/recipes-connectivity/lora/lora-gateway/lora-gateway-add-spi-path-function.patch @@ -0,0 +1,57 @@ +diff --git a/libloragw/inc/loragw_spi.h b/libloragw/inc/loragw_spi.h +index fef1f48..74ef251 100644 +--- a/libloragw/inc/loragw_spi.h ++++ b/libloragw/inc/loragw_spi.h +@@ -46,6 +46,14 @@ Maintainer: Sylvain Miermont + /* -------------------------------------------------------------------------- */ + /* --- PUBLIC FUNCTIONS PROTOTYPES ------------------------------------------ */ + ++/* set SPI device */ ++/** ++@brief LoRa concentrator SPI path configuration for spidev ++@param path pointer to spidev device ++@return LGW_SPI_SUCCESS if path is valid, LGW_SPI_ERROR if not ++*/ ++int lgw_spi_set_path(const char *path); ++ + /** + @brief LoRa concentrator SPI setup (configure I/O and peripherals) + @param spi_target_ptr pointer on a generic pointer to SPI target (implementation dependant) +diff --git a/libloragw/src/loragw_spi.native.c b/libloragw/src/loragw_spi.native.c +index c01ed1c..3472133 100644 +--- a/libloragw/src/loragw_spi.native.c ++++ b/libloragw/src/loragw_spi.native.c +@@ -56,10 +56,24 @@ Maintainer: Sylvain Miermont + #define SPI_SPEED 8000000 + #define SPI_DEV_PATH "/dev/spidev0.0" + //#define SPI_DEV_PATH "/dev/spidev32766.0" ++char* spi_dev_path = SPI_DEV_PATH; + + /* -------------------------------------------------------------------------- */ + /* --- PUBLIC FUNCTIONS DEFINITION ------------------------------------------ */ + ++/* set SPI device */ ++int lgw_spi_set_path(const char *path) { ++ if (path) { ++ spi_dev_path = path; ++ return LGW_SPI_SUCCESS; ++ } ++ else { ++ return LGW_SPI_ERROR; ++ } ++} ++ ++ ++ + /* SPI initialization and configuration */ + int lgw_spi_open(void **spi_target_ptr) { + int *spi_device = NULL; +@@ -78,7 +92,7 @@ int lgw_spi_open(void **spi_target_ptr) { + } + + /* open SPI device */ +- dev = open(SPI_DEV_PATH, O_RDWR); ++ dev = open(spi_dev_path, O_RDWR); + if (dev < 0) { + DEBUG_PRINTF("ERROR: failed to open SPI device %s\n", SPI_DEV_PATH); + return LGW_SPI_ERROR; diff --git a/recipes-connectivity/lora/lora-gateway_4.0.1.bb b/recipes-connectivity/lora/lora-gateway_4.0.1.bb index 4c91642..b2c52cf 100644 --- a/recipes-connectivity/lora/lora-gateway_4.0.1.bb +++ b/recipes-connectivity/lora/lora-gateway_4.0.1.bb @@ -12,6 +12,7 @@ SRCREV = "v${PV}" SRC_URI = "git://github.com/Lora-net/lora_gateway.git;protocol=git \ file://lora-gateway-add-fpga-version-28.patch \ file://library_4.0.cfg \ + file://lora-gateway-add-spi-path-function.patch \ " SRC_URI[md5sum] = "9e06a3733a9fea39a3d61f77b412badf" 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 4b80dc7..7a72b34 100755 --- a/recipes-connectivity/lora/lora-network-server/lora-network-server.init +++ b/recipes-connectivity/lora/lora-network-server/lora-network-server.init @@ -1,25 +1,39 @@ #!/bin/bash + NAME="lora-network-server" ENABLED="yes" + [ -f /etc/default/$NAME ] && source /etc/default/$NAME + run_dir=/var/run/lora conf_dir=/var/config/lora conf_file=$conf_dir/lora-network-server.conf conf_db=$conf_dir/lora-network-server.db + net_server=/opt/lora/lora-network-server net_server_log=/var/log/lora-network-server.log net_server_pidfile=$run_dir/$NAME.pid -pkt_fwd=/opt/lora/basic_pkt_fwd + +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 + +port1=/sys/devices/platform/mts-io/ap1 +port2=/sys/devices/platform/mts-io/ap2 + + lora_us_id="MTAC-LORA-915" lora_eu_id="MTAC-LORA-868" +lora_usb_hw="MTAC-LORA-1.0" +lora_spi_hw="MTAC-LORA-1.1" +lora_h_hw="MTAC-LORA-1.5" + read_card_info() { # product-id of first lora card @@ -27,18 +41,35 @@ read_card_info() { lora_eui=$(mts-io-sysfs show lora/eui 2> /dev/null) # remove all colons lora_eui_raw=${lora_eui//:/} + lora_hw=$(mts-io-sysfs show lora/hw-version 2> /dev/null) } + card_found() { + 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 + if [ "$lora_id" = "$lora_us_id" ] || [ "$lora_id" = "$lora_eu_id" ]; then - echo "Found lora card $lora_id" - return 0 - else + if [ "$lora_hw" = "$lora_spi_hw" ] || [ "$lora_hw" = "$lora_h_hw" ]; then + ln -sf /opt/lora/lora_pkt_fwd $pkt_fwd + return 0 + elif [ "$lora_hw" = "$lora_usb_hw" ]; then + ln -sf /opt/lora/basic_pkt_fwd-usb $pkt_fwd + return 0 + else + return 1 + fi + else return 1 fi } + do_start() { + mkdir -p $run_dir/1 read_card_info if ! [ -f $conf_file ]; then @@ -46,30 +77,32 @@ do_start() { exit 1 fi - if ! card_found; then + + if card_found; then + echo "Found $lora_id with $lora_hw hardware" + else echo "$0: MTAC-LORA not detected" exit 1 fi - echo -n "Starting $NAME: " - mkdir -p $run_dir/1 # start network server - start-stop-daemon --start --background --make-pidfile \ + start-stop-daemon --start --background --make-pidfile \ --pidfile $net_server_pidfile --startas /bin/bash -- -c "exec $net_server \ -c $conf_file --lora-eui $lora_eui --lora-path $run_dir --db $conf_db \ --noconsole -l $net_server_log >> $net_server_log 2>&1" sleep 2 - # start packet forwarder - start-stop-daemon --start --background --make-pidfile \ - --pidfile $pkt_fwd_pidfile --exec $pkt_fwd -- \ - -c $run_dir/1 + # start packet forwarder + /usr/sbin/start-stop-daemon --chdir $run_dir/1 --background --start --make-pidfile \ + --pidfile $pkt_fwd_pidfile --startas /bin/bash -- -c "exec $pkt_fwd" renice -n -20 -p $(pgrep lora-network-se) renice -n -20 -p $(pgrep $(basename $pkt_fwd)) + echo "OK" } + do_stop() { echo -n "Stopping $NAME: " start-stop-daemon --stop --quiet --oknodo --pidfile $net_server_pidfile --retry 15 @@ -78,20 +111,22 @@ do_stop() { echo "OK" } + if [ "$ENABLED" != "yes" ]; then echo "$NAME: disabled in /etc/default" exit fi + case "$1" in "start") - do_start + do_start ;; "stop") - do_stop + do_stop ;; "restart") - ## Stop the service and regardless of whether it was + ## Stop the service and regardless of whether it was ## running or not, start it again. do_stop do_start @@ -100,6 +135,6 @@ case "$1" in ## 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-network-server/lora-network-server.init~ b/recipes-connectivity/lora/lora-network-server/lora-network-server.init~ new file mode 100755 index 0000000..4b80dc7 --- /dev/null +++ b/recipes-connectivity/lora/lora-network-server/lora-network-server.init~ @@ -0,0 +1,105 @@ +#!/bin/bash + +NAME="lora-network-server" +ENABLED="yes" + +[ -f /etc/default/$NAME ] && source /etc/default/$NAME + +run_dir=/var/run/lora +conf_dir=/var/config/lora +conf_file=$conf_dir/lora-network-server.conf +conf_db=$conf_dir/lora-network-server.db + +net_server=/opt/lora/lora-network-server +net_server_log=/var/log/lora-network-server.log +net_server_pidfile=$run_dir/$NAME.pid + +pkt_fwd=/opt/lora/basic_pkt_fwd +pkt_fwd_log=/var/log/lora-pkt-fwd-1.log +pkt_fwd_pidfile=$run_dir/lora-pkt-fwd-1.pid + +lora_us_id="MTAC-LORA-915" +lora_eu_id="MTAC-LORA-868" + +read_card_info() { + # 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) + # remove all colons + lora_eui_raw=${lora_eui//:/} +} + +card_found() { + if [ "$lora_id" = "$lora_us_id" ] || [ "$lora_id" = "$lora_eu_id" ]; then + echo "Found lora card $lora_id" + return 0 + else + return 1 + fi +} + +do_start() { + read_card_info + + if ! [ -f $conf_file ]; then + echo "$0: $conf_file missing" + exit 1 + fi + + if ! card_found; then + echo "$0: MTAC-LORA not detected" + exit 1 + fi + + echo -n "Starting $NAME: " + mkdir -p $run_dir/1 + # start network server + start-stop-daemon --start --background --make-pidfile \ + --pidfile $net_server_pidfile --startas /bin/bash -- -c "exec $net_server \ + -c $conf_file --lora-eui $lora_eui --lora-path $run_dir --db $conf_db \ + --noconsole -l $net_server_log >> $net_server_log 2>&1" + sleep 2 + # start packet forwarder + start-stop-daemon --start --background --make-pidfile \ + --pidfile $pkt_fwd_pidfile --exec $pkt_fwd -- \ + -c $run_dir/1 + + renice -n -20 -p $(pgrep lora-network-se) + renice -n -20 -p $(pgrep $(basename $pkt_fwd)) + + echo "OK" +} + +do_stop() { + echo -n "Stopping $NAME: " + start-stop-daemon --stop --quiet --oknodo --pidfile $net_server_pidfile --retry 15 + start-stop-daemon --stop --quiet --oknodo --pidfile $pkt_fwd_pidfile --retry 5 + rm -f $net_server_pidfile $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-network-server_1.0.13.bb b/recipes-connectivity/lora/lora-network-server_1.0.13.bb deleted file mode 100644 index 1cf41f7..0000000 --- a/recipes-connectivity/lora/lora-network-server_1.0.13.bb +++ /dev/null @@ -1,49 +0,0 @@ -DESCRIPTION = "MultiTech LoRa Network Server" -PRIORITY = "optional" -SECTION = "console/utils" -LICENSE = "Proprietary" -LIC_FILES_CHKSUM = "file://LICENSE;md5=7ffae4666a986c4ccf45e99e464f8402" -DEPENDS = "jsoncpp libmts mosquitto sqlite3" -RDEPENDS_${PN} += "lora-packet-forwarder logrotate" -PR = "r0" - -SRC_URI = "http://multitech.net/downloads/lora-network-server_${TUNE_PKGARCH}_${PV}.tar.gz \ - file://lora-network-server.init \ - file://lora-network-server.default \ - file://lora-network-server.logrotate.conf \ - " - -SRC_URI[md5sum] = "8785cbe4a70ee288fa09f00593b1fdb1" -SRC_URI[sha256sum] = "5e6450244f21b4c28e780f36b3d1e7bf502ab25f835a0c21295caac11faec69b" - -# binaries are already stripped, so suppress warning -INSANE_SKIP_${PN} = "already-stripped" - -S = "${WORKDIR}" - -LORA_DIR = "/opt/lora" - -do_compile() { -} - -inherit update-rc.d - -INITSCRIPT_NAME = "lora-network-server" -INITSCRIPT_PARAMS = "defaults 80 30" - -do_install() { - install -d ${D}${LORA_DIR} - install -m 0755 lora-network-server ${D}${LORA_DIR}/ - install -m 0644 lora-network-server.conf.sample ${D}${LORA_DIR}/lora-network-server.conf.sample - - install -d ${D}${sysconfdir}/default - install -m 0644 ${WORKDIR}/lora-network-server.default ${D}${sysconfdir}/default/lora-network-server - install -d ${D}${sysconfdir}/init.d - install -m 0755 ${WORKDIR}/lora-network-server.init ${D}${sysconfdir}/init.d/lora-network-server - install -d ${D}${sysconfdir}/logrotate.d - install -m 0644 ${WORKDIR}/lora-network-server.logrotate.conf ${D}${sysconfdir}/logrotate.d/lora-network-server.conf -} - -CONFFILES_${PN} = "${sysconfdir}/default/lora-network-server" -FILES_${PN} += "${LORA_DIR}" -FILES_${PN}-dbg += "${LORA_DIR}/.debug" diff --git a/recipes-connectivity/lora/lora-network-server_1.0.12.bb b/recipes-connectivity/lora/lora-network-server_1.0.14.bb index 4873822..36d493c 100644 --- a/recipes-connectivity/lora/lora-network-server_1.0.12.bb +++ b/recipes-connectivity/lora/lora-network-server_1.0.14.bb @@ -5,7 +5,7 @@ LICENSE = "Proprietary" LIC_FILES_CHKSUM = "file://LICENSE;md5=7ffae4666a986c4ccf45e99e464f8402" DEPENDS = "jsoncpp libmts mosquitto sqlite3" RDEPENDS_${PN} += "lora-packet-forwarder logrotate" -PR = "r0" +PR = "r1" SRC_URI = "http://multitech.net/downloads/lora-network-server_${TUNE_PKGARCH}_${PV}.tar.gz \ file://lora-network-server.init \ @@ -13,8 +13,8 @@ SRC_URI = "http://multitech.net/downloads/lora-network-server_${TUNE_PKGARCH}_${ file://lora-network-server.logrotate.conf \ " -SRC_URI[md5sum] = "4d9e6a1b5e121f9af77b4257d7972f1d" -SRC_URI[sha256sum] = "c625ed2414c8e1711a3da1cec4c8ced70bcbbab24c9461106cdf9576ca3f2864" +SRC_URI[md5sum] = "6cbae4e82503c5b5078b4ffadcda05a0" +SRC_URI[sha256sum] = "707e919b02f1f7d3ef8ed66f26b7e8749f4d0db55288062f1aa4c04e5ceccf34" # binaries are already stripped, so suppress warning INSANE_SKIP_${PN} = "already-stripped" diff --git a/recipes-connectivity/lora/lora-packet-forwarder-usb/README.md b/recipes-connectivity/lora/lora-packet-forwarder-usb/README.md new file mode 100644 index 0000000..c927c60 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder-usb/README.md @@ -0,0 +1,38 @@ + + +(c) Senet, Inc 2016 + + + +3rd Party Licenses +------------------ + +This software incorporates the lora_gateway software which requires the +following statement to be included in its distribution. + +Copyright (c) 2013, SEMTECH S.A. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Semtech corporation nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL SEMTECH S.A. BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + diff --git a/recipes-connectivity/lora/lora-packet-forwarder-usb/local_conf.json b/recipes-connectivity/lora/lora-packet-forwarder-usb/local_conf.json new file mode 100644 index 0000000..3c2af80 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder-usb/local_conf.json @@ -0,0 +1,7 @@ +{ + "gateway_conf": { + "server_address": "localhost", + "serv_port_up": 1780, + "serv_port_down": 1782 + } +} diff --git a/recipes-connectivity/lora/lora-packet-forwarder-usb/lora-packet-forwarder-add-no-header-option.patch b/recipes-connectivity/lora/lora-packet-forwarder-usb/lora-packet-forwarder-add-no-header-option.patch new file mode 100644 index 0000000..fd2fa24 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder-usb/lora-packet-forwarder-add-no-header-option.patch @@ -0,0 +1,45 @@ +From 03c697f2bcf538407ca6a0821dbbb65ab7679aff Mon Sep 17 00:00:00 2001 +From: Jason Reiss <jreiss@multitech.com> +Date: Thu, 16 Jul 2015 13:31:20 -0500 +Subject: [PATCH] feature: add option to send packets with no header + +--- + basic_pkt_fwd/src/basic_pkt_fwd.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/basic_pkt_fwd/src/basic_pkt_fwd.c b/basic_pkt_fwd/src/basic_pkt_fwd.c +index e20dfc1..2223b4a 100644 +--- a/basic_pkt_fwd/src/basic_pkt_fwd.c ++++ b/basic_pkt_fwd/src/basic_pkt_fwd.c +@@ -1276,6 +1276,13 @@ void thread_down(void) { + if (val != NULL) { + txpkt.no_crc = (bool)json_value_get_boolean(val); + } ++ ++ /* Parse "No Header" flag (optional field) */ ++ val = json_object_get_value(txpk_obj,"nhdr"); ++ if (val != NULL) { ++ txpkt.no_header = (bool)json_value_get_boolean(val); ++ } ++ + + /* parse target frequency (mandatory) */ + val = json_object_get_value(txpk_obj,"freq"); + +diff --git a/gps_pkt_fwd/src/gps_pkt_fwd.c b/gps_pkt_fwd/src/gps_pkt_fwd.c +index 79f7584..d073540 100644 +--- a/gps_pkt_fwd/src/gps_pkt_fwd.c ++++ b/gps_pkt_fwd/src/gps_pkt_fwd.c +@@ -1534,6 +1534,12 @@ void thread_down(void) { + txpkt.no_crc = (bool)json_value_get_boolean(val); + } + ++ /* Parse "No Header" flag (optional field) */ ++ val = json_object_get_value(txpk_obj,"nhdr"); ++ if (val != NULL) { ++ txpkt.no_header = (bool)json_value_get_boolean(val); ++ } ++ + /* parse target frequency (mandatory) */ + val = json_object_get_value(txpk_obj,"freq"); + if (val == NULL) { diff --git a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-add-queue.patch b/recipes-connectivity/lora/lora-packet-forwarder-usb/lora-packet-forwarder-add-queue.patch index cd9a727..cd9a727 100644 --- a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-add-queue.patch +++ b/recipes-connectivity/lora/lora-packet-forwarder-usb/lora-packet-forwarder-add-queue.patch diff --git a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-fixb64.patch b/recipes-connectivity/lora/lora-packet-forwarder-usb/lora-packet-forwarder-fixb64.patch index dc0df42..dc0df42 100644 --- a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-fixb64.patch +++ b/recipes-connectivity/lora/lora-packet-forwarder-usb/lora-packet-forwarder-fixb64.patch diff --git a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-mts-enhancements.patch b/recipes-connectivity/lora/lora-packet-forwarder-usb/lora-packet-forwarder-mts-enhancements.patch index e1da462..e1da462 100644 --- a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-mts-enhancements.patch +++ b/recipes-connectivity/lora/lora-packet-forwarder-usb/lora-packet-forwarder-mts-enhancements.patch diff --git a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-set-spi-path.patch b/recipes-connectivity/lora/lora-packet-forwarder-usb/lora-packet-forwarder-set-spi-path.patch index 01ce509..01ce509 100644 --- a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-set-spi-path.patch +++ b/recipes-connectivity/lora/lora-packet-forwarder-usb/lora-packet-forwarder-set-spi-path.patch diff --git a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-skip-bad-packets.patch b/recipes-connectivity/lora/lora-packet-forwarder-usb/lora-packet-forwarder-skip-bad-packets.patch index eb9450f..eb9450f 100644 --- a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-skip-bad-packets.patch +++ b/recipes-connectivity/lora/lora-packet-forwarder-usb/lora-packet-forwarder-skip-bad-packets.patch diff --git a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-synch-word.patch b/recipes-connectivity/lora/lora-packet-forwarder-usb/lora-packet-forwarder-synch-word.patch index 2f04eb1..2f04eb1 100644 --- a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-synch-word.patch +++ b/recipes-connectivity/lora/lora-packet-forwarder-usb/lora-packet-forwarder-synch-word.patch diff --git a/recipes-connectivity/lora/lora-packet-forwarder_1.4.1.bb b/recipes-connectivity/lora/lora-packet-forwarder-usb_1.4.1.bb index 62e6f4c..541247b 100644 --- a/recipes-connectivity/lora/lora-packet-forwarder_1.4.1.bb +++ b/recipes-connectivity/lora/lora-packet-forwarder-usb_1.4.1.bb @@ -5,7 +5,7 @@ SECTION = "console/utils" # Semtech license is a modified BSD-style license LICENSE = "SEMTECH" LIC_FILES_CHKSUM = "file://LICENSE;md5=22af7693d7b76ef0fc76161c4be76c45" -DEPENDS = "lora-gateway" +DEPENDS = "lora-gateway-usb" PR = "r10" # tag v1.4.1 @@ -37,12 +37,11 @@ do_compile() { do_install() { install -d ${D}${LORA_DIR} - install -m 755 gps_pkt_fwd/gps_pkt_fwd ${D}${LORA_DIR}/ - install -m 755 basic_pkt_fwd/basic_pkt_fwd ${D}${LORA_DIR}/ - install -m 755 beacon_pkt_fwd/beacon_pkt_fwd ${D}${LORA_DIR}/ - install -m 755 util_sink/util_sink ${D}${LORA_DIR}/ - install -m 755 util_ack/util_ack ${D}${LORA_DIR}/ - install -m 755 ${WORKDIR}/README.md ${D}${LORA_DIR}/ + install -m 755 gps_pkt_fwd/gps_pkt_fwd ${D}${LORA_DIR}/gps_pkt_fwd-usb + install -m 755 basic_pkt_fwd/basic_pkt_fwd ${D}${LORA_DIR}/basic_pkt_fwd-usb + install -m 755 beacon_pkt_fwd/beacon_pkt_fwd ${D}${LORA_DIR}/beacon_pkt_fwd-usb + install -m 755 util_sink/util_sink ${D}${LORA_DIR}/util_sink-usb + install -m 755 util_ack/util_ack ${D}${LORA_DIR}/util_ack-usb # skip util_tx_test since it conflicts with one in lora-gateway diff --git a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-add-no-header-option.patch b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-add-no-header-option.patch index fd2fa24..7f9851f 100644 --- a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-add-no-header-option.patch +++ b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-add-no-header-option.patch @@ -1,45 +1,17 @@ -From 03c697f2bcf538407ca6a0821dbbb65ab7679aff Mon Sep 17 00:00:00 2001 -From: Jason Reiss <jreiss@multitech.com> -Date: Thu, 16 Jul 2015 13:31:20 -0500 -Subject: [PATCH] feature: add option to send packets with no header - ---- - basic_pkt_fwd/src/basic_pkt_fwd.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/basic_pkt_fwd/src/basic_pkt_fwd.c b/basic_pkt_fwd/src/basic_pkt_fwd.c -index e20dfc1..2223b4a 100644 ---- a/basic_pkt_fwd/src/basic_pkt_fwd.c -+++ b/basic_pkt_fwd/src/basic_pkt_fwd.c -@@ -1276,6 +1276,13 @@ void thread_down(void) { - if (val != NULL) { - txpkt.no_crc = (bool)json_value_get_boolean(val); - } -+ +diff --git a/lora_pkt_fwd/src/lora_pkt_fwd.c b/lora_pkt_fwd/src/lora_pkt_fwd.c +index 31a3743..c15b191 100644 +--- a/lora_pkt_fwd/src/lora_pkt_fwd.c ++++ b/lora_pkt_fwd/src/lora_pkt_fwd.c +@@ -2143,6 +2143,12 @@ void thread_down(void) { + txpkt.no_crc = (bool)json_value_get_boolean(val); + } + + /* Parse "No Header" flag (optional field) */ + val = json_object_get_value(txpk_obj,"nhdr"); + if (val != NULL) { -+ txpkt.no_header = (bool)json_value_get_boolean(val); -+ } -+ - - /* parse target frequency (mandatory) */ - val = json_object_get_value(txpk_obj,"freq"); - -diff --git a/gps_pkt_fwd/src/gps_pkt_fwd.c b/gps_pkt_fwd/src/gps_pkt_fwd.c -index 79f7584..d073540 100644 ---- a/gps_pkt_fwd/src/gps_pkt_fwd.c -+++ b/gps_pkt_fwd/src/gps_pkt_fwd.c -@@ -1534,6 +1534,12 @@ void thread_down(void) { - txpkt.no_crc = (bool)json_value_get_boolean(val); - } - -+ /* Parse "No Header" flag (optional field) */ -+ val = json_object_get_value(txpk_obj,"nhdr"); -+ if (val != NULL) { + txpkt.no_header = (bool)json_value_get_boolean(val); + } -+ - /* parse target frequency (mandatory) */ - val = json_object_get_value(txpk_obj,"freq"); - if (val == NULL) { ++ + /* parse target frequency (mandatory) */ + val = json_object_get_value(txpk_obj,"freq"); + if (val == NULL) { diff --git a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-add-spi-dev-path.patch b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-add-spi-dev-path.patch new file mode 100644 index 0000000..820bd4f --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-add-spi-dev-path.patch @@ -0,0 +1,38 @@ +diff --git a/lora_pkt_fwd/src/lora_pkt_fwd.c b/lora_pkt_fwd/src/lora_pkt_fwd.c +index 31a3743..a8c8f01 100644 +--- a/lora_pkt_fwd/src/lora_pkt_fwd.c ++++ b/lora_pkt_fwd/src/lora_pkt_fwd.c +@@ -119,6 +119,7 @@ static bool fwd_nocrc_pkt = false; /* packets with NO PAYLOAD CRC are NOT forwar + /* 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 spi_device_path[64] = {0} ; /* custom SPI device path */ + static char serv_port_up[8] = STR(DEFAULT_PORT_UP); /* server port for upstream traffic */ + static char serv_port_down[8] = STR(DEFAULT_PORT_DW); /* server port for downstream traffic */ + static int keepalive_time = DEFAULT_KEEPALIVE; /* send a PULL_DATA request every X seconds, negative = disabled */ +@@ -645,6 +646,13 @@ static int parse_gateway_configuration(const char * conf_file) { + MSG("INFO: server hostname or IP address is configured to \"%s\"\n", serv_addr); + } + ++ /* spi device path (optional) */ ++ str = json_object_get_string(conf_obj, "spi_device"); ++ if (str != NULL) { ++ strncpy(spi_device_path, str, sizeof(spi_device_path)-1); ++ MSG("INFO: SPI device is configured to \"%s\"\n", spi_device_path); ++ } ++ + /* get up and down ports (optional) */ + val = json_object_get_value(conf_obj, "serv_port_up"); + if (val != NULL) { +@@ -1092,6 +1100,11 @@ int main(void) + } + freeaddrinfo(result); + ++ /* set custom SPI device path if configured */ ++ if (strlen(spi_device_path) > 0) ++ lgw_spi_set_path(spi_device_path); ++ ++ + /* starting the concentrator */ + i = lgw_start(); + if (i == LGW_HAL_SUCCESS) { diff --git a/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb b/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb index 7423ff8..8042d50 100644 --- a/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb +++ b/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb @@ -16,6 +16,7 @@ SRC_URI = "git://github.com/Lora-net/packet_forwarder.git;protocol=git \ file://lora-packet-forwarder.default \ file://global_conf.json.3.0.0.PCB_E336.EU868.basic.clksrc0 \ file://local_conf.json \ + file://lora-packet-forwarder-add-spi-dev-path.patch \ " S = "${WORKDIR}/git" |