Skip to content

watcher.SetUseCodedPhy(true) breaks scanning on Windows #473

Description

@Finomnis

maybe related: #472

I just upgraded from btleplug 0.12.0 to 0.13.0.

Now, scanning no longer yields any events on my Windows System.

use btleplug::api::{Central, Manager as _, ScanFilter};
use btleplug::platform::Manager;
use futures_util::StreamExt as _;
use std::error::Error;
use std::time::Duration;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let manager = Manager::new().await.unwrap();

    // get the first bluetooth adapter
    let adapters = manager.adapters().await?;
    let central = adapters.into_iter().nth(0).unwrap();

    let mut events = central.events().await?;

    central.start_scan(ScanFilter::default()).await?;
    let _ = tokio::time::timeout(Duration::from_secs(2), async {
        loop {
            println!("{:?}", events.next().await.unwrap());
        }
    })
    .await;
    let _ = central.stop_scan().await;

    Ok(())
}

Expected behavior
A lot of printed lines containing discovery events of the BLE devices around me.

Actual behavior
Absolutely nothing.

Additional context
When I comment out the line let _ = self.watcher.SetUseCodedPhy(true); in src\winrtble\ble\watcher.rs:84, it works as expected.

System informations

I'm on Windows 11.
My BLE adapter is a tp-link UB400.

Activity

  1. userepo commented on Sep 17, 2026

    @userepo
    Contributor

    @Finomnis, thanks for reporting this issue.

    Could you test the fix in #474 on your UB400? Point your test program at the branch:

    btleplug = { git = "https://github.com/Poholos/btleplug", branch = "fix/gate-coded-phy-on-adapter-support" }

    Scan events coming back would confirm it on the failing side; I only have a Coded-capable adapter here.

  2. Finomnis commented on Sep 17, 2026

    @Finomnis
    Author

    I can confirm that your [patch.crates-io] section fixes my problem, while it is still broken on

    btleplug = { git = "https://github.com/deviceplug/btleplug", branch = "master" }

    (just to confirm that nothing else between 0.13.0 and master already fixed it)

  3. Finomnis commented on Sep 17, 2026

    @Finomnis
    Author

    Do you plan to release this as a 0.13.1 hot fix within the next days by any chance?

  4. userepo commented on Sep 17, 2026

    @userepo
    Contributor

    Do you plan to release this as a 0.13.1 hot fix within the next days by any chance?

    @qdot and/or @qwandor might be able to answer that.

  5. qdot commented on Sep 17, 2026

    @qdot
    Contributor

    0.13.1 will probably land today. I was about to hit release on my software w/ this dependency, of which 70% of the userbase is windows on who knows what kind of adapter, so I'd rather be safe than sorry. :)

  6. Finomnis commented on Sep 17, 2026

    @Finomnis
    Author

    0.13.1 will probably land today.

    You might want to yank 0.13.0 afterwards :)

  7. added a commit that references this issue on Sep 17, 2026
    b871236
  8. qdot commented on Sep 17, 2026

    @qdot
    Contributor

    @Finomnis 0.13.1 is out, 0.13.0 yanked.

  9. qdot commented on Oct 3, 2026

    @qdot
    Contributor

    Ok, this didn't get completely fixed until 0.13.4. Coded phy is now off by default and set_use_coded_phy(true) is now explicitly required.

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions