summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2018-04-19 08:55:26 -0500
committerJohn Klug <john.klug@multitech.com>2018-04-19 09:18:17 -0500
commitcdeaeebe0435b448abb12a47f2689ce420587b93 (patch)
tree2d9ee7ecf7708f51512d1c7c4ef5eb4692741823
parent3c8466f555782592d33575ec835e335ea8db8def (diff)
downloadmeta-multitech-cdeaeebe0435b448abb12a47f2689ce420587b93.tar.gz
meta-multitech-cdeaeebe0435b448abb12a47f2689ce420587b93.tar.bz2
meta-multitech-cdeaeebe0435b448abb12a47f2689ce420587b93.zip
New mts-io 2.0.0 driver for LoRa 2.1 and better discovery
-rw-r--r--recipes-bsp/multitech/mts-id-eeprom.inc1
-rw-r--r--recipes-bsp/multitech/mts-io.inc57
-rw-r--r--recipes-bsp/multitech/mts-io/mts-io.init45
-rw-r--r--recipes-bsp/multitech/mts-io_2.0.0.bb (renamed from recipes-bsp/multitech/mts-io_1.5.16.bb)0
4 files changed, 63 insertions, 40 deletions
diff --git a/recipes-bsp/multitech/mts-id-eeprom.inc b/recipes-bsp/multitech/mts-id-eeprom.inc
index abc661c..d1f2527 100644
--- a/recipes-bsp/multitech/mts-id-eeprom.inc
+++ b/recipes-bsp/multitech/mts-id-eeprom.inc
@@ -20,6 +20,7 @@ inherit autotools
PARALLEL_MAKE = ""
+FILES_${PN}_append += "${sbindir}/mts-fpga-loader-1_5"
FILES_${PN}_append_mtcap += "${libdir}/mts-flash-binaries/mtcap-fpga-v31.hex ${libdir}/mts-flash-binaries/mtcap-fpga-v33.hex "
FILES_${PN}_append_mtcdt += "${libdir}/mts-flash-binaries/mtcdt-fpga-v31.hex ${libdir}/mts-flash-binaries/mtcdt-fpga-v33.hex "
diff --git a/recipes-bsp/multitech/mts-io.inc b/recipes-bsp/multitech/mts-io.inc
index fa54024..8e65401 100644
--- a/recipes-bsp/multitech/mts-io.inc
+++ b/recipes-bsp/multitech/mts-io.inc
@@ -7,7 +7,7 @@ LIC_FILES_CHKSUM = "file://io-module/COPYING;md5=94d55d512a9ba36caa9b7df079bae19
file://io-tool/COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
"
DEPENDS = "virtual/kernel"
-INC_PR = "r10"
+INC_PR = "r0"
SRCREV = "${PV}"
@@ -23,8 +23,9 @@ SRC_URI = " \
"
S = "${WORKDIR}/git"
-inherit module-base
+inherit module
inherit update-rc.d
+inherit autotools
# add this since we aren't using module.bbclass
addtask make_scripts after do_patch before do_compile
@@ -38,17 +39,21 @@ EXTRA_OEMAKE = " -C ${STAGING_KERNEL_DIR} \
"
do_compile () {
+ bbnote make "$@"
+ make "$@"
unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
oe_runmake
}
-PACKAGES = "${PN}"
+PACKAGES = "${PN}-noarch kernel-module-${PN} ${PN}-util ${PN}-util-dbg"
-FILES_${PN} = "${base_libdir}/modules/${KERNEL_VERSION}/extra/mts_io.ko"
-FILES_${PN} += "${sysconfdir}"
-FILES_${PN} += "${libdir}/mts-io-sysfs*"
-FILES_${PN} += "${sbindir}/mts-io-sysfs"
-FILES_${PN}_append_mtcap += "${sbindir}/lora-led-updater"
+FILES_kernel-module-${PN} = "${base_libdir}/modules/${KERNEL_VERSION}/extra/mts_io.ko"
+FILES_${PN}-noarch = "${sysconfdir}"
+FILES_${PN}-noarch += "${libdir}/mts-io-sysfs*"
+FILES_${PN}-noarch += "${sbindir}/mts-io-sysfs"
+FILES_${PN}-noarch_append_mtcap += "${sbindir}/lora-led-updater"
+FILES_${PN}-util += "${sbindir}/mts-util-lora2-reset"
+FILES_${PN}-util-dbg += "/usr/src /usr/sbin/.debug"
INITSCRIPT_NAME = "mts-io"
INITSCRIPT_PARAMS = "start 39 S ."
@@ -56,14 +61,15 @@ INITSCRIPT_PARAMS = "start 39 S ."
PARALLEL_MAKE = ""
fakeroot do_install () {
+ make DESTDIR=${D} install
install -m 0755 -d ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra
# use cp instead of install so the driver doesn't get stripped
- cp io-module/mts_io.ko ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra
- cp io-module/mts_io.h ${STAGING_KERNEL_DIR}/include/linux/
- cp io-module/mts_io.h ${STAGING_INCDIR}/linux/
+ cp ${S}/io-module/mts_io.ko ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra
+ cp ${S}/io-module/mts_io.h ${STAGING_KERNEL_DIR}/include/linux/
+ cp ${S}/io-module/mts_io.h ${STAGING_INCDIR}/linux/
if [ -f io-module/mts_eeprom.h ]; then
- cp io-module/mts_eeprom.h ${STAGING_KERNEL_DIR}/include/linux/
- cp io-module/mts_eeprom.h ${STAGING_INCDIR}/linux/
+ cp ${S}/io-module/mts_eeprom.h ${STAGING_KERNEL_DIR}/include/linux/
+ cp ${S}/io-module/mts_eeprom.h ${STAGING_INCDIR}/linux/
fi
install -d ${D}${sysconfdir}/init.d
@@ -83,8 +89,8 @@ fakeroot do_install () {
install -m 0755 -d ${D}${sbindir}
install -d ${D}${libdir}/mts-io-sysfs
- install -m 0755 io-tool/mts-io-sysfs-inc.sh ${D}${libdir}/mts-io-sysfs
- install -m 0755 io-tool/mts-io-sysfs ${D}${sbindir}/mts-io-sysfs
+ install -m 0755 ${S}/io-tool/mts-io-sysfs-inc.sh ${D}${libdir}/mts-io-sysfs
+ install -m 0755 ${S}/io-tool/mts-io-sysfs ${D}${sbindir}/mts-io-sysfs
install -d ${D}${sysconfdir}/default
install -m 0644 ${WORKDIR}/radio-reset.default ${D}${sysconfdir}/default/radio-reset
@@ -98,24 +104,3 @@ fakeroot do_install_append_mtcap() {
# disable radio-reset for the mtcap hardware
sed -i 's/ENABLED="yes"/ENABLED="no"/g' ${D}${sysconfdir}/default/radio-reset
}
-
-# If we called our package kernel-module-mts-io, we would not need to do this.
-# but since kernel-module is not in the package name, the kernel module class
-# cannot find a package to place the post-install and post-remove script.
-pkg_postinst_${PN} () {
- if [ -z "$D" ]; then
- depmod -a ${MLINUX_KERNEL_VERSION}${MLINUX_KERNEL_EXTRA_VERSION}
- else
- # image.bbclass will call depmodwrapper after everything is installed,
- # no need to do it here as well
- :
- fi
-}
-
-pkg_postrm_${PN} () {
- if [ -z "$D" ]; then
- depmod -a ${MLINUX_KERNEL_VERSION}${MLINUX_KERNEL_EXTRA_VERSION}
- else
- depmodwrapper -a -b $D ${MLINUX_KERNEL_VERSION}${MLINUX_KERNEL_EXTRA_VERSION}
- fi
-}
diff --git a/recipes-bsp/multitech/mts-io/mts-io.init b/recipes-bsp/multitech/mts-io/mts-io.init
index 52c6d1f..048c697 100644
--- a/recipes-bsp/multitech/mts-io/mts-io.init
+++ b/recipes-bsp/multitech/mts-io/mts-io.init
@@ -19,6 +19,9 @@ else
LOGDBG=":"
fi
+SYSFS="/usr/sbin/mts-io-sysfs"
+LRST="/usr/sbin/mts-util-lora2-reset"
+
${LOGDBG} -p daemon.info 'mts-io script'
sysdir=/sys/devices/platform/mts-io
gpiodir=/sys/class/gpio
@@ -26,6 +29,11 @@ port1=${sysdir}/ap1
port2=${sysdir}/ap2
USBRST=${sysdir}/usbhub-reset
+NEED_I2C_RESET=0
+HWVER=""
+HWNAME=""
+HWLVL=""
+
RST[0]="${sysdir}/wifi-bt-reset"
RST[1]="${sysdir}/mtq-reset"
@@ -144,8 +152,8 @@ read_card_info() {
ap2_product_id=$(cat $sysdir/ap2/product-id)
fi
- lora_hw=$(mts-io-sysfs show lora/hw-version 2> /dev/null)
-
+ lora_hw=$(${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
@@ -174,17 +182,38 @@ mfser_init() {
}
+set_gpslink() {
+ hw=$(${SYSFS} show hw-version)
+ hw_name=(${hw//-/ })
+
+ if ! [[ ${hw} =~ ^MTCDT ]] ; then
+ # No GPS (unless MTR, and that is TBD)
+ return
+ fi
+ if [[ ${hw} == MTCDT ]] && [[ ${HWLVL} == 0.0 ]] ; then
+ # No GPS
+ return
+ fi
+ if [[ ${hw_name} == MTCDTIPHP ]] ; then
+ NEED_I2C_RESET=1
+ ln -sf /dev/ttyXRUSB0 /dev/gps0
+ return
+ fi
+ ln -sf /dev/ttyXRUSB2 /dev/gps0
+}
+
case $1 in
start)
/usr/bin/logger -t "mts-io" -p daemon.info -s "Loading mts-io module"
if ! modprobe mts_io ; then
((fail++))
fi
+ set_gpslink # Set GPS symlink.
/usr/bin/logger -t "mts-io" -p daemon.info -s "Resetting system modules"
read_card_info
/bin/busybox usleep $USLPTIME
reset_array
- [ -w /sys/devices/platform/mts-io/radio-reset ] && mts-io-sysfs store radio-reset 0
+ [ -w ${sysdir}/radio-reset ] && ${SYSFS} store radio-reset 0
mfser_init
waitpins
@@ -193,6 +222,14 @@ case $1 in
if ! reset_path $USBRST ; then
((fail++))
fi
+
+ if ((${#lora_hw} > 0)) && [[ ${lora_hw} =~ ^MTCDTIPHP-LORA-2\.1 ]] ; then
+ if [[ -x ${LRST} ]] ; then
+ ${LRST} -g -f
+ else
+ /usr/bin/logger -t "mts-io" -p daemon.err -s "ERROR: Missing ${LRST} -- Cannot initialize LoRa."
+ fi
+ fi
if ((fail == 0)) ; then
echo "OK"
@@ -224,7 +261,7 @@ case $1 in
fi
/bin/busybox usleep $USLPTIME
reset_array
- mts-io-sysfs store radio-reset 0
+ ${SYSFS} store radio-reset 0
mfser_init
if ((fail == 0)) ; then
echo "OK"
diff --git a/recipes-bsp/multitech/mts-io_1.5.16.bb b/recipes-bsp/multitech/mts-io_2.0.0.bb
index 92937cd..92937cd 100644
--- a/recipes-bsp/multitech/mts-io_1.5.16.bb
+++ b/recipes-bsp/multitech/mts-io_2.0.0.bb