8000 xmlflash: tolerate stock DAs without DA.SLA property or ext patch points by lukejenkins · Pull Request #454 · bkerler/mtkclient · GitHub
[go: up one dir, main page]

Skip to content

xmlflash: tolerate stock DAs without DA.SLA property or ext patch points - #454

Merged
bkerler merged 1 commit into
bkerler:mainfrom
lukejenkins:fix/xml-stock-da-unsupported-sla
Nov 20, 2026
Merged

bkerler merged 1 commit into
bkerler:mainfrom
lukejenkins:fix/xml-stock-da-unsupported-sla

Conversation

@lukejenkins
Copy link
Copy Markdown
Contributor

xmlflash: tolerate stock DAs without DA.SLA property or ext patch points

Fixes the "stage 2 loads fine, then every command hangs/crashes" symptom reported for
MT6880/MT6890 (hwcode 0x992) eMMC boards with stock vendor DAs (#302, #88, see also #445).

Problem

With an unfused 0x992 target (target config 0x0) and a stock V6 DA_BR.bin from a
vendor T750 package (tested with a Quectel T750 build MTK_DA_v6_2023-12-20 and a
Fibocom FM360 build MTK_DA_v6_2021-05-07), stage 1 and stage 2 upload fine and
CMD:NOTIFY-INIT-HW completes, but:

  1. CMD:GET-SYS-PROPERTY with DA.SLA is answered with ERR!UNSUPPORTED.
    send_command(..., noack=True) already consumes the CMD:END / CMD:START
    pair for that case and returns False, but get_sys_property() ignores the
    return value and calls get_command_result() again, so it waits on an empty
    pipe, times out (xread: Wrong length), and check_sla() then crashes with
    AttributeError: 'bool' object has no attribute 'decode'.

  2. With that fixed, xmlft.patch() raises
    TypeError: '<' not supported between instances of 'NoneType' and 'int' from
    get_next_bl_from_off(), because find_register_xml_cmd_func() can't find its
    pattern in this vendor DA2. This aborts the whole session even though the stock
    DA2 is fully usable without the extension.

Change

  • get_sys_property(): return None if send_command() didn't return True.
  • check_sla(): treat None/False as "DA XML SLA disabled".
  • upload_da(): wrap self.xmlft.patch(); on exception log it, skip the CUSTOM
    extension upload (daext stays False) and continue with stock DA2 commands.

Tested

MT6890 (hwcode 0x992, subcode 0x8a00, hwver 0xca01), 16 GB eMMC, preloader mode:
printgpt, rl (all 57 GPT partitions, ~14 MB/s; two passes byte-identical),
ro --parttype boot1/boot2. Read-only; no write paths exercised.

Not addressed (noted for follow-up)

  • This DA rejects any read that ends exactly at a hardware-partition end
    (Read length[N] is larger than partition max size[N], it compares against
    size - offset strictly), so rf and rf --parttype boot1 fail; ro to size-0x200 works.
  • Re-attaching to a DA left running by a previous invocation makes subsequent reads
    use legacy numeric partition IDs (Cannot find [8] / Cannot find [1]); power-cycling
    the target first avoids it.

Stock vendor V6 DAs for MT6880/MT6890 (hwcode 0x992, e.g. Quectel T750 and
Fibocom FM360 DA_BR.bin) boot stage 2 fine but:

- reply ERR!UNSUPPORTED to CMD:GET-SYS-PROPERTY DA.SLA. send_command()
  already drains the CMD:END/CMD:START pair and returns False, but
  get_sys_property() ignored that and waited for another command result,
  timing out and then crashing in check_sla() with
  "'bool' object has no attribute 'decode'". Return None on a failed
  send and treat it as SLA disabled.

- have a DA2 the xml extension patcher cannot pattern-match
  (get_next_bl_from_off(None) -> TypeError). Make a failed patch()
  non-fatal and continue with the stock DA2 commands instead of aborting.

With both, printgpt / rl / ro work on an unfused 0x992 eMMC board.
@lukejenkins
lukejenkins force-pushed the fix/xml-stock-da-unsupported-sla branch from d6b71e0 to 5c0cc4c Compare November 12, 2026 06:09
@bkerler
bkerler merged commit f12f461 into bkerler:main Nov 20, 2026
@lukejenkins
lukejenkins deleted the fix/xml-stock-da-unsupported-sla branch November 20, 2026 16:13
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

Successfully merging this pull request may close these issues.

2 participants

0