informer — ARM-side viewer companion service #
informer is a small ARM guest process launched by pbemu start through PocketBook's monitor service manager. Its job is to publish exactly the metadata the host viewer needs, using official firmware APIs only.
Build #
# From repo root (builds inside the pbdev container):
./pbemu build [firmware]
Output: src/informer/build-arm/informer
Like the shim, informer links against the staged firmware's own ARM libraries (libinkview.so, libhwconfig.so, and rootfs/lib/libc.so.6), so ./pbemu install <firmware.zip> must be run first.
Runtime #
pbemu start stages the built binary into the live firmware tree as /ebrmain/bin/informer, then launches it directly via qemu-arm inside the container before starting the host viewer.
Relevant environment variables:
| Variable | Default | Purpose |
|---|---|---|
PB_SYSTEM_INFORMER_BIN |
src/informer/build-arm/informer |
Override the ARM informer binary used at startup |
PB_INFORMER_POLL_MS |
100 |
Snapshot poll interval in milliseconds |
PB_DEVICE_STAGE_ROOT |
set by pbemu start |
Live stage root used for logging and runtime files |
Logs are written to $PB_DEVICE_STAGE_ROOT/var/log/informer.log.
Published protocol #
src/common/pb_informer.h defines pb_informer_state, a fixed-layout snapshot shared between ARM32 and x86-64.
Key fields:
| Field group | Meaning |
|---|---|
magic, version, struct_size |
Protocol validation |
sequence |
Odd/even seqlock counter for lock-free snapshot reads |
flags |
Validity bits for task ids, framebuffer info, touch matrix, and names |
active_task_id, active_subtask_id |
Current foreground task/subtask from GetActiveTask() |
fbshmkey, fbshmsize |
Active task framebuffer SHM id/size |
width, height, depth, stride |
Normalised framebuffer geometry |
pixel_data_offset, fb_y_offset |
Pixel-data start offset and wrapped-framebuffer Y origin |
touch_matrix[8] |
Touch-panel affine transform |
task_name, subtask_name |
Human-facing window-title strings |
Writer protocol:
- Increment
sequenceto an odd value. - Copy the new snapshot payload.
- Increment
sequenceto the next even value.
Readers accept a snapshot only when both reads of sequence match and are even.
Source map #
src/informer_sdk.h — minimal firmware SDK declarations #
Declares the subset of PocketBook APIs and structs the service needs:
InitInkview(),SignalTaskStarted()GetActiveTask(),GetTaskInfo(),GetTaskFramebufferInfo()TaskNameToHumanName()init_hwconfig(),device_touchpanel_getmatrix()taskinfo,subtaskinfo, and task-flag constants
src/main.c — service entry point and publisher loop #
Owns the entire runtime for the service.
Key functions:
open_state_segment()— creates/attaches the SysV SHM segment atPB_INFORMER_SHM_KEYfill_touch_matrix()— copies the hwconfig touch matrix when availablefill_task_names()— derives task/subtask labels from PocketBook task metadatafill_framebuffer_info()— normalisesiv_fbinfointo viewer-friendly geometry fieldsfill_snapshot()— assembles one fullpb_informer_statepublish_snapshot()— writes the snapshot using the odd/evensequenceprotocol
main() installs signal handlers, opens the log file, initialises InkView, self-registers with the firmware task manager, optionally initialises hwconfig, and then republishes snapshots until shutdown.
Design notes #
- Uses official firmware APIs only; no monitor SHM offset scraping.
- Publishes framebuffer geometry on the ARM side so the viewer does not need to decode guest headers to discover layout.