-
Notifications
You must be signed in to change notification settings - Fork 25
feat: support emmcFileWrite #577
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
Conversation
WalkthroughThis change introduces a new emmcFileWrite API across core and example apps, adds a reboot helper to the firmware base method, updates a firmware methods preset in the Expo playground, adjusts a fallback Connect URL, removes an unused import, updates a comment, and bumps many package versions to 1.1.14-alpha.1. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor App as App / SDK
participant Core as Core API (inject)
participant Method as EmmcFileWrite
participant FWBase as FirmwareUpdateBaseMethod
participant Dev as Device Transport
App->>Core: emmcFileWrite(connectId, { payload, filePath, hash? })
Core->>Method: call with params
Note right of Method: Validate payload buffer and filePath string<br/>Allow modes: BOOTLOADER, NOT_INITIALIZE
Method->>FWBase: ensureBootloader(connectId)
FWBase->>Dev: Enter bootloader
Method->>FWBase: emmcCommonUpdateProcess(payload, filePath)
FWBase->>Dev: Stream EMMC data
FWBase-->>Method: Update result
Method->>FWBase: reboot(NORMAL)
FWBase->>Dev: Reboot (errors ignored)
Method-->>Core: { filePath }
Core-->>App: Response
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. Comment |
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 7
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to data retention organization setting
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (27)
packages/connect-examples/electron-example/package.json(2 hunks)packages/connect-examples/expo-example/package.json(2 hunks)packages/connect-examples/expo-playground/app/data/methods/firmware.ts(1 hunks)packages/connect-examples/expo-playground/package.json(2 hunks)packages/connect-examples/shared-constants/constants.js(1 hunks)packages/connect-examples/shared-constants/package.json(1 hunks)packages/core/package.json(2 hunks)packages/core/src/api/BaseMethod.ts(1 hunks)packages/core/src/api/EmmcFileWrite.ts(1 hunks)packages/core/src/api/firmware/FirmwareUpdateBaseMethod.ts(2 hunks)packages/core/src/api/index.ts(1 hunks)packages/core/src/inject.ts(1 hunks)packages/core/src/types/api/emmcFileWrite.ts(1 hunks)packages/core/src/types/api/export.ts(1 hunks)packages/core/src/types/api/index.ts(2 hunks)packages/core/src/utils/findDefectiveBatchDevice.ts(0 hunks)packages/hd-ble-sdk/package.json(2 hunks)packages/hd-common-connect-sdk/package.json(2 hunks)packages/hd-transport-electron/package.json(2 hunks)packages/hd-transport-emulator/package.json(2 hunks)packages/hd-transport-http/package.json(2 hunks)packages/hd-transport-lowlevel/package.json(2 hunks)packages/hd-transport-react-native/package.json(2 hunks)packages/hd-transport-web-device/package.json(2 hunks)packages/hd-transport/package.json(1 hunks)packages/hd-web-sdk/package.json(2 hunks)packages/shared/package.json(1 hunks)
💤 Files with no reviewable changes (1)
- packages/core/src/utils/findDefectiveBatchDevice.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: release-web
- GitHub Check: Socket Security: Pull Request Alerts
- GitHub Check: lint (22)
- GitHub Check: build (22)
🔇 Additional comments (25)
packages/hd-transport-react-native/package.json (2)
22-23: Deps present — build unverifiedFound @onekeyfe/hd-shared@1.1.14-alpha.1 (packages/shared/package.json) and @onekeyfe/hd-transport@1.1.14-alpha.1 (packages/hd-transport/package.json). Validate that packages/hd-transport-react-native builds clean against these (CI or local RN build).
3-3: Confirm version bump & lockfile update.
- Ensure every package.json is set to 1.1.14-alpha.1 and no package.json still references 1.1.14-alpha.0.
- Update/dedupe the repo lockfile (pnpm/yarn/npm) and commit the result.
packages/shared/package.json (1)
3-3: Version bump to alpha.1 — LGTMpackages/hd-transport-lowlevel/package.json (1)
3-3: Lockstep version/deps update looks consistent
All bumped to alpha.1 in tandem. Good.Also applies to: 22-24
packages/hd-transport-web-device/package.json (1)
3-3: Alpha.1 alignment across package and deps — LGTMAlso applies to: 23-24, 27-27
packages/connect-examples/shared-constants/package.json (1)
3-3: Version bump — LGTMpackages/hd-transport-emulator/package.json (1)
3-3: Emulator and deps bumped to alpha.1 — LGTMAlso applies to: 27-28
packages/hd-transport/package.json (1)
3-3: Version bump aligned — no stale alpha.0 references foundScanned the repo: packages/hd-transport/package.json is 1.1.14-alpha.1 and no occurrences of "1.1.14-alpha.0" or "alpha.0" were found.
packages/hd-web-sdk/package.json (1)
3-3: SDK and deps bumped — emmcFileWrite is present and exposedConfirmed: hd-core implements and exports emmcFileWrite and the hd-web-sdk default export (HardwareWebSdk) will expose it.
- packages/core/src/api/index.ts — exports emmcFileWrite
- packages/core/src/inject.ts — inject maps emmcFileWrite -> call(..., method: 'emmcFileWrite')
- packages/hd-web-sdk/src/index.ts — imports HardwareSdk from '@onekeyfe/hd-core' and returns HardwareWebSdk
packages/connect-examples/expo-playground/package.json (1)
3-3: Playground deps aligned to alpha.1.Looks good and consistent with core updates.
Also applies to: 20-22
packages/core/package.json (1)
3-3: Core version and deps bumped correctly.hd-shared and hd-transport align to alpha.1. No issues spotted.
Also applies to: 28-29
packages/hd-transport-http/package.json (1)
3-3: HTTP transport version alignment LGTM.Deps updated to alpha.1 as expected.
Also applies to: 27-28
packages/core/src/types/api/export.ts (1)
29-29: Type export added for EmmcFileWriteParams.Placement alongside firmware types makes sense. Good.
packages/connect-examples/expo-example/package.json (1)
3-3: Expo example deps in sync with alpha.1.Matches other packages. All good.
Also applies to: 22-25
packages/hd-transport-electron/package.json (1)
3-3: Electron transport version bump OK.Deps align to alpha.1. No issues spotted.
Also applies to: 28-30
packages/hd-ble-sdk/package.json (1)
3-3: Sweep for leftover alpha.0 referencesAll three deps align to 1.1.14-alpha.1 — good. Local rg search for '1.1.14-alpha.0' returned no output here; absence can't be confirmed. Run locally: rg -n --glob '**/package.json' '1.1.14-alpha.0' (or broader: rg -n 'alpha.0') and report results.
packages/core/src/api/index.ts (1)
40-40: Approve — emmcFileWrite export wired end-to-endImplementation, default export, re-export, types, and CoreApi injection are present and correctly wired (packages/core/src/api/EmmcFileWrite.ts, packages/core/src/api/index.ts, packages/core/src/types/api/emmcFileWrite.ts + export.ts, packages/core/src/inject.ts).
packages/core/src/inject.ts (1)
262-262: API wiring looks good
emmcFileWriteis correctly forwarded withconnectIdandmethodset.packages/core/src/api/BaseMethod.ts (1)
61-63: Doc tweak LGTMThe description for allowed device modes reads clearer now.
packages/core/src/api/firmware/FirmwareUpdateBaseMethod.ts (1)
406-416: Reboot helper is a solid additionEncapsulating
RebootviatypedCallkeeps flows cleaner and re‑usable.packages/hd-common-connect-sdk/package.json (1)
3-3: Workspace versions alignedVersion and internal deps bumped to alpha.1 consistently.
Also applies to: 23-29
packages/core/src/api/EmmcFileWrite.ts (1)
1-50: Straightforward and safe flowValidates input, ensures bootloader, streams chunks with base method, and attempts a reboot. Looks good.
packages/connect-examples/electron-example/package.json (1)
5-5: Version bump looks consistent — no alpha.0 stragglers foundRepo-wide search and package.json scan found no occurrences of "-alpha.0" or "1.1.14-alpha.0".
packages/connect-examples/expo-playground/app/data/methods/firmware.ts (2)
116-121: Confirmed: use '0:boot/...'Repository examples use '0:boot/bootloader.bin' (packages/core/src/types/api/emmcFileWrite.ts, packages/core/src/api/FirmwareUpdateV3.ts); keep the current placeholder.
124-132: Confirmed — file-to-ArrayBuffer conversion is implementedconvertFilesToArrayBuffers (packages/connect-examples/expo-playground/app/store/hardwareStore.ts) converts top-level File params to ArrayBuffer; useMethodExecution (packages/connect-examples/expo-playground/app/hooks/useMethodExecution.ts) calls it for type === 'firmware'; device-methods route marks firmware.api methods (including emmcFileWrite) as firmware, so payload will be converted before the API call.
添加一个单独调用emmcFileWrite的方法,内部使用。只用于用户无法进入board更新boot的情况
Summary by CodeRabbit
New Features
Chores