Skip to content

Make the IP camera variant build and pair again - #151

Open
codecoder01 wants to merge 6 commits into
secluso:mainfrom
codecoder01:fix/ip-camera-pairing-build
Open

codecoder01 wants to merge 6 commits into
secluso:mainfrom
codecoder01:fix/ip-camera-pairing-build

Conversation

@codecoder01

@codecoder01 codecoder01 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

The ip feature of camera_hub stopped compiling with the Android camera change (ccd3ea7), and an IP hub's QR code could not be recognised by the mobile app. This PR brings the IP variant back to a working state. Companion app change: secluso/mobile_client#110

What changed

  • pairing/flow.rs: add the ip feature to the cfg gates for the TCP transport, receive_credentials_full and decrypt_msg. The IP hub pairs like the test variant: TCP on port 12348, relay credentials over the config group, no hotspot, no timestamp step.
  • Cargo.toml: the IP- and Raspberry-specific dependencies had ended up under the [target.'cfg(target_os = "android")'] section, so rpassword, http-auth and linfa were never linked on Linux. The Android section now sits at the end of the file (same layout as the clippy branch).
  • ip/ip_camera.rs: update imports for the mp4 module move and for the state-directory constants, which are now pub(crate) in core.rs.
  • mp4/mod.rs: compile mp4_camera.rs only for raspberry/android; its is_there_motion has no body for other variants and nothing else uses it.
  • ndarray 0.16 for camera_hub, matching linfa 0.8.1 (motion_ai keeps 0.17; both end up in the lock file, each crate uses its own).
  • client_lib/pairing.rs: IP camera QR codes carry "t": "ip" so the app can route them. Raspberry Pi, Android and add-app QR codes are byte-for-byte unchanged (the field is omitted when absent).
  • core.rs: the ip variant keeps its version marker in its working directory instead of /var/lib/secluso, which only exists on Secluso OS.

Tested

  • Hub: Raspberry Pi 4 running plain Raspberry Pi OS, cargo build --release --features ip. Camera: Amcrest IP camera on a private Ethernet segment (RTSP main stream, MJPEG sub-stream). Relay: DigitalOcean VPS provisioned with Deploy 1.0.2.
  • Paired with an Android build of the companion PR; then four motion events (thumbnail, alert, 20 s clip, post-upload alert over UnifiedPush) and a 9-minute livestream, all received in the app, no errors in the hub log.
  • cargo check --features raspberry on the same Pi finishes with only pre-existing warnings, so the Pi variant is unaffected by the Cargo.toml and mp4 changes.
  • Not run: the Android variant, and cargo fmt/clippy over whole files, to avoid colliding with the open formatting PRs; the added lines follow rustfmt's layout.

Commit ccd3ea7 reorganised pairing/flow.rs around the raspberry, test and
android features and left `ip` out of the cfg gates, so
`cargo build --features ip` fails: the TcpStreamTransport/CONFIG imports,
the `msg_transport` initialisation, `receive_credentials_full` and
`decrypt_msg` were all missing for that variant.

Treat the IP hub like the test variant: plain TCP transport on port 12348,
receive the relay credentials over the config group, no hotspot and no
timestamp step.
Follow-ups to the pairing/flow.rs fix, all fallout from ccd3ea7:

- Cargo.toml: the IP- and Raspberry-specific dependencies had ended up
  under the `[target.'cfg(target_os = "android")']` section, so rpassword,
  http-auth and linfa were never linked on Linux. Move the Android
  section to the end of the file (same layout as jk-cargo-clippy-ci).
- ip/ip_camera.rs: fmp4 and mp4 moved under the mp4 module; the state
  directory constants moved into core.rs. Update the imports and make
  the constants pub(crate).
- mp4/mod.rs: mp4_camera.rs only has motion-detection bodies for the
  raspberry and android features and nothing else uses it, so compile it
  only for those features.
camera_hub pinned ndarray to =0.17.2 (1574468) but linfa 0.8.1 is built
against ndarray 0.16, so the ip build ended up with two ndarray versions
and Dataset::new rejected the arrays. ndarray is only used by the IP
motion detection, so follow linfa's line. motion_ai keeps its own 0.17.
The app's QR parser only recognised Raspberry Pi camera QR codes (which
carry a hotspot password) and rejected an IP hub's QR code. Add an
explicit kind field so the app can route IP camera QR codes to the IP
camera flow without guessing. The field is omitted from Raspberry Pi,
Android and add-app QR codes, so those are byte-for-byte unchanged.
The version marker path defaulted to /var/lib/secluso/current_version,
which only exists (and is only writable) on Secluso OS where the hub runs
as root. On a user-run IP hub this made run() fail with EACCES before
pairing. The ip variant has no updater, so store the marker locally like
the test variant does.
@codecoder01 codecoder01 changed the title Fix/ip camera pairing build - Make the IP camera variant build and pair again Make the IP camera variant build and pair again Oct 20, 2026
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