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

Issues on xflash - timeout on reading/ writing flash #49

Closed
bkerler opened this issue Sep 3, 2021 · 5 comments
Closed

Issues on xflash - timeout on reading/ writing flash #49

bkerler opened this issue Sep 3, 2021 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@bkerler
Copy link
Owner

bkerler commented Sep 3, 2021

c:\xxxx\pytyon mtk w seccfg seccfg.bin

...........

Port - Hint:

Power off the phone before connecting.
For brom mode, press and hold vol up, vol dwn, or all hw buttons and connect usb.
For preloader mode, don't press any hw button and connect usb.

........Port - Device detected :)
Preloader - CPU: MT6765(Helio P35/G35)
Preloader - HW version: 0x0
Preloader - WDT: 0x10007000
Preloader - Uart: 0x11002000
Preloader - Brom payload addr: 0x100a00
Preloader - DA payload addr: 0x201000
Preloader - CQ_DMA addr: 0x10212000
Preloader - Var1: 0x25
Preloader - HW subcode: 0x8a00
Preloader - HW Ver: 0xca00
Preloader - SW Ver: 0x0
Preloader - Disabling Watchdog...
Preloader - HW code: 0x766
Preloader - Target config: 0xe5
Preloader - SBC enabled: True
Preloader - SLA enabled: False
Preloader - DAA enabled: True
Preloader - SWJTAG enabled: True
Preloader - EPP_PARAM at 0x600 after EMMC_BOOT/SDMMC_BOOT: False
Preloader - Root cert required: False
Preloader - Mem read auth: True
Preloader - Mem write auth: True
Preloader - Cmd 0xC8 blocked: True
Preloader - ME_ID: D1F5E12C4125DBD34CB67347674A7FA5
Preloader - SOC_ID: AB2B5E1F5E7CAA11581E62B5A68C824FB7CABF275DDED1F1259C4771959FA560
PLTools - Loading payload from D:\Tools\PortableGit\mtkclient\mtkclient\payloads\mt6765_payload.bin, 0x264 bytes
PLTools - Kamakiri / DA Run
Kamakiri - Trying kamakiri2..
Kamakiri - Done sending payload...
PLTools - Successfully sent payload: D:\Tools\PortableGit\mtkclient\mtkclient\payloads\mt6765_payload.bin
Port - Device detected :)
Main - Device is protected.
Main - Device is in BROM mode. Trying to dump preloader.
DAXFlash - Uploading stage 1...
DAXFlash - Successfully uploaded stage 1, jumping ..
Preloader - Jumping to 0x200000
Preloader - Jumping to 0x200000: ok.
DAXFlash - Successfully received DA sync
DAXFlash - DRAM config needed for : 1501004448364441
DAXFlash - Uploading stage 2...
DAXFlash - Successfully uploaded stage 2
DAXFlash - EMMC FWVer: 0x0
DAXFlash - EMMC CID: 1501004448364441420891f5ceb928b3
DAXFlash - EMMC Boot1 Size: 0x400000
DAXFlash - EMMC Boot2 Size: 0x400000
DAXFlash - EMMC GP1 Size: 0x0
DAXFlash - EMMC GP2 Size: 0x0
DAXFlash - EMMC GP3 Size: 0x0
DAXFlash - EMMC GP4 Size: 0x0
DAXFlash - EMMC RPMB Size: 0x1000000
DAXFlash - EMMC USER Size: 0xe8f800000
DAXFlash - DA-CODE : 0x666D0
Progress: |--------------------------------------------------| 0.0% Write (Sector 0 of 16384) 0.00 MProgress: |████████████--------------------------------------| 25.0% Write (Sector 4096 Progress: |█████████████████████████-------------------------| 50.0% Write Progress: |██████████████████████████████████████------------| 75.0% Write (Sector 12288 of 16384) 1999.67 MB/sDAXFlash
DAXFlash - [LIB]: �[31munpack requires a buffer of 12 bytes�[0m
Failed to write seccfg.bin to sector 1048576 with sector count 16384.
Traceback (most recent call last):
File "D:\Tools\PortableGit\mtkclient\mtk", line 1528, in
mtk = Main(args).run()
File "D:\Tools\PortableGit\mtkclient\mtk", line 882, in run
mtk.daloader.close()
File "D:\Tools\PortableGit\mtkclient\mtkclient\Library\mtk_daloader.py", line 80, in close
return self.da.close()
File "D:\Tools\PortableGit\mtkclient\mtkclient\Library\mtk_daxflash.py", line 834, in close
status=self.status()
File "D:\Tools\PortableGit\mtkclient\mtkclient\Library\mtk_daxflash.py", line 228, in status
magic, datatype, length = unpack("<III", hdr)
struct.error: unpack requires a buffer of 12 bytes

Originally posted by @330wang in #32 (comment)

@bkerler bkerler self-assigned this Sep 3, 2021
@bkerler bkerler added the bug Something isn't working label Sep 3, 2021
@bkerler
Copy link
Owner Author

bkerler commented Sep 3, 2021

This bug is known. It happens due to port timeouts. A patch that was fixing this issues was reverted recently as if failed on other devices.

@rebainoor
Copy link

Can you test libusb-win32 filtre with some CPU i Think will resolve usb timeout

@bkerler
Copy link
Owner Author

bkerler commented Oct 2, 2021

Actually this shouldn't happen with the new version, can you confirm ? If it does persist, did you try a different usb port / hub ?

@QuadTriangle
Copy link

QuadTriangle commented Oct 2, 2021

  1. Remove the USB from the phone before running every command
  2. Run the command
  3. Connect the USB to the phone by pressing vol+
  4. Repeat

This fixes my problem: struct.error: unpack requires a buffer of 12 bytes


@bkerler Please use logging.FileHandler(logfilename, encoding='utf-8'). Windows gives encoding error without encoding parameter in FileHandler.

@bkerler Thank you for creating this awesome tool 🥰

@bkerler bkerler closed this as completed Nov 30, 2021
@mohamadali-halwani
Copy link

  1. Remove the USB from the phone before running every command

    1. Run the command

    2. Connect the USB to the phone by pressing vol+

    3. Repeat

This fixes my problem: struct.error: unpack requires a buffer of 12 bytes

@bkerler Please use logging.FileHandler(logfilename, encoding='utf-8'). Windows gives encoding error without encoding parameter in FileHandler.

@bkerler Thank you for creating this awesome tool 🥰

did that many times with no success, my phone is redmi 9a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants