summaryrefslogtreecommitdiff
path: root/recipes-connectivity/lora/lora-gateway
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-connectivity/lora/lora-gateway')
-rw-r--r--recipes-connectivity/lora/lora-gateway/ln-lora-spi-dev.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/recipes-connectivity/lora/lora-gateway/ln-lora-spi-dev.sh b/recipes-connectivity/lora/lora-gateway/ln-lora-spi-dev.sh
new file mode 100644
index 0000000..c350fff
--- /dev/null
+++ b/recipes-connectivity/lora/lora-gateway/ln-lora-spi-dev.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+port1=/sys/devices/platform/mts-io/ap1
+port2=/sys/devices/platform/mts-io/ap2
+
+lora_hw=$(mts-io-sysfs show lora/hw-version 2> /dev/null)
+
+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