summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am11
-rw-r--r--src/mts-fpga-loader.sh26
2 files changed, 31 insertions, 6 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index a559d8e..e9d0dcf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,7 +3,7 @@ AUTOMAKE_OPTIONS = gnu
AM_CFLAGS = -Wall
bin_PROGRAMS = mts-id-eeprom
-sbin_PROGRAMS = mts-hashpwd mts-fpga-loader mts-hdr-copy
+sbin_PROGRAMS = mts-hashpwd mts-fpga-loader
mts_hashpwd_SOURCES = hashpwd.cpp
mts_id_eeprom_SOURCES = eeprom_main.c
noinst_HEADERS = eeprom.h log.h mts_error_codes.h mts_fpga_hash.h mts_fpga_reg.h mts_fpga_spi.h
@@ -12,9 +12,7 @@ mts_hashpwd_LDADD = -lcrypto
mts_fpga_loader_SOURCES = mts_fpga_hash.c mts_fpga_reg.c mts_fpga_spi.c mts_fpga_loader.c
mts_fpga_loader_LDADD = -lrt -lm -lssl -lcrypto
-mts_hdr_copy_SOURCES = mts_hdr_copy.c
-
-sbin_SCRIPTS = ubpasswd.sh
+sbin_SCRIPTS = ubpasswd.sh mts-fpga-loader.sh
EXTRA_DIST =
SUFFIXES = .sh
@@ -32,9 +30,10 @@ install-exec-hook:
mv ubpasswd.sh ../../sbin/mts-ubpasswd && \
chmod 0744 ../../sbin/mts-ubpasswd
cd $(DESTDIR)$(sbindir) && \
+ mv mts-fpga-loader.sh ../../sbin/mts-fpga-loader-1_5 && \
+ chmod 0744 ../../sbin/mts-fpga-loader-1_5
+ cd $(DESTDIR)$(sbindir) && \
mv mts-hashpwd ../../sbin/mts-hashpwd
cd $(DESTDIR)$(sbindir) && \
mv mts-fpga-loader ../../sbin/mts-fpga-loader
- cd $(DESTDIR)$(sbindir) && \
- mv mts-hdr-copy ../../sbin/mts-hdr-copy
rmdir $(DESTDIR)$(sbindir)
diff --git a/src/mts-fpga-loader.sh b/src/mts-fpga-loader.sh
new file mode 100644
index 0000000..027ff09
--- /dev/null
+++ b/src/mts-fpga-loader.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+lora_1_5_h_hw="-LORA-1.5\$"
+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} ]]; 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