Skip to content

Zephyr wifi stop_station returns without disconnecting (station lifecycle stubs) #40

Open

Description

@tyeth-ai-assisted

On a Pico W using the Zephyr port, wifi.radio.stop_station() returns without disconnecting an associated station. Both start_station() and stop_station() currently contain only commented-out set_mode_station() calls.

This was physically observed on CircuitPython 11.0.0-alpha.2-30-g7d4ef1aac7 during the Env Hub firmware refresh. With no managed workload running and no AP or BLE connection active, the state was:

BEFORE: wifi_connected=true, ap_active=false, ble_connected=false, advertising=false
wifi.radio.stop_station()
AFTER:  wifi_connected=true, ap_active=false, ble_connected=false, advertising=false

The same function bodies remained in the preceding integration head 6b117bdce576abf927554a4946b8610149150aa0. Upstream main was checked on 23 October 2026 and also has the stubs, in ports/zephyr-cp/common-hal/wifi/Radio.c (Git blob 1570d57d63a7855081d8097685487de1461d165c). This is distinct from the socket-service DHCP scheduling fix in #32.

Minimal reproduction on an available test AP:

import wifi
wifi.radio.connect("test-ap", "test-password", timeout=20)
assert wifi.radio.connected
wifi.radio.stop_station()
print(wifi.radio.connected)  # observed True; the method did nothing

Expected: stopping the station ends its station connection, with state and events reflecting the result. A subsequent start_station() should restore station operation. Shared station/AP interface behaviour must be handled deliberately rather than blindly taking down an active AP.

An explicit wifi.radio.enabled = False made the connected check false in a separate physical control. It disables the interface globally and is not a substitute implementation of station lifecycle semantics. The connection was present again in a later console session; that re-enable path has not been fully isolated. The firmware updater now quiesces the radio in the same session as bootloader entry. Both refused update attempts occurred before any flash read/write and were retained.

Update: candidate fix 9e153ad624bcd1559211dfad8eb54ef8841f15e9 is in draft PR #32. It implements start/stop, waits for disconnect completion, preserves state on failure and retains a shared-interface AP. The actual-source harness passes 46 checks; preceding 6b117 fails 38. Physical Pico W now passes three connect/stop/reconnect cycles, repeated stop, disabled-start, externally observed departure and AP-preservation/ping, with successful cleanup. Both Pico images build; Pico 2 rollout and physical failure injection remain open. Keep this issue open pending upstream disposition.

Reproduction, evidence and limits. Two earlier fixture failures are preserved separately; they were not relabelled as passes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions