Skip to content

Retry preloader init when target config is unset - #323

Open
rohan87674 wants to merge 1 commit into
bkerler:mainfrom
rohan87674:rohan87674-da-init-retry
Open

Retry preloader init when target config is unset#323
rohan87674 wants to merge 1 commit into
bkerler:mainfrom
rohan87674:rohan87674-da-init-retry

Conversation

@rohan87674

Copy link
Copy Markdown

Why

Some MT6768/MT6769 devices can successfully respond in BROM/preloader mode before target_config has been populated. In that case, DaHandler.connect() was aborting immediately even though a second preloader.init() call succeeded and recovered the configuration.

This produced a false failure path that required a reconnect even though the device was still valid and usable.

What changed

The connection flow now retries mtk.preloader.init() once when target_config is still None before treating the device as disconnected. The original fail-fast behavior is retained if initialization still does not populate the target configuration.

This keeps the initialization logic aligned with the actual device state and avoids unnecessary disconnect/reconnect cycles for devices that recover immediately.

Validation

  • py -3 -m compileall -q mtkclient
  • Focused fake-device regression check for the retry path

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

1 participant