// Returns a Future that resolves when a bt-host device gets added under the given topological
// path.
Returns a Future that resolves when a bt-host device gets added under the given topological
path.
Returns a Future that resolves when a bt - host device gets added under the given topological path .
async fn watch_for_new_host_helper(
    mut watcher: VfsWatcher,
    parent_topo_path: String,
) -> Result<(File, PathBuf), Error> {
    while let Some(msg) = await!(watcher.try_next())? {
        match msg.event {
            VfsWatchEvent::EXISTING | VfsWatchEvent::ADD_FILE => {
                let path =
                    PathBuf::from(format!("{}/{}", BT_HOST_DIR, msg.filename.to_string_lossy()));
                let host_fd = hci::open_rdwr(&path)?;
                let host_topo_path = fdio::device_get_topo_path(&host_fd)?;
                if host_topo_path.starts_with(parent_topo_path.as_str()) {
                    return Ok((host_fd, path.clone()));
                }
            }
            _ => (),
        }
    }
    unreachable!();
}
async fn watch_for_new_host_helper ( mut watcher : VfsWatcher , parent_topo_path : String , ) -> Result < ( File , PathBuf ) , Error > { while let Some ( msg ) = await ! ( watcher try_next ( ) ) ? { match msg . event { VfsWatchEvent :: EXISTING | VfsWatchEvent :: ADD_FILE => { let path = PathBuf :: from ( format ! ( " " BT_HOST_DIR msg filename to_string_lossy ( ) ) ) ; let host_fd = hci :: open_rdwr ( & path ) ? ; let host_topo_path = fdio :: device_get_topo_path ( & host_fd ) ? ; if host_topo_path . starts_with ( parent_topo_path . as_str ( ) ) { return Ok ( ( host_fd , path . clone ( ) ) ) ; } } _ => ( ) , } } unreachable ! ( ) ; }
Returns a Future that resolves when a bt-host device gets added under the given topological
path.
Returns a Future that resolves when a bt - host device gets added under the given topological path .
watcher
VfsWatcher
parent_topo_path
String