This commit is contained in:
Brad Stein 2025-06-15 22:33:44 -05:00
parent cf23c31a60
commit 91fb85bfa8
3 changed files with 8 additions and 5 deletions

View File

@ -6,6 +6,7 @@ use tokio::sync::broadcast::Sender;
use tracing::{warn, error, info, debug};
use navka_common::navka::HidReport;
use navka_common::navka::hid_report::Kind;
use crate::input::keymap::{keycode_to_usage, is_modifier};
@ -113,12 +114,12 @@ impl KeyboardAggregator {
kind: Some(hid_report::Kind::KeyboardReport(report.to_vec())),
};
match self.tx.try_send(msg.clone()) {
match self.tx.send(msg.clone()) {
Ok(n) => {
info!("📤 sent HID report → {n} subscriber(s)");
}
Err(e) => {
tracing::warn!("try_send failed: {e}");
tracing::warn!("send failed: {e}");
let _ = self.tx.send(msg);
}
}

View File

@ -3,7 +3,9 @@
use evdev::{Device, InputEvent, EventType, KeyCode, RelativeAxisCode};
use tokio::sync::broadcast::Sender;
use tracing::{error, debug};
use navka_common::navka::HidReport;
use navka_common::navka::hid_report::Kind;
/// Aggregator for a single mouse device
pub struct MouseAggregator {
@ -90,12 +92,12 @@ impl MouseAggregator {
kind: Some(hid_report::Kind::MouseReport(report.to_vec())),
};
match self.tx.try_send(msg.clone()) {
match self.tx.send(msg.clone()) {
Ok(n) => {
tracing::trace!("queued → {} receiver(s)", n);
}
Err(e) => {
tracing::warn!("try_send dropped report ({e}); falling back to send()");
tracing::warn!("send dropped report ({e}); falling back to send()");
let _ = self.tx.send(msg);
}
}

View File

@ -40,7 +40,7 @@ async fn main() -> Result<()> {
app.run().await
}
fmt()
fmt!()
.with_env_filter(
// honour RUST_LOG but fall back to very chatty defaults
EnvFilter::try_from_default_env()