Skip to content

feat: add generic framebuffer screenshot and filesystem rename primitives - #5

Open
jadehawk wants to merge 1 commit into
Free-Ink:masterfrom
jadehawk:feat/screenshot-file-rename
Open

jadehawk wants to merge 1 commit into
Free-Ink:masterfrom
jadehawk:feat/screenshot-file-rename

Conversation

@jadehawk

@jadehawk jadehawk commented Nov 27, 2026 •

Copy link
Copy Markdown

Why this matters to users

Imagine a calendar, weather display, daily planner or reading dashboard that stays visible even when the reader goes to sleep. Today an application can draw that screen, but cannot directly publish the result as an image. Giving it access to the existing framebuffer capture mechanism makes that possible without asking the firmware to implement a new sleep-screen feature for every application.

A working integration uses this approach to generate a custom sleep image while preserving the user's original wallpaper. A file rename is useful here because the guest does not need to load a whole image into its limited memory just to move it. The same capability benefits downloaded files and application-generated caches.

The intention is to let apps own their output and leave ordinary custom sleep-screen behavior in the firmware. The host must still authorize the affected files; this is not unrestricted storage access.

Summary

Adds two general-purpose primitives to the Dessen SDK, expanding application capabilities without introducing application-specific firmware functionality.

Framebuffer screenshot

dsn_screenshot(path)

Allows applications to capture the current framebuffer as a BMP at an authorized filesystem location. Hosts can reuse existing native screenshot functionality rather than introduce a separate capture engine.

Potential uses include application-generated sleep screens, weather and calendar displays, personal dashboards, artwork, and exporting application output for documentation or debugging.

Filesystem rename

dsn_fs_rename(source, destination)

Moves a regular file without copying its contents through guest memory. This complements the existing filesystem read, write, list and delete operations, and is particularly useful on memory-constrained devices.

Potential uses include configuration backups, publishing completed downloads, managing generated images, staging cache files and recovering from interrupted operations.

Permissions and isolation

  • Both operations validate guest paths before forwarding to the host.
  • Host implementations must enforce destination write permission for capture, and source read/delete plus destination write permission for rename.
  • Protected paths must remain inaccessible.
  • Existing destination files are not silently replaced.
  • An unsupported service returns DSN_ERR_UNAVAILABLE. An empty screenshot path probes host support.
  • The desktop rename implementation uses a no-replace link/unlink sequence with confined directory traversal. It is not an atomic replacement or a power-loss transaction.

Practical example

An application can render a calendar, daily schedule, weather forecast or artwork and publish it as /sleep.bmp, with the appropriate permissions. The firmware's existing custom sleep-screen behavior can display that image. The same primitives let the application preserve and restore the original custom image.

This keeps application behavior in the application, while the SDK exposes small reusable capabilities.

Implementation

  • ABI declarations and generated C, Rust and Zig bindings.
  • Optional host service interfaces and validated dispatch.
  • Confined desktop filesystem rename implementation.
  • Documentation and regression tests.

Actual framebuffer capture and device-specific permission enforcement are provided by the firmware host. This PR deliberately does not include firmware-side changes or an application-specific API.

Testing

Full upstream make test passed with Rust 1.97.1, the pinned FreeInk SDK and locked XPUI dependencies.

  • C VM and host binding tests, including capability and network tests.
  • Rename round-trip, existing-destination rejection, path traversal and symlink rejection.
  • Screenshot dispatch to a test host and unavailable-service handling.
  • Rust SDK and application tests.
  • All 237 XPUI screen walks passed with no failures.
  • XPUI unit tests passed (one existing ignored test).

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