summaryrefslogtreecommitdiff
path: root/recipes-connectivity/lora/lora-gateway/ln-lora-spi-dev.sh
blob: c350fff7257f7771b42efe83218e2a7f37f3c15c (plain)
1
2
3
4
5
6
7
8
9
10
11
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