Add some additional sleeping, some checks to know which part produces the message "text file busy"

This commit is contained in:
Cody Cook 2017-10-18 10:11:04 -07:00
commit 0ef2d21602

View file

@ -16,7 +16,7 @@ attempts=0
echo "This tool attempts to resolve RR4360 PSU issues by resetting the SMBus if necessary. It will try 10 times and if it fails, will need to try and be resolved manually."
get_tools() {
printf "Acquiring tools... "
printf "Acquiring latest tools... "
wget -q "$get_inb" -O "$inb"
wget -q "$get_outb" -O "$outb"
chmod +x "$inb" "$outb"
@ -30,9 +30,8 @@ check_problem() {
}
validate_problem() {
if [[ "$problem" -ne 7 ]]
then
printf " SMBus reporting invalid value."
if [[ "$problem" -ne 7 ]]; then
printf " SMBus reporting invalid value; reported: %s" "$problem"
fix
else
echo " The SMBus is currently operating as normal. Exiting script."
@ -43,25 +42,23 @@ fi
fix() {
attempts=$((attempts+1))
printf " Attempt %s at fixing the SMBus..." "$attempts"
"$outb" 0xf00f 3
sleep 1
printf " (#3)... "
"$outb" 0xf00f 3 2>/dev/null
sleep 1
"$outb" 0xf00f 7
printf " (#7)... "
"$outb" 0xf00f 7 2>/dev/null
sleep 1
printf " fix applied. \n"
verify_fix
}
verify_fix(){
if [[ "$attempts" -lt 10 ]]
then
if [[ "$attempts" -lt 10 ]]; then
check_problem
else
printf "Attempted to recover this %s times... seek alternative recovery method." "$attempts"
exit 1
fi
}
get_tools
check_problem