summaryrefslogtreecommitdiff
path: root/recipes-bsp/multitech/mtac-xdot
diff options
context:
space:
mode:
authorJason Reiss <jreiss@multitech.com>2018-11-05 13:54:25 -0600
committerJohn Klug <john.klug@multitech.com>2019-01-10 09:58:01 -0600
commit3d02ca7cd7d33e8caf7bdfb41c22c8ec74f78718 (patch)
tree99c7d051fe2f4e7c0df65cea110da3bc8df880f7 /recipes-bsp/multitech/mtac-xdot
parent2fb76459b111e4179447a04b0336bcb0501b07d3 (diff)
downloadmeta-multitech-3d02ca7cd7d33e8caf7bdfb41c22c8ec74f78718.tar.gz
meta-multitech-3d02ca7cd7d33e8caf7bdfb41c22c8ec74f78718.tar.bz2
meta-multitech-3d02ca7cd7d33e8caf7bdfb41c22c8ec74f78718.zip
mtac-xdot: add xdot-util script
Diffstat (limited to 'recipes-bsp/multitech/mtac-xdot')
-rwxr-xr-xrecipes-bsp/multitech/mtac-xdot/xdot-util64
1 files changed, 64 insertions, 0 deletions
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