From c46dcad4908e53dbae293b2d48e43ce4b2b500d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Mon, 23 Oct 2017 16:52:15 +0200 Subject: [PATCH] Use reenumerate.js instead of jump-to-bootloader.js and make left/blhost-unix.sh handle argument related errors. --- left/build/kds/blhost-unix.sh | 27 +++++++++++++++++++++------ lib/agent | 2 +- right/build/kds/blhost-unix.sh | 2 +- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/left/build/kds/blhost-unix.sh b/left/build/kds/blhost-unix.sh index 1ad1f0d..34db54f 100755 --- a/left/build/kds/blhost-unix.sh +++ b/left/build/kds/blhost-unix.sh @@ -1,8 +1,24 @@ -#!/bin/sh +#!/bin/bash set -e # fail the script if a command fails +if [ -z "$1" ]; then + echo "No firmware image specified" + exit 1 +fi + +firmware_image="`pwd`/$1" + +if [ ${firmware_image: -4} != ".bin" ]; then + echo "Firmware image extension is not .bin" + exit 1 +fi + +if [ ! -f "$firmware_image" ]; then + echo "Firmware image does not exist" + exit 1 +fi + PATH=$PATH:/usr/local/bin # This should make node and npm accessible on OSX. -firmware_image=`pwd`/$1 usb_dir=../../../lib/agent/packages/usb usb_binding=$usb_dir/node_modules/usb/build/Release/usb_bindings.node @@ -14,7 +30,7 @@ case "$(uname -s)" in blhost_path=mac ;; *) - echo 'Your operating system is not supported.' + echo "Your operating system is not supported." exit 1 ;; esac @@ -29,12 +45,11 @@ set -x # echo on #fi $usb_dir/jump-to-slave-bootloader.js -$usb_dir/jump-to-bootloader.js buspal -sleep 2 +$usb_dir/reenumerate.js buspal $blhost get-property 1 $blhost flash-erase-all-unsecure $blhost write-memory 0x0 "$firmware_image" $blhost reset sleep 4 -$usb_dir/send-kboot-command.js reset 0x10 +#$usb_dir/send-kboot-command.js reset 0x10 #../../../lib/bootloader/bin/Tools/blhost/$blhost_path/blhost --usb 0x1d50,0x6121 reset diff --git a/lib/agent b/lib/agent index 1b22a2e..7661700 160000 --- a/lib/agent +++ b/lib/agent @@ -1 +1 @@ -Subproject commit 1b22a2e739ed32d34608b70c3f694ad62b64468a +Subproject commit 76617004579d578b8f99955eb7d4553f77848878 diff --git a/right/build/kds/blhost-unix.sh b/right/build/kds/blhost-unix.sh index 393d987..b8b1f1f 100755 --- a/right/build/kds/blhost-unix.sh +++ b/right/build/kds/blhost-unix.sh @@ -28,7 +28,7 @@ if [ ! -f $usb_binding ]; then exit 1 fi -$usb_dir/jump-to-bootloader.js +$usb_dir/reenumerate.js bootloader $blhost flash-security-disable 0403020108070605 $blhost flash-erase-region 0xc000 475136 $blhost flash-image $firmware_image