summaryrefslogtreecommitdiff
path: root/recipes-connectivity/lora/lora-gateway/ln-lora-spi-dev.sh
diff options
context:
space:
mode:
authorJason Reiss <jreiss@multitech.com>2016-10-28 09:38:45 -0500
committerJason Reiss <jreiss@multitech.com>2016-10-28 09:38:45 -0500
commit5362bf1fc4b8da40f1c7a6b00996f6a24adb4a62 (patch)
treeb844092bbb460a876eabac3b22f44528765dead6 /recipes-connectivity/lora/lora-gateway/ln-lora-spi-dev.sh
parent2554947afa92748abf36140797aac90b78552cd0 (diff)
downloadmeta-mlinux-5362bf1fc4b8da40f1c7a6b00996f6a24adb4a62.tar.gz
meta-mlinux-5362bf1fc4b8da40f1c7a6b00996f6a24adb4a62.tar.bz2
meta-mlinux-5362bf1fc4b8da40f1c7a6b00996f6a24adb4a62.zip
lora-gateway: add script to link spidev0.0 to installed card
Diffstat (limited to 'recipes-connectivity/lora/lora-gateway/ln-lora-spi-dev.sh')
-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