Skip to content

feat(wifi): drive commissioning from device_caps.json - #665

Merged
JanZachmann merged 71 commits into
omnect:mainfrom
JanZachmann:chore
Jul 10, 2026
Merged

feat(wifi): drive commissioning from device_caps.json#665
JanZachmann merged 71 commits into
omnect:mainfrom
JanZachmann:chore

Conversation

@JanZachmann

@JanZachmann JanZachmann commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Make /etc/omnect/device_caps.json the single source for wifi/bluetooth. At build time wifi: optional|yes installs wpa-supplicant + the commissioning service, and bluetooth: optional|yes compiles it with the ble feature.

At runtime, the omnect-wifi-commissioning oneshot service reads device_caps.json and acts on two flags:

  • wifi: yes → starts wpa_supplicant@wlan0, which in turn pulls in the commissioning service.
  • bluetooth: yes → starts the commissioning service with the --enable-ble flag.

An unknown value in device_caps.json, or a capability enabled there but absent from MACHINE_FEATURES, fails the build (see omnect-os-image.bb).

Also bumps omnect-device-service to 0.44.0 (wifi-commissioning-state) and wifi-commissioning-service to 0.2.0.

Single gate on 'wifi'; universal udev/BindsTo adapter gating on
wpa_supplicant with commissioning riding along; runtime --disable-ble
via ExecStartPre + env file.

Signed-off-by: Jan Zachmann 50990105+JanZachmann@users.noreply.github.com
Add task-by-task plan; sync spec BT-handling section to the corrected
ExecStart-override drop-in mechanism.

Signed-off-by: Jan Zachmann 50990105+JanZachmann@users.noreply.github.com
Remove the separate 'wifi-commissioning' feature; 'wifi' is now the
single install gate. Delete the opt-in KAS example.

Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
Replace static enablement with a wlan* udev rule and BindsTo on the
net device, so wpa_supplicant starts only when an adapter is present
(incl. hot-plug) and stops when it is removed. Pull the commissioning
service in via Wants= (single gate, option A).

Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
Ship a drop-in that overrides ExecStart to probe for a BT adapter at
start and add --disable-ble when none is present (operator override via
WIFI_COMMISSIONING_EXTRA_ARGS). Remove static target.wants symlinks; the
service is now pulled by wpa_supplicant and adapter-gated by udev.

Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
The runtime probe keys on /sys/class/bluetooth/hci* only, which a kernel
can expose without bluez installed. On a bluetooth-off build BLE can never
work, so append Environment=WIFI_COMMISSIONING_EXTRA_ARGS=--disable-ble to
the drop-in, overriding the runtime probe.

Signed-off-by: Jan Zachmann 50990105+JanZachmann@users.noreply.github.com
IMAGE_POSTPROCESS_COMMAND is split on ';'. With buildhistory enabled, the
preceding buildhistory_get_imageinfo entry has no trailing separator, so the
un-prefixed :append glued them into 'buildhistory_get_imageinfocheck_deploy_keys'
(a non-existent function). check_deploy_keys was skipped and sign then failed
with 'Unable to sign' on genericx86-64 (efi-secure-boot). Add a leading ';'.

Signed-off-by: Jan Zachmann 50990105+JanZachmann@users.noreply.github.com
Fix comment rot/inaccuracy flagged in PR review:
- wpa_supplicant@.service: BindsTo owns teardown; start-on-appearance
  comes from 80-wlan-wpa.rules, not BindsTo. Drop the spec-only
  '(option A)' reference.
- 10-omnect-runtime.conf: note the operator override is pinned to
  --disable-ble on bluetooth-absent builds, and add a reminder to
  re-check the ExecStart override against upstream on a SRCREV bump.

Comments only; no behavior change.

Signed-off-by: Jan Zachmann 50990105+JanZachmann@users.noreply.github.com
Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
Maintainer reference (Approach A): one device-independent topic doc
(doc/wifi_commissioning.md) with a mermaid diagram + exists-vs-runs
principle; per-device docs carry the capability row + a link; WELOTEC
(Arrakis) adapted for Mk4 (wifi+BT) vs Pico (neither); README link.

Signed-off-by: Jan Zachmann 50990105+JanZachmann@users.noreply.github.com
Signed-off-by: Jan Zachmann 50990105+JanZachmann@users.noreply.github.com
Device-independent maintainer doc: feature->package install chains,
udev+BindsTo runtime start gate, runtime vs build-time --disable-ble,
the exists-vs-runs principle, a mermaid flow, and a where-to-change map.

Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
Per-device capability rows now link the new reference. Welotec/Arrakis
reflects its variants (Mk4 wifi+BT vs Pico none). README Features entry added.

Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
Start comes from the udev rule; BindsTo only handles stop on adapter
removal. Note the per-wlan* fan-out and that --disable-ble is forced
(override suppressed) on builds without the bluetooth feature.

Signed-off-by: Jan Zachmann 50990105+JanZachmann@users.noreply.github.com
Rename recipe 0.1.0 -> 0.2.0 and regenerate via cargo-bitbake for the
wifi-commissioning-service 0.2.0 change (/api/v1/service-info), the
dependency refresh (sha3 0.10 -> 0.12 major, plus compatible bumps to
actix-web, clap, tokio, uuid, and transitive crates), and the PR review
cleanup. Crate list and checksums updated accordingly.

SRC_URI/SRCREV point at the janzachmann fork, branch
feat/service-info-endpoint (commit 955231e), so the recipe builds the
real 0.2.0 code before PR omnect/wifi-commissioning-service#3 is merged.
Retarget to omnect/main + the merge commit once the PR lands.

The hand-added 'file://10-omnect-runtime.conf' SRC_URI (not emitted by
cargo-bitbake) is preserved.

Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
…ature

The service acquires a BLE adapter once at start and never re-probes, so the
runtime hci* probe could not deliver hot-plug and raced the controller coming
up at boot. Remove the probe drop-in and enable BLE by default on bluetooth
builds; force --disable-ble via ExecStart only when the bluetooth feature is
absent (restores the previous sed-append). BLE-absent is handled by the
service itself (logs once, keeps serving the Unix socket).

Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
Cut comments in wpa_supplicant@.service and 80-wlan-wpa.rules that restated
the directives they annotate; keep only the non-obvious rationale.

Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
Lead the appended command with ';' by convention and drop the now-superfluous
trailing separator; condense the explanatory comment.

Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
Drop the flowchart, the internal "where to change what" table and the
override paragraph; correct the false hot-plug claim (BLE is evaluated once
at start) and the "ARM/x86" wording. Reduce the README entry to a plain
description and link.

Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
These are working artifacts, not shipped documentation.

Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
Point the recipe at the branch tip that makes /service-info ble_enabled
report live BLE state (fork janzachmann, branch feat/service-info-endpoint).
SRCREV only; crate list unchanged (no dependency changes). Drop the
cargo-bitbake PV:append .AUTOINC line — the layer pins exact PV.

Retarget to omnect/main + the merge commit once PR
omnect/wifi-commissioning-service#3 lands.

Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
Follow branch tip after the /service-info comment cleanup. SRCREV only;
crate list unchanged (comments only, no dependency changes).

Retarget to omnect/main + the merge commit once PR
omnect/wifi-commissioning-service#3 lands.

Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
The leading ';' convention is self-evident from the value.

Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
)

Design for making /etc/omnect/device_caps.json the single source of truth
for wifi/bluetooth gating at build time (DISTRO_FEATURES derivation, BLE
cargo feature) and runtime (oneshot orchestrator, --enable-ble), removing
the udev hot-plug path.

Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
Comment thread conf/distro/include/omnect-os-distro.conf Outdated
- omnect-device-service: replace 0.43.0 recipe with 0.44.0 (SRCREV 96ec68b)
- wifi-commissioning-service: bump SRCREV to 9766877

Signed-off-by: Jan Zachmann <jan.zachmann@conplement.de>

@JanZachmann JanZachmann left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two recipes still source from a personal fork branch. These need repointing to the omnect org (or crates.io) and pinning to a stable SRCREV before this merges.

Comment thread recipes-omnect/omnect-device-service/omnect-device-service_0.44.0.bb Outdated
Comment thread recipes-omnect/wifi-commissioning-service/wifi-commissioning-service_0.2.0.bb Outdated
@JanZachmann
JanZachmann marked this pull request as ready for review July 8, 2026 16:00
Source from omnect/wifi-commissioning-service main (SRCREV 4faf122) instead
of the personal fork branch; resolves the fork-branch TODO.

Signed-off-by: Jan Zachmann <jan.zachmann@conplement.de>
Comment thread classes/omnect-initramfs-sign.bbclass
Comment thread conf/distro/include/omnect-os-distro.conf Outdated
Comment thread conf/distro/include/omnect-os-distro.conf
Comment thread doc/wifi_commissioning.md Outdated
Comment thread doc/wifi_commissioning.md Outdated
Comment thread recipes-omnect/omnect-wifi-commissioning/omnect-wifi-commissioning.bb Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread conf/distro/include/omnect-os-distro.conf Outdated
- wifi_commissioning.md: frame wifi/bluetooth as standard OE-core features
  with upstream effects (meta-omnect only adds wcs + the oneshot on top);
  drop the vague "this model"/3g aside; retitle the pre-boot section and
  say it means injecting an overwritten device_caps.json; trim the BLE
  arg-forwarding and no-udev/hot-plug plumbing; drop undefined Mk4/Pico.
- README.md: wifi/bluetooth are standard DISTRO_FEATURES we set/derive, not
  ones we add, so drop them from the "adds" list; stop referencing the
  removed wifi-commissioning kas example.
- Variables_Glossary.md: document OMNECT_DEVICE_CAP_WIFI/_BLUETOOTH.

Signed-off-by: Jan Zachmann 50990105+JanZachmann@users.noreply.github.com
- omnect-wifi-commissioning-start: replace the sed JSON scrape with jq
  (jq is already unconditionally in release and devel images); under
  set -eu this now fails loud on a malformed device_caps.json.
- Rename the script to *.sh and update SRC_URI, do_install, FILES, the
  service ExecStart, and the wcs .inc comment reference.
- Declare the runtime jq dependency explicitly in RDEPENDS.

Signed-off-by: Jan Zachmann 50990105+JanZachmann@users.noreply.github.com
…ostprocess

- omnect-os-distro.conf: restore the "DISTRO_FEATURES depending on
  MACHINE_FEATURES" comment (only 3g remains) instead of the unclear
  "3g stays MACHINE_FEATURES-driven".
- omnect-os-image.bb: scope the MACHINE_FEATURES-mismatch comment to
  "wifi or bluetooth" instead of "a radio"; append verify_image_tools
  with a leading ';' separator (IMAGE_POSTPROCESS_COMMAND:append) to
  match the omnect-initramfs-sign.bbclass convention.

Signed-off-by: Jan Zachmann 50990105+JanZachmann@users.noreply.github.com
@JanZachmann
JanZachmann requested a review from mlilien July 9, 2026 11:40
…fork

Point SRC_URI at omnect/omnect-device-service main and pin the SRCREV,
replacing the personal fork branch. Drops the fork-branch TODO.

Signed-off-by: Jan Zachmann 50990105+JanZachmann@users.noreply.github.com
Comment thread doc/WELOTEC.md Outdated
Comment thread doc/wifi_commissioning.md Outdated
Comment thread recipes-omnect/omnect-wifi-commissioning/omnect-wifi-commissioning.bb Outdated
Comment thread README.md Outdated
- WELOTEC.md: drop the Mk4/Pico names; the row now says
  "yes, with a wifi/BT adapter".
- wifi_commissioning.md: qualify "oneshot" as "the oneshot service".
- omnect-wifi-commissioning.bb: reword DESCRIPTION to "Oneshot service ...".
- README.md: drop the kas mention from the device_caps.json note.

Signed-off-by: Jan Zachmann 50990105+JanZachmann@users.noreply.github.com
@JanZachmann
JanZachmann requested a review from mlilien July 9, 2026 13:53

@mlilien mlilien left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop the wifi gate on the bluetooth DISTRO_FEATURE. wifi and bluetooth
are now independent; each follows its own device_caps value. wcs install
and the runtime oneshot still require wifi, since wcs commissions wifi.

Signed-off-by: Jan Zachmann 50990105+JanZachmann@users.noreply.github.com
@JanZachmann
JanZachmann requested a review from mlilien July 9, 2026 15:06
Comment thread conf/distro/include/omnect-os-distro.conf Outdated
Comment thread doc/WELOTEC.md Outdated
Comment thread doc/wifi_commissioning.md
Comment thread recipes-omnect/images/omnect-os-image.bb
- wifi_commissioning.md: a bluetooth-only machine still installs the
  standard OE-core bluetooth stack (usable by a container app); only the
  wcs ble feature needs wifi.
- WELOTEC.md: state that wifi commissioning needs integrated WiFi & BT
  hardware, not a USB dongle.
- omnect-os-image.bb: note why an empty device_caps value is allowed
  (no file/key -> feature off; machines without the file must build).

Signed-off-by: Jan Zachmann 50990105+JanZachmann@users.noreply.github.com

@HarryWaschkeit HarryWaschkeit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

document how to disable ble in wcs (as override of command line parameter)

Let an operator turn the BLE transport off per device via WCS_DISABLE_BLE
in /etc/omnect/wifi-commissioning-service.env, even when device_caps
enables bluetooth. The oneshot parses the value and drops --enable-ble
when it is truthy. No rebuild needed; document the option and use case.

Signed-off-by: Jan Zachmann 50990105+JanZachmann@users.noreply.github.com
@JanZachmann
JanZachmann merged commit e1ad988 into omnect:main Jul 10, 2026
2 checks passed
mlilien added a commit to mlilien/meta-omnect that referenced this pull request Jul 23, 2026
Brings in main's 6 commits since omnect#665 (security sanity skip, coredump
Storage=none, iot-hub-device-update 1.4.0, image-wide RELRO hardening,
adu SIGSEGV fix, wifi-commissioning 0.2.1).

Conflict resolution in iot-hub-device-update (1.2.6.bb -> 1.4.0.bb rename):
- keep main's version bump to 1.4.0
- re-apply wrynose framework adaptations: UNPACKDIR (not WORKDIR) and the
  dropped S = "${WORKDIR}/git"
- keep the fix-diagnostics-devicename-header-guard.patch (GCC 15 -Wheader-guard)
- follow main in dropping the "rm adu-swupdate.sh" step (1.4.0 no longer
  installs it)

Auto-merged conf/distro/include/omnect-os-distro.conf, kas/distro/omnect-os.yaml
and systemd_%.bbappend (disjoint hunks; verified).

Signed-off-by: Marcel Lilienthal <134974+mlilien@users.noreply.github.com>
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.

3 participants