Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

factory_reset.sh does nothing except echos "NG" #116

Closed
frankli998 opened this issue Jul 10, 2019 · 7 comments
Closed

factory_reset.sh does nothing except echos "NG" #116

frankli998 opened this issue Jul 10, 2019 · 7 comments

Comments

@frankli998
Copy link

frankli998 commented Jul 10, 2019

Below is the code of factory_reset.sh, which does nothing except echos "NG" when runned.
I am aware of a similar issue #95
,but the user do not seem to have solved the issue eventually. PS: Suggested launcher-mod is highly likely to cause this issue.
My device is hacked using windows10. Tried re-flash 1.6 firmware or downgrade to 1.4, neither worked for me.

root@FPX-1010:/usr/local/bin# cat factory_reset.sh
#!/bin/sh

. diag_functions

default_destructor ()
{
echo NG
}
trap default_destructor 0 2 11 15

shutdown_screen=/usr/local/etc/factory_reset_$(rawdata --sku_name).bmp
if ! test -f $shutdown_screen; then
exit
fi

opt=$(getopt -o e --long no_epd_init -- "$@")
if test $? -ne 0; then
exit
fi
eval set -- "$opt"

epd_init="gray INIT FULL 0"

while true; do
case "$1" in
-e | --no_epd_init)
unset epd_init
;;
--)
break
;;
*)
exit
;;
esac
shift
done

get_format_specs ()
{
cat <<FormatPartitions
14 mkfs.ext4
16 busybox mkfs.vfat
17 format_userdata.sh
FormatPartitions
}

format_partitions ()
{
get_format_specs |
while read part cmd; do
devnode=/dev/mmcblk0p$part
umount $devnode
eval $cmd $devnode
done >/dev/null 2>&1
}

set_epd ()
{
epd_fb_test $@ >/dev/null 2>&1
}

clear_epd ()
{
if test -n "$epd_init"; then
eval set_epd $epd_init
fi
set_epd setsdwnscr $shutdown_screen

echo 1 > /sys/devices/platform/epdcfb.0/epdc_display_shutdown_screen
}

destructor ()
{
DIAG_disable
}
trap destructor 0 2 11 15

change_boot_mode.sh normal
clear_epd & format_partitions &
wait

@HappyZ
Copy link
Owner

HappyZ commented Jul 10, 2019

you can try to run it manually and see which part didn't work out and exited

I don't think launcher-mod could cause such issue but you can prove me wrong

you need to bypass the official version check, i.e. use my modded firmware to downgrade. Otherwise it won't flash at all. And after flashing, very likely you need to reset by going into "Settings" > "Initialize DPT"

@frankli998
Copy link
Author

frankli998 commented Jul 10, 2019

"I don't think launcher-mod could cause such issue but you can prove me wrong"
Yes, I guess you are right. I reversed launcher-mod and re-flashed but the problem still exists.

"you need to bypass the official version check, i.e. use my modded firmware to downgrade."
I did use your firmware, and it actually downgraded successfully, since the version number changed in settings when I checked.

"You need to reset by going into "Settings" > "Initialize DPT".
I have tried both "going into "Settings" > "Initialize DPT" and run factory_reset.sh under diagnosis mode, neither worked. So what do you mean by running it manually?

@frankli998
Copy link
Author

Another question, is there anything different between "fw" in normal mode and "install-pkg" in diagnosis mode?

@frankli998
Copy link
Author

OK, reason found. In 1.6 full-mod, there is an native application named TestMode, I changed my SKU from Japanese to Chinese, and this seems to disturb factory_reset function. Changing the SKU back to Japanese edition solves the problem.

@chaoskin10
Copy link

how to change sku? thx @frankli998

@frankli998
Copy link
Author

frankli998 commented Jul 18, 2019 via email

@chaoskin10
Copy link

thx a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants