Skip to content

python3-improv: expose device info + network status over BLE (imx93-jaguar-eink) - #37

Merged
ajlennon merged 2 commits into
mainfrom
feature/improv-eink-device-info
Jul 18, 2026
Merged

python3-improv: expose device info + network status over BLE (imx93-jaguar-eink)#37
ajlennon merged 2 commits into
mainfrom
feature/improv-eink-device-info

Conversation

@ajlennon

Copy link
Copy Markdown
Member

Summary

Extends the imx93-jaguar-eink Improv BLE onboarding server so a central can read
device identity and live network state during onboarding.

  • Device Information Service (0x180A) — manufacturer, model, firmware /
    hardware / software revision, and the full SoC UID exposed as Serial
    Number (0x2A25). Values derive from the SoC serial / build info with env
    overrides; Improv stays the first advertised service.
  • Vendor Network Status characteristic (read + notify) returning versioned
    JSON: state, ssid, ipv4, rssi, iface. Cached and re-published on
    provisioning state change via a background loop.
  • Correct advertised name — the server defaults to eink-<BOARD_ID> (the
    older deployed build hardcoded SERVICE_NAME="Improv"); improv.service no
    longer forces IMPROV_SERVICE_NAME and points IMPROV_SERVER_HOST at the
    live onboarding API.
  • Net-status classification fix — uses NetworkManager's numeric device-state
    code instead of substring matching (previously "disconnected" matched
    "connected"), and only reads SSID/RSSI when genuinely connected.

Companion

App/CLI side lands in active-esl-onboard (DynamicDevices/active-esl-onboard#8):
the Flutter app reads DIS + network status during provision() and shows it on
the success screen; improv_provision.py prints the same fields.

Deploy note

This must ship in the OS image and be OTA'd before the bench hot-patch
(/etc/improv + systemd drop-in) can be dropped and eink-scheduler unmasked —
removing the hot-patch before the image ships reverts to the old script.

Test plan

  • python3 -m py_compile onboarding-server.py
  • Bench (hw-lab laptop): hot-patched build advertises eink-<BOARD_ID>;
    improv_provision.py info reads SoC UID + DIS metadata + live network
    status; full disconnected→provision flow verified over BLE
  • Foundries factory build of this branch
  • OTA bench board to the built target and confirm behavior from the baked
    image (no hot-patch)

Made with Cursor

…aguar-eink)

Add the SIG Device Information Service (0x180A: manufacturer, model, full
SoC UID as Serial Number, firmware/hardware/software revisions) and a
Dynamic Devices vendor Network Status characteristic (versioned JSON:
state/ssid/ipv4/rssi/iface; read+notify). DIS/vendor services are added
after the Improv service so only Improv is advertised (bless advertises
services[0]), keeping the legacy advert within budget.

Identity is auto-detected (soc0 serial, device-tree model, os-release) and
env-overridable for multi-board reuse. Network status is cached and
refreshed off the BLE event loop, notifying on Wi-Fi connect. Link state is
derived from NetworkManager's numeric device-state code (avoids the
"disconnected" contains "connected" substring trap); SSID/RSSI are read
only when connected, with an SSID fallback to the active connection.

improv.service now advertises eink-<BOARD_ID> (IMPROV_SERVICE_NAME override
removed) and sets IMPROV_SERVER_HOST to the live onboarding API.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8985ebd. Configure here.

Comment thread recipes-devtools/python/python3-improv/imx93-jaguar-eink/onboarding-server.py Outdated
Comment thread recipes-devtools/python/python3-improv/imx93-jaguar-eink/onboarding-server.py Outdated
… link state

- compute_net_status: NetworkManager's numeric device state is authoritative; a
  lingering interface IP no longer upgrades a disconnected/failed device to
  "connected", and IP/SSID/RSSI are only surfaced when genuinely connected.
- Remove the synchronous compute_net_status() calls from wifi_connect() and
  run() startup, which ran multi-second nmcli subprocesses on the asyncio/BLE
  event loop and stalled Improv read/write handling. Startup seeds via an
  executor; provisioning triggers an immediate off-loop refresh through a new
  asyncio.Event consumed by net_status_loop.

Addresses Bugbot findings on PR #37.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ajlennon
ajlennon merged commit f0f085c into main Jul 18, 2026
2 checks passed
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