fix(apps): restore mobile and website launching

This commit is contained in:
archipelago
2026-05-17 19:22:18 -04:00
parent daad50325b
commit 413d50116e
12 changed files with 402 additions and 39 deletions
+20 -10
View File
@@ -48,7 +48,9 @@ pub struct MeshtasticDevice {
impl MeshtasticDevice {
pub async fn open(path: &str) -> Result<Self> {
match tokio::fs::metadata(path).await {
Ok(meta) => debug!(path = %path, permissions = ?meta.permissions(), "Device node exists"),
Ok(meta) => {
debug!(path = %path, permissions = ?meta.permissions(), "Device node exists")
}
Err(e) => anyhow::bail!("Serial device {} not accessible: {}", path, e),
}
@@ -82,7 +84,12 @@ impl MeshtasticDevice {
if remaining.is_zero() {
break;
}
match tokio::time::timeout(remaining.min(Duration::from_millis(250)), self.read_from_radio()).await {
match tokio::time::timeout(
remaining.min(Duration::from_millis(250)),
self.read_from_radio(),
)
.await
{
Ok(Ok(Some(frame))) => {
saw_meshtastic_frame = true;
self.handle_from_radio(&frame);
@@ -210,7 +217,11 @@ impl MeshtasticDevice {
FROM_RADIO_PACKET => self.packet_to_inbound_frame(value),
FROM_RADIO_CONFIG_COMPLETE_ID | FROM_RADIO_REBOOTED => None,
other => {
debug!(field = other, len = value.len(), "Unhandled Meshtastic FromRadio field");
debug!(
field = other,
len = value.len(),
"Unhandled Meshtastic FromRadio field"
);
None
}
}
@@ -336,7 +347,10 @@ fn decode_top_level_variant(buf: &[u8]) -> Option<(u64, &[u8])> {
if end > buf.len() {
return None;
}
if matches!(field, FROM_RADIO_PACKET | FROM_RADIO_MY_INFO | FROM_RADIO_NODE_INFO) {
if matches!(
field,
FROM_RADIO_PACKET | FROM_RADIO_MY_INFO | FROM_RADIO_NODE_INFO
) {
return Some((field, &buf[idx..end]));
}
idx = end;
@@ -500,12 +514,8 @@ fn next_field(buf: &[u8], idx: usize) -> Option<(u64, FieldValue<'_>, usize)> {
if end > buf.len() {
None
} else {
let value = u32::from_le_bytes([
buf[pos],
buf[pos + 1],
buf[pos + 2],
buf[pos + 3],
]);
let value =
u32::from_le_bytes([buf[pos], buf[pos + 1], buf[pos + 2], buf[pos + 3]]);
Some((field, FieldValue::Fixed32(value), end))
}
}