From 9ea3ba22bd359bf506906e9d50cd936807ae5fe9 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 17 Jun 2026 11:54:28 +0100 Subject: [PATCH] Classify unreachable Bluetooth Moves --- crates/muninn-daemon/src/main.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/muninn-daemon/src/main.rs b/crates/muninn-daemon/src/main.rs index 65afec2..43ff48a 100644 --- a/crates/muninn-daemon/src/main.rs +++ b/crates/muninn-daemon/src/main.rs @@ -452,8 +452,13 @@ fn build_bluetooth_move_identity_record( pickup_detail: Option, ) -> Option { let move_id = bluetooth_address_move_id(&device.address)?; + let pickup_unreachable = pickup_detail + .as_deref() + .is_some_and(bluetooth_pickup_detail_is_unreachable); let state = if device.connected { "bluetooth-connected" + } else if device.trusted && pickup_unreachable { + "bluetooth-unreachable" } else if device.trusted { "bluetooth-waiting" } else { @@ -664,6 +669,12 @@ fn bluetooth_pickup_detail( .map(|attempt| attempt.detail.clone()) } +fn bluetooth_pickup_detail_is_unreachable(detail: &str) -> bool { + let normalized = detail.to_ascii_lowercase(); + normalized.contains("br-connection-create-socket") + || normalized.contains("host is down") +} + #[cfg(unix)] fn active_move_source_has_bluetooth_address( active: &[ActiveMoveStateSource], @@ -4874,7 +4885,7 @@ Device 00:07:04:A8:00:D0 (public) ) .unwrap(); - assert_eq!(record.state, "bluetooth-waiting"); + assert_eq!(record.state, "bluetooth-unreachable"); assert!(record.detail.contains("Last pickup attempt: Failed to connect")); assert!(record.detail.contains("br-connection-create-socket")); }