Skip to content

Commit

Permalink
Prevent omission of the device response on high-speed cpu. (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
at-wat authored Jul 28, 2017
1 parent ce44ae4 commit cac650a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tf2md3_flash
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,18 @@ if [ x$3 = "x--erased" ]; then
fi

wait_ret(){
while read -t 1 retval; do
while read -t 1.5 retval; do
if [[ $retval == '00P' ]]; then return 1; fi
if [[ $retval == '01Q' ]]; then return 0; fi
if [[ $retval == '0Ee' ]]; then return 0; fi
done < $1
return 0
}
wait_echo(){
sleep $1
echo $2 > $3
return 0
}


if [ x$skip_erase = "xno" ]; then
Expand All @@ -37,7 +42,7 @@ if [ x$skip_erase = "xno" ]; then
while read -t 1 ret < $1; do sleep 0; done

wait_ret $1 & pid=$!
echo '$FLASHERACEA' > $1
wait_echo 0.5 '$FLASHERACEA' $1 &
wait $pid
ret=$?
if [[ $ret -ne 1 ]]; then
Expand All @@ -48,7 +53,7 @@ if [ x$skip_erase = "xno" ]; then
fi

wait_ret $1 & pid=$!
echo '$FLASHERACEB' > $1
wait_echo 0.5 '$FLASHERACEB' $1 &
wait $pid
ret=$?
if [[ $ret -ne 1 ]]; then
Expand Down

0 comments on commit cac650a

Please sign in to comment.