Skip to content

feat(d211-linux): ipc host module for the local daemon - #421

Closed
boa-z wants to merge 8 commits into
pocket-stack:mainfrom
boa-z:feat/d211-ipc-host-module
Closed

feat(d211-linux): ipc host module for the local daemon#421
boa-z wants to merge 8 commits into
pocket-stack:mainfrom
boa-z:feat/d211-ipc-host-module

Conversation

@boa-z

@boa-z boa-z commented Sep 13, 2026

Copy link
Copy Markdown

内容

  • 引擎新增 PocketIpcOps(connect/close/send/recv)与 globalThis.ipc 挂载;未注册 op 表的宿主行为不变。
  • hosts/d211-linux/ipc.c:SOCK_SEQPACKET(一数据报一帧)非阻塞客户端,连接本地 forkliftd。
  • framework/src/ipc-api.ts + subpaths/package.json exports;构建脚本加入 ipc.o。

验证

  • builder 交叉编译通过(Luban gcc + Rust LLD);实机日志 host modules: audio + backlight + ipc
  • D211 实机端到端:forkliftd 就绪后 UI 通过该模块握手、拉取设置并停在授权页;daemon 日志显示客户端连接。
  • forklift-platform 侧 IpcTransport 单测覆盖握手/事件分发/坏帧关闭。

堆叠在 #417 之后(含 #414/#416 内容),最终按依赖顺序合入。

ui_render, ui_render_scaled, and ui_render_incremental_scaled are exported C ABI functions the raster implementation already provides; the public header only declared the unscaled incremental form.
The D211DBV runs Luban Linux 5.10 on RISC-V with an 800x480 32bpp panel and
a GT911 touchscreen. The host presents the software raster surface through
/dev/fb0, probes the framebuffer geometry and channel bitfields with
FBIOGET_VSCREENINFO/FBIOGET_FSCREENINFO, fixes the visible page with
FBIOPAN_DISPLAY, and finds the touch device by capability instead of eventN.

The build runs on a canonical Ubuntu builder with the Luban Xuantie GCC
wrapper and sysroot; D211_LUBAN_SDK selects the SDK root. The final link
uses LLVM LLD from the pinned Rust nightly because binutils 2.35 rejects
modern RISC-V ELF attributes. The private d211-linux-dev target (host ABI
11) renders the full 800x480 panel at raster density 1, and
tools/d211-linux/remote-build.sh wraps sync, build, and artifact fetch with
the builder taken from D211_REMOTE.
The touch backend now runs the protocol-B slot state machine (ABS_MT_SLOT,
ABS_MT_TRACKING_ID, per-slot positions) and delivers every live contact
through pocket_runtime_tick_contacts(), with the bounds hit resolved once at
each contact's own down edge. Single-touch devices still map to one id-0
contact, and the host tracks up to D211_MAX_CONTACTS (8).

Validated against the panel with a local probe: five simultaneous contacts,
each id keeping its own coordinates and down-edge hit. stop-ui now sends
SIGKILL because test_lvgl ignores SIGTERM and keeps the panel.
The C runtime could install only the ui surface; native hosts had no way to
expose device services to the guest. Add two optional host op tables:

- PocketAudioOps installs globalThis.audio with the method set the audio spec
  already pins (contracts/spec/audio.ts); hosts fill the table before boot and
  leave it absent otherwise (the framework player stays a no-op).
- PocketBacklightOps installs globalThis.backlight { get, set(percent) } —
  pinned here until a display spec lands.

Both follow the existing ui-module installation shape; no wire changes, no
behavior change for hosts that pass no tables.
Wire two host modules into the d211 runtime:

- audio: PocketAudioOps on top of one `aplay -t raw` child per stream and a
  feeder thread over a frame ring; credits follow consumption, starvation is
  edge-reported as underrun, endStream drains then reports ended; volume is a
  soft gain. Matches contracts/spec/audio.ts; the framework player now works
  unchanged (load("btn") -> createStream -> writePcm -> play -> credit).
- backlight: PocketBacklightOps over /sys/class/backlight (percent 0-100).

main.c sets both tables before boot; build-runtime.sh compiles the two new
sources and links -lpthread. The runtime-side hook is the quickjs-c commit
below (stacked PR).
@boa-z

boa-z commented Sep 13, 2026

Copy link
Copy Markdown
Author

撤回:该模块服务于本地产品项目,不作为上游平台改动提交;先保留在本地集成分支。

@boa-z boa-z closed this Sep 13, 2026
@boa-z
boa-z deleted the feat/d211-ipc-host-module branch September 13, 2026 01:11
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