diff --git a/README.md b/README.md index 53393f1..fcf2d04 100644 --- a/README.md +++ b/README.md @@ -4,18 +4,12 @@ We likely have some fun stuff here! -Note on 12/12/2018: (T_T sad news) I have soft-bricked my DPT and based on it's current stage it couldn't recover. Unfortunately, mine is out of warranty and I'm not paying over $400 more for a replacement (talked to S.O.N.Y. about this). I would appreciate some donations so I can afford the cost. But if not, it's okay, as we also get many talented others, and we got the Taobao PKGs. I'll also ask friends to look at bricked device from the hardware side. - -Things that would greatly help new comers: -- [ ] Flashsable PKGs without going into diagnosis mode (checkout the example [here](https://github.com/HappyZ/dpt-tools/tree/master/fw_updater_packer_unpacker/pkg_example)) -- [ ] A clean system modification over taobao PKGs (as they have validations..) - -Thanks for your understanding, and thank all who donated. Keep up the active discussions in XDA and Issues section here. Meanwhile, please all have a great Christmas! +Note on 12/09/2018: In short, I soft-brick my DPT while creating my own pkg.. so I won't be able to make much progress until I fix that (likely I need to send the device to DPT support). Meanwhile, please have a great Christmas! # 0x1 Special Thanks Greatly thank -* [shankerzhiwu and his friend at XDA](https://forum.xda-developers.com/general/help/idea-to-root-sonys-e-reader-dpt-rp1-t3654725/post78153143) who made the USB hack possible +* [shankerzhiwu and his/her friend at XDA](https://forum.xda-developers.com/general/help/idea-to-root-sonys-e-reader-dpt-rp1-t3654725/post78153143) who made the USB hack possible * [octavianx](https://github.com/octavianx/Unpack-and-rebuild-the-DPT-RP1-upgrade-firmware) who sheds light on the hack * [janten](https://github.com/janten/dpt-rp1-py) who initiates the commandline tool for web APIs * `silvertriclops` who points out bugs in `get-su-bin` and "forces" me to test it :D @@ -64,8 +58,6 @@ python dpt-tools.py --diagnosis ### At Diagnosis Mode -To ***patch updater bash***, just run `patch-updater-bash`. - To ***obtain ADB access***, we need to flash a modified `boot.img` (`boot-1.4.01.16100-mod-happyz-181118.img`). It is confirmed to work on RP1 version `1.4.01.16100` and on CP1 version `1.4.02.09061` (thanks to `mingming1222`). @@ -73,17 +65,17 @@ It is confirmed to work on RP1 version `1.4.01.16100` and on CP1 version `1.4.02 ### If your device is not on above versions, do NOT flash ### 1: Backup boot image: via `backup-bootimg` ### The backup image on device is at `/root/boot.img.bak` -### It also mounts a disk so you can copy a backup to local folder -### Carefully confirm the MD5 of the pulled file. +### It also automatically pulls the backup to local folder +### It takes about 15-20min. Carefully confirm the MD5 of the pulled file. ### If not correct, backup AGAIN. ### 2: Apply the new boot image: via `restore-bootimg` ### Use `python_api/assets/boot-1.4.01.16100-mod-happyz-181118.img` -### Carefully confirm the MD5 of the pushed file. +### It takes about 15-20min. Carefully confirm the MD5 of the pushed file. ### If not correct, do NOT type `yes` to restore it. ``` -It may appear to be `unauthorized`. Since I did not include a vulnerable `adbd`, I put a master public key in DPT at `/adb_keys`. This causes an insecure ADB due to `/adb_keys`. TODO: remove this and add user's own keys to `/data/misc/adb/` instead. +It may appear to be `unauthorized`. Since I did not include a vulnerable `adbd`, I put a master public key in DPT at `/adb_keys`. This causes an insecure ADB due to `/adb_keys`. I will fix this in later updates. To address `unauthorized`, on your computer (Mac or Linux), ``` @@ -201,12 +193,6 @@ mv ExtMgr.db-journal ExtMgr.db-journal_bak ``` 6. Reboot -### Guide to use Taobao PKG - -(FYI, I personally prefer a clean system with changes I know, over using their PKGs with unknown changes.) - -People have shared their system.img with the extracted apps from taobao pkg. Check [#37](https://github.com/HappyZ/dpt-tools/issues/37) out. - # 0xF Mission Impossible diff --git a/dpt-tools.py b/dpt-tools.py index 63067e6..6a479d4 100644 --- a/dpt-tools.py +++ b/dpt-tools.py @@ -107,8 +107,6 @@ def main(): "Make sure your id, key, and ip addresses are correct." ) exit(1) - dpt.client_id_fp = args.get('dpt_id', "") - dpt.key_fp = args.get('dpt_key', "") interactive(dpt, diagnosis=args.get('diagnosis', False)) diff --git a/fw_updater_packer_unpacker/.gitignore b/fw_updater_packer_unpacker/.gitignore index 65e3ba2..6c9c348 100644 --- a/fw_updater_packer_unpacker/.gitignore +++ b/fw_updater_packer_unpacker/.gitignore @@ -1 +1,2 @@ +*.pkg test/ diff --git a/fw_updater_packer_unpacker/README.md b/fw_updater_packer_unpacker/README.md index cea4a34..6de4171 100644 --- a/fw_updater_packer_unpacker/README.md +++ b/fw_updater_packer_unpacker/README.md @@ -75,3 +75,5 @@ Then type `fw` and follow the instruction. # Known Issues * After reboot, it will appear errors saying update failed. But PKG is actually applied. + +* Not supporting animations yet. diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater.pkg b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater.pkg deleted file mode 100644 index 14f7f3e..0000000 Binary files a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater.pkg and /dev/null differ diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/animation.sh b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/animation.sh deleted file mode 100755 index d6de63c..0000000 --- a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/animation.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh - -epd_cmd() -{ - epd_fb_test $@ >/dev/null 2>&1 -} - -dispClear() -{ - epd_cmd gray DU PART 0 -} - -get_screen_resolution() -{ - head -1 /sys/class/graphics/fb0/modes | sed -e 's/^.*://' -e 's/p.*$//' -e 's/x/ /' -} - -get_screen_width() -{ - set `get_screen_resolution` - echo $1 -} - -get_screen_height() -{ - set `get_screen_resolution` - echo $2 -} - -LOG_FP=$1 - -dispClear - -while [ 1 ] -do - for file in `\find $(dirname ${0})/images -name '*.bmp' | sort`; do - epd_cmd file GC16 PART $file - echo "[anim] displaying $file" >> $LOG_FP - sleep 1 - done -done - -exit 0 diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/boot-1.4.01.16100-mod-181118.img b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/boot-1.4.01.16100-mod-181118.img deleted file mode 100644 index 4ca9b9f..0000000 Binary files a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/boot-1.4.01.16100-mod-181118.img and /dev/null differ diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/boot-1.4.01.16100-mod-181118.img.md5 b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/boot-1.4.01.16100-mod-181118.img.md5 deleted file mode 100644 index 3a8297e..0000000 --- a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/boot-1.4.01.16100-mod-181118.img.md5 +++ /dev/null @@ -1 +0,0 @@ -cad85861a484e850a0893a2e1d0c1b98 diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/chkver.sh b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/chkver.sh deleted file mode 100755 index 6b82de1..0000000 --- a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/chkver.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -# usage ./chkver.sh - -CURENT_VER=`rawdata --version | sed -e 's/[^0-9]//g' | cut -b 1-8` -PACKAGE_VER=`cat $1 | sed -e 's/[^0-9]//g' | cut -b 1-8` -LOG_FP=$2 - -echo "Current version: $CURENT_VER" >> $LOG_FP -echo "Package version: $PACKAGE_VER" >> $LOG_FP - -# if [ 10 -ge 10 ]; then echo "true"; else echo "false"; fi # true -# if [ 10 -ge 11 ]; then echo "true"; else echo "false"; fi # false -# if [ 10 -ge 9 ]; then echo "true"; else echo "false"; fi # true - -if [ $PACKAGE_VER -ge $CURENT_VER ] -then - # echo "true"; - echo "chkver.sh passed!" >> $LOG_FP - exit 0 -else - # echo "false"; - echo "chkver.sh failed!" >> $LOG_FP - exit 1 -fi - - diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/eufwupdater.sh b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/eufwupdater.sh deleted file mode 100755 index 33ad9b9..0000000 --- a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/eufwupdater.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh - -# initialization -UPDATER_BASE=$(dirname ${0}) -ANIM_PID=0 -EPOCH=$(date +%s) -LOG_FP=/root/updater_$EPOCH.log -echo "" > $LOG_FP - -# start animation script -${UPDATER_BASE}/animation.sh $LOG_FP & -ANIM_PID=$! -sleep 2 - -# version check -${UPDATER_BASE}/chkver.sh ${UPDATER_BASE}/version $LOG_FP -if [ "$?" -eq 0 ] -then - echo "[updater.sh] version check OK" >> $LOG_FP -else - echo "[updater.sh] version check NG (TBD)" >> $LOG_FP - # strange version Package, so we must be install this package !! - exit 0; -fi -sync - -# flash customized boot img -echo "[updater.sh] writing boot.img.." >> $LOG_FP -if [ -f ${UPDATER_BASE}/boot-1.4.01.16100-mod-181118.img ] ; -then - dd if=${UPDATER_BASE}/boot-1.4.01.16100-mod-181118.img of=/dev/mmcblk0p8 bs=4M - sync -else - echo "[updater.sh] desired boot.img not exit; nothing did to boot partition" >> $LOG_FP -fi - -# verify the boot img success -RET=0 -${UPDATER_BASE}/verify.sh ${UPDATER_BASE} $LOG_FP -if [ $? -eq 0 ] -then - echo "[updater.sh] verify check OK" >> $LOG_FP -else - RET=$? - echo "[updater.sh] verify check NG, shudown, will retry upon boot up" >> $LOG_FP -fi - -# # enable su in adb shell -# echo "[updater.sh] run getsu.sh" >> $LOG_FP -# ${UPDATER_BASE}/getsu.sh $LOG_FP -# if [ ! $? -eq 0 ] -# then -# # shutdown, remove update, error occurs -# RET=$? -# fi - -sleep 2 - -# stop animation -if [ $ANIM_PID -ne 0 ] -then - kill $ANIM_PID -fi - -# if returned 1, will shutdown -exit $RET diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status01.bmp b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status01.bmp deleted file mode 100755 index 1353c8b..0000000 Binary files a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status01.bmp and /dev/null differ diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status02.bmp b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status02.bmp deleted file mode 100755 index 2b97c2a..0000000 Binary files a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status02.bmp and /dev/null differ diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status03.bmp b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status03.bmp deleted file mode 100755 index 3d49761..0000000 Binary files a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status03.bmp and /dev/null differ diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status04.bmp b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status04.bmp deleted file mode 100755 index 81ae252..0000000 Binary files a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status04.bmp and /dev/null differ diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status05.bmp b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status05.bmp deleted file mode 100755 index 052759d..0000000 Binary files a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status05.bmp and /dev/null differ diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status06.bmp b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status06.bmp deleted file mode 100755 index f335ccd..0000000 Binary files a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status06.bmp and /dev/null differ diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status07.bmp b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status07.bmp deleted file mode 100755 index 17f2960..0000000 Binary files a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status07.bmp and /dev/null differ diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/usbmemupdater.sh b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/usbmemupdater.sh deleted file mode 100755 index 81c13bf..0000000 --- a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/usbmemupdater.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -UPDATER_BASE=$(dirname ${0}) -${UPDATER_BASE}/eufwupdater.sh -# tentative exit -exit $? \ No newline at end of file diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/verify.sh b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/verify.sh deleted file mode 100755 index 1bda461..0000000 --- a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/verify.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -sync -echo 3 > /proc/sys/vm/drop_caches - -LOG_FP=$2 - -BOOT_IMG_SIZE=`stat -c%s $1/boot-1.4.01.16100-mod-181118.img` - -BLK8_MD5=`dd if=/dev/mmcblk0p8 bs=$BOOT_IMG_SIZE count=1 | md5sum | cut -d " " -f1` - -BOOT_MD5=`cat $1/boot-1.4.01.16100-mod-181118.img.md5` - -echo "BLK08=$BLK8_MD5" >> $LOG_FP -echo " BOOT=$BOOT_MD5" >> $LOG_FP - - -if [ $BLK8_MD5 = $BOOT_MD5 ]; -then -echo "Verify OK" >> $LOG_FP -exit 0; -fi -echo "Verify NG" >> $LOG_FP -exit 1; - - diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/version b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/version deleted file mode 100644 index 46f3713..0000000 --- a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/version +++ /dev/null @@ -1 +0,0 @@ -1.4.01.16100 general \ No newline at end of file diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/aes.key b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/aes.key deleted file mode 100644 index 479d751..0000000 --- a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/aes.key +++ /dev/null @@ -1 +0,0 @@ -2714eb0d158c256c4868ef04f93cb50c56d0092c8df6285304b8ddb78d5f1ef9 diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/decrypted_pkg.tar.gz b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/decrypted_pkg.tar.gz deleted file mode 100644 index e3c53bb..0000000 Binary files a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/decrypted_pkg.tar.gz and /dev/null differ diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/init_vector b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/init_vector deleted file mode 100644 index f49f0ba..0000000 --- a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/init_vector +++ /dev/null @@ -1 +0,0 @@ -55460c2e3abf285af96fe660c0880bc diff --git a/python_api/libDPT.py b/python_api/libDPT.py index a6c8d2f..1e9a733 100644 --- a/python_api/libDPT.py +++ b/python_api/libDPT.py @@ -25,8 +25,6 @@ class DPT(): 8444/tcp open unknown 8445/tcp open unknown ''' - self.client_id_fp = "" - self.key_fp = "" self.debug = debug if addr is None: self.addr = "digitalpaper.local" @@ -104,35 +102,19 @@ class DPT(): resp = self.diagnosis_write("rm {}".format(fp)) return not (resp == "") - def diagnosis_md5sum_file(self, fp, isPartition=False): + def diagnosis_md5sum_file(self, fp): ''' get md5sum of a file ''' if not self.diagnosis_isfile(fp): return "" - if isPartition: - fsize = self.diagnosis_get_file_size(fp) - cmd = "dd if={0} bs={1} count=1 | md5sum".format(fp, fsize) - resp = self.diagnosis_write(cmd).splitlines() - else: - resp = self.diagnosis_write("md5sum {}".format(fp)).splitlines() + resp = self.diagnosis_write("md5sum {}".format(fp)).splitlines() try: return resp[1].split()[0] except BaseException as e: self.err_print(str(e)) return "" - def diagnosis_get_file_size(self, fp): - ''' - linux to get file size - ''' - cmd = "stat -c%%s {0}".format(fp) - try: - return int(self.diagnosis_write(cmd).splitlines()[1]) - except BaseException as e: - self.err_print(str(e)) - return -1 - def diagnosis_isfile(self, fp): ''' check if file exists given file path @@ -160,7 +142,7 @@ class DPT(): mkdir -p folder ''' if self.diagnosis_isfolder(folder): - self.info_print("{} already exist, we are fine".format(folder)) + self.info_print("{} already exist".format(folder)) return True if not self.diagnosis_write('mkdir -p {}'.format(folder)): self.err_print('Failed to create folder {}'.format(folder)) @@ -230,9 +212,6 @@ class DPT(): return ofp def diagnosis_restore_boot(self, fp="/root/boot.img.bak", fromSD=False): - ''' - restore from desired boot img backup - ''' if fromSD: self.diagnosis_mount_sd() if not self.diagnosis_isfile(fp): @@ -240,8 +219,6 @@ class DPT(): if not self.diagnosis_isfile(fp): self.err_print("{} does not exist".format(fp)) return False - md5 = self.diagnosis_md5sum_file(fp) - self.info_print("{0} MD5: {1}".format(fp, md5)) cmd = "dd if='{0}' of={1} bs=4M".format(fp, self.par_boot) self.info_print("Fingercrossing.. Do NOT touch the device!") # need to be extra careful here @@ -251,33 +228,6 @@ class DPT(): self.diagnosis_umount_sd() return not (resp == "") - def diagnosis_restore_system( - self, fp="/root/system.img", fromSD=True, isSparse=True - ): - ''' - restore from system.img - ''' - if fromSD: - self.diagnosis_mount_sd() - if not self.diagnosis_isfile(fp): - fp = "{0}/{1}".format(self.sd_tmp_mpt, fp) - if not self.diagnosis_isfile(fp): - self.err_print("{} does not exist".format(fp)) - return False - md5 = self.diagnosis_md5sum_file(fp) - self.info_print("{0} MD5: {1}".format(fp, md5)) - if isSparse: - cmd = "extract_sparse_file '{0}' '{1}'".format(fp, self.par_system) - else: - cmd = "dd if='{0}' of={1} bs=4M".format(fp, self.par_system) - self.info_print("Fingercrossing.. Do NOT touch the device!") - # need to be extra careful here - resp = self.diagnosis_write(cmd, timeout=99999) - self.info_print(resp) - if fromSD: - self.diagnosis_umount_sd() - return not (resp == "") - def diagnosis_start_mass_storage(self): ''' run mass_storage diff --git a/python_api/libInteractive.py b/python_api/libInteractive.py index 8ffb7de..612f406 100644 --- a/python_api/libInteractive.py +++ b/python_api/libInteractive.py @@ -125,11 +125,6 @@ def obtain_diagnosis_access(dpt): except BaseException as e: dpt.err_print(str(e)) return False - if not dpt.authenticate(dpt.client_id_fp, dpt.key_fp): - dpt.err_print("Cannot reauthenticate after reboot") - dpt.err_print("Client id filepath: {}".format(dpt.client_id_fp)) - dpt.err_print("Client key filepath: {}".format(dpt.key_fp)) - return False # step 2: reset root password if not reset_root_password(dpt): return False @@ -157,9 +152,8 @@ Supported commands: `push-file` -- transfer file to DPT at 800bps (=100Bps) `pull-file` -- transfer file from DPT `backup-bootimg` -- backup the boot img and download it to local device - `restore-bootimg` -- restore the boot img (use `boot.img.bak`) - `restore-systemimg` -- restore the system img (use `system.img`) - `get-su-bin` -- enable `su` (root) in adb + `restore-bootimg` -- restore the boot img + `get-su-bin` -- enable `su` (root) in adb (beta, not well tested) `exit`/`quit` -- leave the tool and many unix cmds (do not support less/head) """) @@ -482,37 +476,6 @@ def diagnosis_get_su_bin(dpt): dpt.info_print("Done!") -def diagnosis_restore_systemimg(dpt): - ''' - restore system img - ''' - dpt.diagnosis_start_mass_storage() - dpt.info_print("Your computer shall have mounted a disk.") - dpt.info_print("Please copy your `system.img` there.") - try: - input("When done, plz eject disk and press Enter to continue..") - dpt.diagnosis_stop_mass_storage() - except KeyboardInterrupt: - dpt.err_print("Nothing happened..") - dpt.diagnosis_stop_mass_storage() - return False - try: - resp = input('> Is it a sparse image? [yes/no]: ') - isSparse = (resp == 'yes') - resp = input('> Confirm to continue? [yes/no]: ') - except KeyboardInterrupt: - dpt.err_print("Nothing happened..") - return False - if resp == 'yes': - if dpt.diagnosis_restore_system(fp="system.img", isSparse=isSparse): - dpt.info_print("Success!") - return True - dpt.err_print("Failed..") - return False - dpt.err_print("Nothing happened..") - return False - - def diagnosis_restore_bootimg(dpt, usetmpfp=None, bootimgfp=None): ''' restore boot img @@ -530,7 +493,7 @@ def diagnosis_restore_bootimg(dpt, usetmpfp=None, bootimgfp=None): dpt.info_print("Your computer shall have mounted a disk.") dpt.info_print("Please copy your `boot.img.bak` there.") try: - input("When done, plz eject disk and press Enter to continue..") + input("While done, please press Enter key to continue..") dpt.diagnosis_stop_mass_storage() except KeyboardInterrupt: dpt.err_print("Nothing happened..") @@ -538,11 +501,7 @@ def diagnosis_restore_bootimg(dpt, usetmpfp=None, bootimgfp=None): return False # remotefp = diagnosis_push_file(dpt, folder="/tmp", overwrite=True) # if remotefp is not None: - try: - resp = input('> Confirm to continue? [yes/no]: ') - except KeyboardInterrupt: - dpt.err_print("Nothing happened..") - return False + resp = input('> Confirm to continue? [yes/no]: ') if resp == 'yes': if dpt.diagnosis_restore_boot(fp="boot.img.bak", fromSD=True): dpt.info_print("Success!") @@ -590,9 +549,6 @@ def diagnosis_cmd(dpt): elif cmd == 'restore-bootimg': diagnosis_restore_bootimg(dpt) continue - elif cmd == 'restore-systemimg': - diagnosis_restore_systemimg(dpt) - continue elif cmd == 'get-su-bin': diagnosis_get_su_bin(dpt) continue @@ -616,7 +572,7 @@ def diagnosis_mode(dpt): enter diagnosis mode ''' dpt.info_print('Steps to enter diagnosis mode:') - dpt.info_print('1. Turn of DPT') + dpt.info_print('1. Turn off DPT') dpt.info_print('2. Hold HOME button') dpt.info_print('3. Press POWER button once. Then light blinks yellow') dpt.info_print('4. Release HOME button, a black square will show up')