Some fixes to device_entry

This commit is contained in:
LukeZGD 2024-04-30 11:45:14 +08:00
parent 8a3646b5a4
commit 34c832473f

View File

@ -506,9 +506,11 @@ device_entry() {
until [[ -n $device_type ]]; do until [[ -n $device_type ]]; do
read -p "$(input 'Enter device type (eg. iPad2,1): ')" device_type read -p "$(input 'Enter device type (eg. iPad2,1): ')" device_type
done done
if [[ $device_proc != 1 ]]; then
until [[ -n $device_ecid ]] && [ "$device_ecid" -eq "$device_ecid" ]; do until [[ -n $device_ecid ]] && [ "$device_ecid" -eq "$device_ecid" ]; do
read -p "$(input 'Enter device ECID (must be decimal): ')" device_ecid read -p "$(input 'Enter device ECID (must be decimal): ')" device_ecid
done done
fi
} }
device_manufacturing() { device_manufacturing() {
@ -623,15 +625,15 @@ device_get_info() {
fi fi
case $device_mode in case $device_mode in
"DFU" | "Recovery" ) "DFU" | "Recovery" )
if [[ -n $device_argmode ]]; then
device_entry
else
#device_type=$($irecovery -q | grep "PRODUCT" | cut -c 10-) #device_type=$($irecovery -q | grep "PRODUCT" | cut -c 10-)
local ProdCut=7 # cut 7 for ipod/ipad local ProdCut=7 # cut 7 for ipod/ipad
device_type=$($irecovery -qv 2>&1 | grep "Connected to iP" | cut -c 14-) device_type=$($irecovery -qv 2>&1 | grep "Connected to iP" | cut -c 14-)
if [[ $(echo "$device_type" | cut -c 3) == 'h' ]]; then if [[ $(echo "$device_type" | cut -c 3) == 'h' ]]; then
ProdCut=9 # cut 9 for iphone ProdCut=9 # cut 9 for iphone
fi fi
if [[ -n $device_argmode ]]; then
device_entry
else
device_type=$(echo "$device_type" | cut -c -$ProdCut) device_type=$(echo "$device_type" | cut -c -$ProdCut)
device_ecid=$(printf "%d" $($irecovery -q | grep "ECID" | cut -c 7-)) # converts hex ecid to dec device_ecid=$(printf "%d" $($irecovery -q | grep "ECID" | cut -c 7-)) # converts hex ecid to dec
fi fi