4d63974cf9
Refactor daemon_target_from_env to prefer PCID_CLIENT_CHANNEL (the
channel contract used by driver-manager) over PCID_DEVICE_PATH
(legacy). Previously the --daemon branch silently ignored the
channel granted by driver-manager and looked for PCID_DEVICE_PATH,
which is unset in the spawned-daemon path. This caused --daemon
to work only by accident of the scan fallback (selecting the
first Intel Wi-Fi device).
Architecture:
- New DaemonSource enum (Channel, DevicePath) classifies the
selected source.
- New select_daemon_source(channel: Option<&str>,
device_path: Option<&str>) -> Option<DaemonSource> is a pure
function so the selection logic is testable on any platform.
- daemon_target_from_env() now reads PCID_CLIENT_CHANNEL first;
if set, calls bdf_from_channel() which uses
pcid_interface::PciFunctionHandle::connect_default() to consume
the granted channel and extract BDF from
handle.config().func.addr (PciAddress whose Display impl
produces SSSS:BB:DD.F, matching PciLocation exactly).
- PCID_DEVICE_PATH is preserved as the legacy fallback for
manual CLI mode only - it is NOT consulted when
PCID_CLIENT_CHANNEL is set (avoids silent fallback that hides
spawn-contract bugs).
- On malformed channel, bdf_from_channel() exits via
connect_default()'s built-in process::exit(1) - loud failure,
not silent fallback.
Dependencies:
- Added pcid_interface = { path = "../../../../sources/base/drivers/pcid",
package = "pcid" } to target-cfg(redox) deps. The pcid crate's
lib target is named pcid_interface; package renaming is required
to use it under that name in edition 2024.
- [patch.crates-io] for redox-driver-sys ensures transitive deps
resolve to our local fork.
Tests:
- 3 tests pass (all up from pre-fix).
- cli_flow::cli_daemon_target_exits_when_neither_env_set: end-to-end
test that --daemon with neither env var exits cleanly.
- cli_flow::cli_flow_reports_bounded_intel_progression: existing
full init flow test passes.
- Unit tests in main.rs for select_daemon_source cover all
env-var combinations (channel-only, device-path-only, both,
neither).
Per local/AGENTS.md:
- No new branches (work on 0.3.1)
- No stubs, no todo!/unimplemented!
- Cat 1 in-house recipe - source IS the durable location
Closes G-A4 from v4.8 audit. Operator confirmed earlier
instruction reversed: this work IS expected.
Driver-manager config at local/config/drivers.d/70-wifi.toml
spawns iwlwifi with --daemon and passes PCID_CLIENT_CHANNEL.
This commit makes iwlwifi actually consume that channel
end-to-end.