summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2018-04-10 18:08:59 -0500
committerJohn Klug <john.klug@multitech.com>2018-04-10 18:08:59 -0500
commit17d42b12932554635ee568c7758805c05a83f7ba (patch)
treeb4ec4eed00ca60b33d592d1d843e71dbb64a8bd0
parent2309f997e608a6c9a664e1ab003750005e836c59 (diff)
downloadmeta-multitech-17d42b12932554635ee568c7758805c05a83f7ba.tar.gz
meta-multitech-17d42b12932554635ee568c7758805c05a83f7ba.tar.bz2
meta-multitech-17d42b12932554635ee568c7758805c05a83f7ba.zip
Split the mts-io package into driver module, binary (util), and scripting (noarch)
-rw-r--r--recipes-bsp/multitech/mts-io.inc44
-rw-r--r--recipes-bsp/multitech/mts-io/mts-io.init37
-rw-r--r--recipes-bsp/multitech/mts-io_2.0.0.bb (renamed from recipes-bsp/multitech/mts-io_1.6.0.bb)0
3 files changed, 58 insertions, 23 deletions
diff --git a/recipes-bsp/multitech/mts-io.inc b/recipes-bsp/multitech/mts-io.inc
index bce46e5..9d85ed5 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 = "r11"
+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,23 @@ EXTRA_OEMAKE = " -C ${STAGING_KERNEL_DIR} \
"
do_compile () {
+ bbnote make "$@"
+ make "$@"
unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
oe_runmake
+
}
-PACKAGES = "${PN}"
-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"
+PACKAGES = "${PN}-noarch kernel-module-${PN} ${PN}-util ${PN}-util-dbg"
+
+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,6 +63,7 @@ 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
@@ -99,6 +107,22 @@ fakeroot do_install_append_mtcap() {
sed -i 's/ENABLED="yes"/ENABLED="no"/g' ${D}${sysconfdir}/default/radio-reset
}
-pkg_postins_${PN} () {
- /sbin/depmod -a
+# These post install scripts came from Yocto 2.2. These are automatically
+# generated in newer versions of Yocto.
+pkg_postinst_kernel-module-${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_kernel-module-${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 5ceb04a..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
@@ -27,6 +30,10 @@ 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"
@@ -145,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
@@ -176,18 +183,18 @@ mfser_init() {
}
set_gpslink() {
- HWVER=$(mts-io-sysfs show hw-version)
- HWNAME=(${HWVER//-/ })
- HWLVL=(${HWVER#${HWNAME}-})
- if ! [[ ${HWNAME} =~ ^MTCDT ]] ; then
+ hw=$(${SYSFS} show hw-version)
+ hw_name=(${hw//-/ })
+
+ if ! [[ ${hw} =~ ^MTCDT ]] ; then
# No GPS (unless MTR, and that is TBD)
return
fi
- if [[ ${HWNAME} == MTCDT ]] && [[ ${HWLVL} == 0.0 ]] ; then
+ if [[ ${hw} == MTCDT ]] && [[ ${HWLVL} == 0.0 ]] ; then
# No GPS
return
fi
- if [[ ${HWNAME} == MTCDTIPHP ]] ; then
+ if [[ ${hw_name} == MTCDTIPHP ]] ; then
NEED_I2C_RESET=1
ln -sf /dev/ttyXRUSB0 /dev/gps0
return
@@ -201,12 +208,12 @@ case $1 in
if ! modprobe mts_io ; then
((fail++))
fi
- set_gpslink
+ 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
@@ -216,8 +223,12 @@ case $1 in
((fail++))
fi
- if ((NEED_I2C_RESET == 1)) ; then
- logger -s -p daemon.notice -t mts-io "TBD -- Need I2C reset here."
+ 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
@@ -250,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.6.0.bb b/recipes-bsp/multitech/mts-io_2.0.0.bb
index 92937cd..92937cd 100644
--- a/recipes-bsp/multitech/mts-io_1.6.0.bb
+++ b/recipes-bsp/multitech/mts-io_2.0.0.bb