summaryrefslogtreecommitdiff
path: root/src/mts-fpga-loader.sh
blob: 270278c4d799ddda88b599242e4a2f2a35327c5a (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
#!/bin/bash
lora_1_5_h_hw="-LORA-1.5\$"
lora_1_5_lga_hw="MTLGA"
lora_2_1_hw="-LORA-2.1\$"
L15=/sbin/mts-fpga-loader-1_5
L21=/sbin/sem-fpga-loader

lora_hw=$(mts-io-sysfs show lora/hw-version 2> /dev/null)

if  [[ $lora_hw =~ ${lora_1_5_h_hw}|^${lora_1_5_lga_hw}* ]]; then
    if [[ -x ${L15} ]] ; then
	    ${L15} "$@"
    else
	    echo "Is mts-id-eeprom installed properly?"
            echo "Missing executable ${L15}"
    fi
elif [[ $lora_hw =~ ${lora_2_1_hw} ]]; then
     if [[ -x ${L21} ]] ; then
     	    ${L21} "$@"
     else
	    echo "Is sem-fpga-loader installed properly?"
            echo "Missing executable ${L21}"
     fi
else
    echo "Supported FPGA hardware not found. Exiting."
    exit 1
fi