From e1b79b04669d27005083b46d0412dd9984abcbee Mon Sep 17 00:00:00 2001 From: Jason Reiss Date: Mon, 5 Nov 2018 13:54:25 -0600 Subject: mtac-xdot: add xdot-util script --- recipes-bsp/multitech/mtac-xdot/xdot-util | 64 +++++++++++++++++++++++++++++++ recipes-bsp/multitech/mtac-xdot_1.1.0.bb | 11 +++++- 2 files changed, 73 insertions(+), 2 deletions(-) create mode 100755 recipes-bsp/multitech/mtac-xdot/xdot-util diff --git a/recipes-bsp/multitech/mtac-xdot/xdot-util b/recipes-bsp/multitech/mtac-xdot/xdot-util new file mode 100755 index 0000000..678f7a9 --- /dev/null +++ b/recipes-bsp/multitech/mtac-xdot/xdot-util @@ -0,0 +1,64 @@ +#!/bin/bash + +function detect_hw { + if [ ! -h /dev/disk/by-label/XDOT ]; then + echo "XDOT hardware not found" + exit + fi +} + +function flash { + echo "Flashing new firmware" + cp $FIRMWARE_FILE $TEMP_DIR +} + +function mount_xdot { + TEMP_DIR=`mktemp -d` + mount /dev/disk/by-label/XDOT $TEMP_DIR +} + +function reset { + mts-io-sysfs store xdot/reset 0 + mts-io-sysfs store xdot/reset 1 + mts-io-sysfs store xdot/reset -1 &>/dev/null +} + +function usb_reset { + echo 0 > /sys/bus/usb/devices/1-2.1/authorized + sleep 1 + echo 1 > /sys/bus/usb/devices/1-2.1/authorized +} + +function clean_up { + umount $TEMP_DIR + rm -fr $TEMP_DIR +} + +case "$1" in +"flash") + detect_hw + FIRMWARE_FILE=$2 + mts-io-sysfs store xdot/reset -1 &>/dev/null + mount_xdot + flash + clean_up + reset + echo done + ;; +"mount") + detect_hw + mount_xdot + echo Mounted at $TEMP_DIR + ;; +"reset") + detect_hw + reset + ;; +"usb-reset") + detect_hw + usb_reset + ;; +*) ## If no parameters are given, print which are avaiable. + echo "Usage: $0 {flash|mount|reset|usb-reset}" + ;; +esac diff --git a/recipes-bsp/multitech/mtac-xdot_1.1.0.bb b/recipes-bsp/multitech/mtac-xdot_1.1.0.bb index 8fc75d6..23033b5 100644 --- a/recipes-bsp/multitech/mtac-xdot_1.1.0.bb +++ b/recipes-bsp/multitech/mtac-xdot_1.1.0.bb @@ -6,7 +6,7 @@ LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" DEPENDS = "virtual/kernel mtac mts-io" RDEPENDS_${PN} = "kernel-module-mtac" -INC_PR = "r0" +INC_PR = "r1" SRCREV = "${PV}" @@ -14,6 +14,7 @@ PR = "${INC_PR}.0-${MLINUX_KERNEL_VERSION}${MLINUX_KERNEL_EXTRA_VERSION}" SRC_URI = " \ git://git.multitech.net/mtac-xdot.git;protocol=git \ + file://xdot-util \ " S = "${WORKDIR}/git" @@ -32,14 +33,20 @@ do_compile () { oe_runmake } -PACKAGES = "kernel-module-${PN}" + +PACKAGES = "kernel-module-${PN} ${PN}-util" FILES_kernel-module-${PN} = "${base_libdir}/modules/${KERNEL_VERSION}/extra/mtac_xdot.ko" +FILES_${PN}-util += "${sbindir}/xdot-util" + PARALLEL_MAKE = "" fakeroot do_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 ${S}/mtac_xdot.ko ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra + + install -m 0755 -d ${D}${sbindir} + install -m 0755 ${WORKDIR}/xdot-util ${D}${sbindir}/xdot-util } -- cgit v1.2.3