Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 365e5b3d authored by Hsin-chen Chuang's avatar Hsin-chen Chuang Committed by Gerrit Code Review
Browse files

Merge "floss: Fix the PID extract function" into main

parents 5b464634 2d2c3c88
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -286,6 +286,7 @@ fn pid_inotify_async_fd() -> AsyncFd<inotify::Inotify> {
/// Given an pid path, returns the adapter index for that pid path.
fn get_hci_index_from_pid_path(path: &str) -> Option<VirtualHciIndex> {
    path.rsplit_once('/')
        .or_else(|| Some(("", path))) // Contains no '/', so |path| is the last component.
        .and_then(|tup| tup.1.strip_prefix("bluetooth"))
        .and_then(|s| s.strip_suffix(".pid"))
        .and_then(|p| p.parse::<i32>().ok())