summaryrefslogtreecommitdiff
path: root/recipes-connectivity/lora/lora-packet-forwarder-usb/lora-packet-forwarder-set-spi-path.patch
blob: 01ce509bff759cb5df867e8e97c03e55e0579be9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
Index: git/basic_pkt_fwd/src/basic_pkt_fwd.c
===================================================================
--- git.orig/basic_pkt_fwd/src/basic_pkt_fwd.c	2015-01-07 14:38:10.016886785 -0600
+++ git/basic_pkt_fwd/src/basic_pkt_fwd.c	2015-01-07 14:49:57.823412026 -0600
@@ -106,6 +106,7 @@
 /* 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 */
@@ -393,6 +394,13 @@
 		strncpy(serv_addr, str, sizeof serv_addr);
 		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");
@@ -629,6 +637,10 @@
 		exit(EXIT_FAILURE);
 	}
 	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();
Index: git/beacon_pkt_fwd/src/beacon_pkt_fwd.c
===================================================================
--- git.orig/beacon_pkt_fwd/src/beacon_pkt_fwd.c	2015-01-05 11:29:12.946020392 -0600
+++ git/beacon_pkt_fwd/src/beacon_pkt_fwd.c	2015-01-07 14:57:00.338533303 -0600
@@ -115,6 +115,7 @@
 /* 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 */
@@ -440,6 +441,13 @@
 		strncpy(serv_addr, str, sizeof serv_addr);
 		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");
@@ -774,6 +782,10 @@
 		exit(EXIT_FAILURE);
 	}
 	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();
Index: git/gps_pkt_fwd/src/gps_pkt_fwd.c
===================================================================
--- git.orig/gps_pkt_fwd/src/gps_pkt_fwd.c	2015-01-05 11:29:12.946020392 -0600
+++ git/gps_pkt_fwd/src/gps_pkt_fwd.c	2015-01-07 14:56:03.320278543 -0600
@@ -110,6 +110,7 @@
 /* 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 */
@@ -424,6 +425,13 @@
 		strncpy(serv_addr, str, sizeof serv_addr);
 		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");
@@ -717,6 +725,10 @@
 		exit(EXIT_FAILURE);
 	}
 	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();