Skip to content

fix(backend): detect RK3588 via device-tree compatible marker#150

Merged
andrescera merged 1 commit into
mainfrom
fix/rk3588-realdevice-marker
Jul 16, 2026
Merged

fix(backend): detect RK3588 via device-tree compatible marker#150
andrescera merged 1 commit into
mainfrom
fix/rk3588-realdevice-marker

Conversation

@andrescera

Copy link
Copy Markdown
Member

What

isRealDevice() (apps/backend/src/modules/system/device-detection.ts) now
also reads /proc/device-tree/compatible (case-insensitively matched for the
rk3588 marker) in addition to the existing /proc/device-tree/model check.
Either match classifies the board as a real device. A new injectable
readDeviceTreeCompatible probe is added to DeviceDetectionDeps /
defaultDeviceDetectionDeps, mirroring readDeviceTreeModel exactly.

Why

On a real, physical Radxa ROCK 5B+ (confirmed live over SSH), isRealDevice()
returned false and the device was treated as emulated. Root cause: the
only RK3588 check read /proc/device-tree/model, which on this board reads:

Radxa ROCK 5B+

No RK3588 substring anywhere, so the check failed; the x86-DMI fallback path
didn't match either, so detection fell through to false. That directly caused:

  • Settings → Sources showing "Network ingest isn't available on this device in
    emulated mode"
    on a real device.
  • The RTMP/SRT gateway probes (which are isRealDevice()-gated in
    network-ingest.ts) reporting "Service not running" even though the actual
    ceralive-rtmp-gateway.service unit was active (running).

/proc/device-tree/compatible is the reliable, standard board-identification
marker. On the same board it reads (NUL-separated on disk):

radxa,rock-5b-plus rockchip,rk3588

which reliably contains rk3588. The model check is kept as a
belt-and-suspenders fallback for boards whose model string does name the SoC
(e.g. Orange Pi 5+). The marker match was made case-insensitive so the lowercase
rockchip,rk3588 (compatible) and uppercase RK3588 (model) both hit one code
path — this is strictly more permissive, and the fail-closed cases (RK3399,
RK3568, generic Rockchip) still fail since none contain rk3588 in any case.

How to verify

cd apps/backend
bun test src/tests/device-detection.test.ts src/tests/device-detection-override.test.ts   # 30 pass
bun tsc --noEmit                                                                            # clean

A new regression test mirrors the exact field bug: model "Radxa ROCK 5B+ \n"
(no RK3588) with compatible "radxa,rock-5b-plus\u0000rockchip,rk3588\u0000"
resolves true.

Risks

Low, and additive:

  • The override / isDevelopment / x86-mini-PC DMI branches are untouched.
  • Fail-safe semantics are preserved — the new probe is wrapped in the same
    readOptional swallow-on-reject, so any read failure still degrades to ""
    and never propagates or crashes boot.
  • Case-insensitive matching only ever adds matches; every existing fail-closed
    identity still fails closed (covered by the existing test.each cases).

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 32458453-4fe7-4c60-a491-121ab5bb456b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/rk3588-realdevice-marker

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@andrescera
andrescera force-pushed the fix/rk3588-realdevice-marker branch from e40f5d6 to a8ef856 Compare July 16, 2026 20:28
isRealDevice() only checked /proc/device-tree/model for "RK3588", which
on a real Radxa ROCK 5B+ reads "Radxa ROCK 5B+" with no RK3588 substring,
so the board was wrongly classified as emulated — disabling network-ingest
and reporting gateways as down while their systemd units were active.

Also check /proc/device-tree/compatible (the reliable marker, always
carrying "rockchip,rk3588") via a new injectable readDeviceTreeCompatible
probe, matched case-insensitively. The model check is kept as a fallback for
boards whose model string names the SoC (e.g. Orange Pi 5+). Fail-safe
swallow-on-reject semantics are unchanged.
@andrescera
andrescera force-pushed the fix/rk3588-realdevice-marker branch from a8ef856 to 4f33e57 Compare July 16, 2026 21:03
@andrescera
andrescera merged commit 42d32c1 into main Jul 16, 2026
12 checks passed
@andrescera
andrescera deleted the fix/rk3588-realdevice-marker branch July 16, 2026 21:08
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