Skip to content

Commit

Permalink
2.9.2 loraserver add enable_uplink_channel;Eth0 does not exist will u…
Browse files Browse the repository at this point in the history
…se wlan0 to get gwid
  • Loading branch information
RAKwireless authored and RAKwireless committed Aug 15, 2019
1 parent 807f6e0 commit a916038
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 17 deletions.
6 changes: 5 additions & 1 deletion lora/set_eui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ if [ ! -e "/opt/ttn-gateway/packet_forwarder/lora_pkt_fwd/local_conf.json" ]; th
if [[ `grep "$GATEWAY_EUI_NIC" /proc/net/dev` == "" ]]; then
GATEWAY_EUI_NIC="wlan0"
fi

if [[ `grep "$GATEWAY_EUI_NIC" /proc/net/dev` == "" ]]; then
GATEWAY_EUI_NIC="usb0"
fi

if [[ `grep "$GATEWAY_EUI_NIC" /proc/net/dev` == "" ]]; then
echo "ERROR: No network interface found. Cannot set gateway ID."
# exit 1
exit 1
fi
GATEWAY_EUI=$(ip link show $GATEWAY_EUI_NIC | awk '/ether/ {print $2}' | awk -F\: '{print $1$2$3"FFFE"$4$5$6}')
GATEWAY_EUI=${GATEWAY_EUI^^}
Expand Down
21 changes: 18 additions & 3 deletions lora/update_gwid.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

# This script is a helper to update the Gateway_ID field of given
# JSON configuration file, as a EUI-64 address generated from the 48-bits MAC
Expand All @@ -9,9 +9,23 @@

iot_sk_update_gwid() {
# get gateway ID from its MAC address to generate an EUI-64 address
GATEWAY_EUI_NIC="eth0"
if [[ `grep "$GATEWAY_EUI_NIC" /proc/net/dev` == "" ]]; then
GATEWAY_EUI_NIC="wlan0"
fi

if [[ `grep "$GATEWAY_EUI_NIC" /proc/net/dev` == "" ]]; then
GATEWAY_EUI_NIC="usb0"
fi

if [[ `grep "$GATEWAY_EUI_NIC" /proc/net/dev` == "" ]]; then
echo "ERROR: No network interface found. Cannot set gateway ID."
exit 1
fi

GWID_MIDFIX="fffe"
GWID_BEGIN=$(ip link show eth0 | awk '/ether/ {print $2}' | awk -F\: '{print $1$2$3}')
GWID_END=$(ip link show eth0 | awk '/ether/ {print $2}' | awk -F\: '{print $4$5$6}')
GWID_BEGIN=$(ip link show $GATEWAY_EUI_NIC | awk '/ether/ {print $2}' | awk -F\: '{print $1$2$3}')
GWID_END=$(ip link show $GATEWAY_EUI_NIC | awk '/ether/ {print $2}' | awk -F\: '{print $4$5$6}')

# replace last 8 digits of default gateway ID by actual GWID, in given JSON configuration file
sed -i 's/\(^\s*"gateway_ID":\s*"\).\{16\}"\s*\(,\?\).*$/\1'${GWID_BEGIN}${GWID_MIDFIX}${GWID_END}'"\2/' $1
Expand All @@ -29,3 +43,4 @@ fi
iot_sk_update_gwid $1

exit 0

2 changes: 1 addition & 1 deletion loraserver/loraserver_conf/loraserver.as_923.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ net_id="000000"

# LoRaWAN network related settings.
[network_server.network_settings]

enabled_uplink_channels=[0, 1, 2, 3, 4, 5, 6, 7]
# Extra channel configuration.
#
# Use this for LoRaWAN regions where it is possible to extend the by default
Expand Down
2 changes: 1 addition & 1 deletion loraserver/loraserver_conf/loraserver.au_915_928.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ net_id="000000"

# LoRaWAN network related settings.
[network_server.network_settings]

enabled_uplink_channels=[8, 9, 10, 11, 12, 13, 14, 15]
# Extra channel configuration.
#
# Use this for LoRaWAN regions where it is possible to extend the by default
Expand Down
2 changes: 1 addition & 1 deletion loraserver/loraserver_conf/loraserver.cn_470_510.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ net_id="000000"

# LoRaWAN network related settings.
[network_server.network_settings]

enabled_uplink_channels=[80, 81, 82, 83, 84, 85, 86, 87]
# Extra channel configuration.
#
# Use this for LoRaWAN regions where it is possible to extend the by default
Expand Down
2 changes: 1 addition & 1 deletion loraserver/loraserver_conf/loraserver.eu_433.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ net_id="000000"

# LoRaWAN network related settings.
[network_server.network_settings]

enabled_uplink_channels=[0, 1, 2, 3, 4, 5, 6, 7]
# Extra channel configuration.
#
# Use this for LoRaWAN regions where it is possible to extend the by default
Expand Down
2 changes: 1 addition & 1 deletion loraserver/loraserver_conf/loraserver.eu_863_870.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ net_id="000000"

# LoRaWAN network related settings.
[network_server.network_settings]

enabled_uplink_channels=[0, 1, 2, 3, 4, 5, 6, 7]
# Extra channel configuration.
#
# Use this for LoRaWAN regions where it is possible to extend the by default
Expand Down
2 changes: 1 addition & 1 deletion loraserver/loraserver_conf/loraserver.in_865_867.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ net_id="000000"

# LoRaWAN network related settings.
[network_server.network_settings]

enabled_uplink_channels=[0, 1, 2]
# Extra channel configuration.
#
# Use this for LoRaWAN regions where it is possible to extend the by default
Expand Down
2 changes: 1 addition & 1 deletion loraserver/loraserver_conf/loraserver.kr_920_923.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ net_id="000000"

# LoRaWAN network related settings.
[network_server.network_settings]

enabled_uplink_channels=[0, 1, 2, 3, 4, 5, 6, 7]
# Extra channel configuration.
#
# Use this for LoRaWAN regions where it is possible to extend the by default
Expand Down
2 changes: 1 addition & 1 deletion loraserver/loraserver_conf/loraserver.ru_864_870.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ net_id="000000"

# LoRaWAN network related settings.
[network_server.network_settings]

enabled_uplink_channels=[0, 1]
# Extra channel configuration.
#
# Use this for LoRaWAN regions where it is possible to extend the by default
Expand Down
2 changes: 1 addition & 1 deletion loraserver/loraserver_conf/loraserver.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ net_id="000000"

# LoRaWAN network related settings.
[network_server.network_settings]

enabled_uplink_channels=[0, 1, 2, 3, 4, 5, 6, 7]
# Extra channel configuration.
#
# Use this for LoRaWAN regions where it is possible to extend the by default
Expand Down
2 changes: 1 addition & 1 deletion loraserver/loraserver_conf/loraserver.us_902_928.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ net_id="000000"

# LoRaWAN network related settings.
[network_server.network_settings]

enabled_uplink_channels=[8, 9, 10, 11, 12, 13, 14, 15]
# Extra channel configuration.
#
# Use this for LoRaWAN regions where it is possible to extend the by default
Expand Down
2 changes: 1 addition & 1 deletion sysconf/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ dtparam=i2c_arm_baudrate=10000
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
dtoverlay=pi3-disable-bt
#dtoverlay=dwc2
dtoverlay=dwc2
4 changes: 2 additions & 2 deletions sysconf/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ fi

cp config.txt /boot/config.txt

#CMD_STR=`cat /boot/cmdline.txt`
#echo "$CMD_STR modules-load=dwc2,g_ether" > /boot/cmdline.txt
CMD_STR=`cat /boot/cmdline.txt`
echo "$CMD_STR modules-load=dwc2,g_ether" > /boot/cmdline.txt

./set_ip.sh

Expand Down

0 comments on commit a916038

Please sign in to comment.