updates
This commit is contained in:
parent
f76b7f29eb
commit
1d4a3f8615
@ -8,6 +8,7 @@ use futures_util::{Stream, StreamExt};
|
|||||||
use tokio::{fs::{OpenOptions}, io::AsyncWriteExt, sync::Mutex};
|
use tokio::{fs::{OpenOptions}, io::AsyncWriteExt, sync::Mutex};
|
||||||
use tokio_stream::{wrappers::ReceiverStream};
|
use tokio_stream::{wrappers::ReceiverStream};
|
||||||
use tonic::{transport::Server, Request, Response, Status};
|
use tonic::{transport::Server, Request, Response, Status};
|
||||||
|
use anyhow::Context as _;
|
||||||
use tracing::{info, trace, warn};
|
use tracing::{info, trace, warn};
|
||||||
use tracing_subscriber::{filter::EnvFilter, fmt, prelude::*};
|
use tracing_subscriber::{filter::EnvFilter, fmt, prelude::*};
|
||||||
use tracing_appender::non_blocking;
|
use tracing_appender::non_blocking;
|
||||||
@ -64,10 +65,12 @@ impl Handler {
|
|||||||
|
|
||||||
let kb = OpenOptions::new()
|
let kb = OpenOptions::new()
|
||||||
.write(true).custom_flags(libc::O_NONBLOCK)
|
.write(true).custom_flags(libc::O_NONBLOCK)
|
||||||
.open("/dev/hidg0").await?;
|
.open("/dev/hidg0").await
|
||||||
|
.context("opening /dev/hidg0")?;
|
||||||
let ms = OpenOptions::new()
|
let ms = OpenOptions::new()
|
||||||
.write(true).custom_flags(libc::O_NONBLOCK)
|
.write(true).custom_flags(libc::O_NONBLOCK)
|
||||||
.open("/dev/hidg1").await?;
|
.open("/dev/hidg1").await
|
||||||
|
.context("opening /dev/hidg1")?;
|
||||||
|
|
||||||
Ok(Self { kb: Arc::new(Mutex::new(kb)),
|
Ok(Self { kb: Arc::new(Mutex::new(kb)),
|
||||||
ms: Arc::new(Mutex::new(ms)),
|
ms: Arc::new(Mutex::new(ms)),
|
||||||
@ -195,7 +198,7 @@ impl Relay for Handler {
|
|||||||
#[tokio::main(flavor = "multi_thread", worker_threads = 4)]
|
#[tokio::main(flavor = "multi_thread", worker_threads = 4)]
|
||||||
async fn main() -> anyhow::Result<()> {
|
async fn main() -> anyhow::Result<()> {
|
||||||
/* logging */
|
/* logging */
|
||||||
let _log_guard = init_tracing()?;
|
let _log_guard: WorkerGuard = init_tracing()?;
|
||||||
|
|
||||||
/* auto‑cycle task */
|
/* auto‑cycle task */
|
||||||
// tokio::spawn(async { monitor_gc311_disconnect().await.ok(); });
|
// tokio::spawn(async { monitor_gc311_disconnect().await.ok(); });
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user