Skip to content

[P3] Windows PnP fallback reports paired-but-offline controller as connected #101

Description

@shiftedx

Severity: P3 · Category: bug · Found by: user report on v0.5.0

Observed behavior

With a Bluetooth-paired DualSense Edge powered OFF, the app shows the controller as connected. The agent API returns connected: true, connection_state: "connected" for id windows-pnp-dualsense-edge, while battery is unknown and the output pipeline has written zero reports.

Expected behavior

A paired-but-offline controller detected only via Windows PnP records should be shown honestly (e.g., "Paired (offline) - configuration available"), not as connected. connected must be false so effect targeting, profile application, and Input Bridge session guards skip it.

Root cause

When hidapi reports zero controllers, controller_registry.rs falls back to windows_pnp::controller_events(), which text-matches SetupDi PnP records. Bluetooth pairing records stay "present" (status OK) while the controller is off, and windows_pnp.rs hardcodes ConnectionState::Connected on the synthesized entry (its own windows_pnp_fallback diagnostic already admits no HID handle exists).

Reproduction

Pair a DualSense/DualSense Edge over Bluetooth, power it off, restart the agent (so hidapi finds nothing), open the app: the controller card shows connected.

Evidence

crates/dscc-agent/src/controller_registry/windows_pnp.rs:321,333 (hardcoded Connected); crates/dscc-agent/src/controller_registry.rs:540-542 (fallback gate); crates/dscc-agent/src/controller_registry.rs:391 (connected derived from connection == Connected). Verified live on v0.5.0: agent reported connected while Windows had only BTHENUM pairing records present.

Suggested fix

Add a Detected variant to ConnectionState (dscc-core), use it for the PnP fallback entries, keep configuration routes working for detected controllers (the fallback purpose), and render the state distinctly in the web UI. Consumers gating on .connected then exclude phantom entries automatically.

Acceptance criteria

  • PnP-fallback controllers report connection_state: "detected" and connected: false
  • Configuration remains available for detected controllers (existing fallback tests stay green)
  • Web UI renders the detected state distinctly (not the connected badge)
  • Standard validation set stays green (cargo fmt/test/clippy, web typecheck/build + test scripts)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingready-for-agentFully specified and ready for an AFK agent

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions