summaryrefslogtreecommitdiff
path: root/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-add-spi-dev-path.patch
diff options
context:
space:
mode:
authorJason Reiss <jreiss@multitech.com>2016-10-14 10:05:23 -0500
committerJason Reiss <jreiss@multitech.com>2016-10-14 10:05:23 -0500
commit5ebcefe167c398e98567bb4c05d7e9fb5bcbcfe7 (patch)
tree8cc4ae39c1ccf1bfac3c09397687e0808bbcba0b /recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-add-spi-dev-path.patch
parente84694799fe3301529c1b2b5661233af8a02f94c (diff)
downloadmeta-mlinux-5ebcefe167c398e98567bb4c05d7e9fb5bcbcfe7.tar.gz
meta-mlinux-5ebcefe167c398e98567bb4c05d7e9fb5bcbcfe7.tar.bz2
meta-mlinux-5ebcefe167c398e98567bb4c05d7e9fb5bcbcfe7.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/lora-packet-forwarder/lora-packet-forwarder-add-spi-dev-path.patch')
-rw-r--r--recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-add-spi-dev-path.patch38
1 files changed, 38 insertions, 0 deletions
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) {