Skip to content

fix: chunked write protocol for large file uploads - #9

Open
dwgx wants to merge 1 commit into
busse:mainfrom
dwgx:fix/chunked-storage-write
Open

fix: chunked write protocol for large file uploads#9
dwgx wants to merge 1 commit into
busse:mainfrom
dwgx:fix/chunked-storage-write

Conversation

@dwgx

@dwgx dwgx commented Jul 3, 2026

Copy link
Copy Markdown

Problem

storage_write sends the entire file payload in a single protobuf message. Flipper's RPC transport caps frame payload at ~512 bytes, so any file over that threshold is rejected by the firmware or silently produces a truncated file on the SD card.

This made it impossible to upload .fap application binaries (typically 10-170KB) through the RPC interface.

Fix

Implements the chunked write protocol per flipperzero-protobuf spec:

  • Data split into 512-byte chunks, shared command_id
  • Every WriteRequest includes path (firmware requirement)
  • Intermediate chunks: has_next=True, fire without waiting
  • Final chunk: has_next=False, await device ACK
  • Timeout scales with file size (was hardcoded 3s)

Tested

Uploaded 14 FAP binaries (4KB-172KB) to Flipper Zero over USB serial. All wrote correctly and matched expected sizes on-device.

storage_write sent entire file in one protobuf message, exceeding
Flipper's RPC frame limit (~512 bytes payload). Files >50KB fail
silently or produce truncated .fap on device.

Implements proper chunked protocol per flipperzero-protobuf spec:
- Split into 512-byte chunks, shared command_id across all
- Every WriteRequest carries path (required by firmware)
- Intermediate chunks: has_next=True, fire without waiting
- Final chunk: has_next=False, await device ACK
- Timeout scales with file size instead of fixed 3s
@dwgx
dwgx force-pushed the fix/chunked-storage-write branch from 1d26fb3 to 46a3ebc Compare July 3, 2026 22:50
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