mouse speed fix
This commit is contained in:
parent
1110c59f1e
commit
83f5d7124d
@ -132,20 +132,26 @@ impl LesavkaClientApp {
|
|||||||
let mut cli = RelayClient::new(ep.clone());
|
let mut cli = RelayClient::new(ep.clone());
|
||||||
|
|
||||||
let outbound = BroadcastStream::new(self.kbd_tx.subscribe()).filter_map(|r| r.ok());
|
let outbound = BroadcastStream::new(self.kbd_tx.subscribe()).filter_map(|r| r.ok());
|
||||||
let resp = match cli.stream_keyboard(Request::new(outbound)).await {
|
match cli.stream_keyboard(Request::new(outbound)).await {
|
||||||
Ok(r) => r, Err(e) => { error!("stream_keyboard: {e}"); Self::delay().await; continue }
|
Ok(mut resp) => {
|
||||||
};
|
// spawn a task just to drain echoes (keeps h2 window happy)
|
||||||
|
tokio::spawn(async move {
|
||||||
// let mut inbound = resp.into_inner();
|
while let Some(_)= resp.get_mut().message().await.transpose() {}
|
||||||
// while let Some(m) = inbound.message().await.transpose() {
|
warn!("⌨️ server closed stream");
|
||||||
// match m {
|
});
|
||||||
// Ok(r) => trace!("kbd echo {} B", r.data.len()),
|
}
|
||||||
// Err(e) => { error!("kbd inbound: {e}"); break }
|
Err(e) => {
|
||||||
// }
|
error!("stream_keyboard: {e}");
|
||||||
// }
|
|
||||||
drop(resp);
|
|
||||||
warn!("⌨️ disconnected");
|
|
||||||
Self::delay().await;
|
Self::delay().await;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// from now on we just park – connection persists until it errors
|
||||||
|
futures::future::pending::<()>().await;
|
||||||
|
|
||||||
|
// drop(resp);
|
||||||
|
// warn!("⌨️ disconnected");
|
||||||
|
// Self::delay().await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,20 +166,25 @@ impl LesavkaClientApp {
|
|||||||
let mut cli = RelayClient::new(ep.clone());
|
let mut cli = RelayClient::new(ep.clone());
|
||||||
|
|
||||||
let outbound = BroadcastStream::new(self.mou_tx.subscribe()).filter_map(|r| r.ok());
|
let outbound = BroadcastStream::new(self.mou_tx.subscribe()).filter_map(|r| r.ok());
|
||||||
let resp = match cli.stream_mouse(Request::new(outbound)).await {
|
match cli.stream_mouse(Request::new(outbound)).await {
|
||||||
Ok(r) => r, Err(e) => { error!("stream_mouse: {e}"); Self::delay().await; continue }
|
Ok(mut resp) => {
|
||||||
};
|
// spawn a task just to drain echoes (keeps h2 window happy)
|
||||||
|
tokio::spawn(async move {
|
||||||
// let mut inbound = resp.into_inner();
|
while let Some(_)= resp.get_mut().message().await.transpose() {}
|
||||||
// while let Some(m) = inbound.message().await.transpose() {
|
warn!("⌨️ server closed stream");
|
||||||
// match m {
|
});
|
||||||
// Ok(r) => trace!("mouse echo {} B", r.data.len()),
|
}
|
||||||
// Err(e) => { error!("mouse inbound: {e}"); break }
|
Err(e) => {
|
||||||
// }
|
error!("stream_mouse: {e}");
|
||||||
// }
|
|
||||||
drop(resp);
|
|
||||||
warn!("🖱️ disconnected");
|
|
||||||
Self::delay().await;
|
Self::delay().await;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// from now on we just park – connection persists until it errors
|
||||||
|
futures::future::pending::<()>().await;
|
||||||
|
// drop(resp);
|
||||||
|
// warn!("🖱️ disconnected");
|
||||||
|
// Self::delay().await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@ use tracing::{debug, error, warn, trace};
|
|||||||
|
|
||||||
use lesavka_common::lesavka::MouseReport;
|
use lesavka_common::lesavka::MouseReport;
|
||||||
|
|
||||||
const SEND_INTERVAL: Duration = Duration::from_micros(2000);
|
const SEND_INTERVAL: Duration = Duration::from_micros(250);
|
||||||
|
|
||||||
pub struct MouseAggregator {
|
pub struct MouseAggregator {
|
||||||
dev: Device,
|
dev: Device,
|
||||||
|
|||||||
@ -143,7 +143,7 @@ impl Relay for Handler {
|
|||||||
.map_err(|e| Status::internal(e.to_string()))?;
|
.map_err(|e| Status::internal(e.to_string()))?;
|
||||||
tokio::time::sleep(Duration::from_millis(500)).await;
|
tokio::time::sleep(Duration::from_millis(500)).await;
|
||||||
}
|
}
|
||||||
let (tx, _rx) =
|
let (tx, rx) =
|
||||||
tokio::sync::mpsc::channel::<Result<KeyboardReport, Status>>(32);
|
tokio::sync::mpsc::channel::<Result<KeyboardReport, Status>>(32);
|
||||||
let kb = self.kb.clone();
|
let kb = self.kb.clone();
|
||||||
|
|
||||||
@ -193,16 +193,14 @@ impl Relay for Handler {
|
|||||||
Ok::<(), Status>(())
|
Ok::<(), Status>(())
|
||||||
});
|
});
|
||||||
|
|
||||||
let (_noop_tx, empty_rx) =
|
Ok(Response::new(ReceiverStream::new(rx)))
|
||||||
tokio::sync::mpsc::channel::<Result<KeyboardReport, Status>>(1);
|
|
||||||
Ok(Response::new(ReceiverStream::new(empty_rx)))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn stream_mouse(
|
async fn stream_mouse(
|
||||||
&self,
|
&self,
|
||||||
req: Request<tonic::Streaming<MouseReport>>,
|
req: Request<tonic::Streaming<MouseReport>>,
|
||||||
) -> Result<Response<Self::StreamMouseStream>, Status> {
|
) -> Result<Response<Self::StreamMouseStream>, Status> {
|
||||||
let (tx, _rx) =
|
let (tx, rx) =
|
||||||
tokio::sync::mpsc::channel::<Result<MouseReport, Status>>(4096);
|
tokio::sync::mpsc::channel::<Result<MouseReport, Status>>(4096);
|
||||||
let ms = self.ms.clone();
|
let ms = self.ms.clone();
|
||||||
|
|
||||||
@ -251,9 +249,7 @@ impl Relay for Handler {
|
|||||||
Ok::<(), Status>(())
|
Ok::<(), Status>(())
|
||||||
});
|
});
|
||||||
|
|
||||||
let (_noop_tx, empty_rx) =
|
Ok(Response::new(ReceiverStream::new(rx)))
|
||||||
tokio::sync::mpsc::channel::<Result<MouseReport, Status>>(1);
|
|
||||||
Ok(Response::new(ReceiverStream::new(empty_rx)))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn capture_video(
|
async fn capture_video(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user