Skip to content

Commit f58ac20

Browse files
committed
Longer wait for device on restore mode on macOS, and use DFU helper more
make the timeout 3 times as long on macos
1 parent 7ffdbb0 commit f58ac20

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

restore.sh

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,10 +1120,11 @@ device_get_info() {
11201120
fi
11211121

11221122
if [[ $device_mode == "DFU" && $device_proc == 1 && $device_wtfexit != 1 ]]; then
1123-
log "Found an S5L8900 device in DFU mode. Please re-enter WTF mode for good measure."
1124-
print "* Force restart your device and place it in normal or recovery mode, then run the script again."
1125-
print "* You may also use DFU Mode Helper (--dfuhelper) for entering WTF mode."
1126-
exit
1123+
log "Found an S5L8900 device in $device_mode mode. Your device needs to be in WTF mode to continue."
1124+
print "* Force restart your device and place it in normal or recovery mode, then re-enter WTF mode."
1125+
print "* You can enter WTF mode by doing the DFU mode procedure."
1126+
device_dfuhelper norec WTFreal
1127+
device_find_mode WTFreal 100
11271128
fi
11281129

11291130
# set device_use_vers, device_use_build (where to get the baseband and manifest from for ota/other)
@@ -1375,17 +1376,17 @@ device_dfuhelper2() {
13751376
print "* Press the VOL DOWN button now."
13761377
sleep 1
13771378
print "* Press and hold the $top button."
1378-
for i in {10..01}; do
1379+
for i in {10..1}; do
13791380
echo -n "$i "
13801381
sleep 1
13811382
done
13821383
echo -e "\n$(print "* Press and hold VOL DOWN and $top buttons.")"
1383-
for i in {05..01}; do
1384+
for i in {5..1}; do
13841385
echo -n "$i "
13851386
sleep 1
13861387
done
13871388
echo -e "\n$(print "* Release $top button and keep holding VOL DOWN button.")"
1388-
for i in {08..01}; do
1389+
for i in {8..1}; do
13891390
echo -n "$i "
13901391
device_find_all $1
13911392
opt=$?
@@ -1402,12 +1403,12 @@ device_dfuhelper2() {
14021403

14031404
device_dfuhelper3() {
14041405
echo -e "\n$(print "* Hold TOP and HOME buttons.")"
1405-
for i in {10..01}; do
1406+
for i in {10..1}; do
14061407
echo -n "$i "
14071408
sleep 1
14081409
done
14091410
echo -e "\n$(print "* Release TOP button and keep holding HOME button.")"
1410-
for i in {10..01}; do
1411+
for i in {10..1}; do
14111412
echo -n "$i "
14121413
sleep 1
14131414
done
@@ -1464,9 +1465,13 @@ device_dfuhelper() {
14641465
if [[ $device_type == "iPhone9"* || $device_type == "iPod9,1" ]]; then
14651466
home="VOL DOWN"
14661467
fi
1468+
local sec=10
1469+
if [[ $device_mode == "Recovery" ]]; then
1470+
sec=8
1471+
fi
14671472
echo -e "\n$(print "* Hold $top and $home buttons.")"
1468-
for i in {08..01}; do
1469-
echo -n "$i "
1473+
while (( sec > 0 )); do
1474+
echo -n "$sec "
14701475
device_find_all $1
14711476
opt=$?
14721477
if [[ $opt == 1 ]]; then
@@ -1475,9 +1480,10 @@ device_dfuhelper() {
14751480
return
14761481
fi
14771482
sleep 1
1483+
sec=$((sec-1))
14781484
done
14791485
echo -e "\n$(print "* Release $top button and keep holding $home button.")"
1480-
for i in {08..01}; do
1486+
for i in {8..1}; do
14811487
echo -n "$i "
14821488
device_find_all $1
14831489
opt=$?
@@ -5151,6 +5157,8 @@ restore_prepare() {
51515157
print "* Please put the device in DFU mode after it reboots!"
51525158
sleep 10
51535159
device_mode=
5160+
log "Press Enter/Return when the device reboots and is on black screen, Apple logo, or iTunes logo."
5161+
device_enter_mode DFU
51545162
fi
51555163
log "Finding device in Recovery/DFU mode..."
51565164
until [[ -n $device_mode ]]; do
@@ -5862,6 +5870,12 @@ device_ramdisk() {
58625870
if [[ $1 == "justboot" ]]; then
58635871
log "Device should now boot."
58645872
return
5873+
elif [[ -n $1 && $platform == "macos" ]]; then
5874+
log "Booting, please wait..."
5875+
print "* For some reason, macOS takes way too long to discover iOS devices on some Macs. You may need to wait for a while."
5876+
print "* If it still does not work/recognize your device, try restarting your Mac before trying again."
5877+
device_find_mode Restore 90
5878+
device_iproxy
58655879
elif [[ -n $1 ]]; then
58665880
log "Booting, please wait..."
58675881
device_find_mode Restore 30

0 commit comments

Comments
 (0)