inotify relies on tokio, so a switch is required..

This commit is contained in:
Luke D. Jones
2022-09-22 12:55:15 +12:00
parent 283cb7e589
commit 3b9cf474a7
7 changed files with 15 additions and 12 deletions

4
Cargo.lock generated
View File

@@ -2530,9 +2530,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.20.1" version = "1.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a8325f63a7d4774dd041e363b2409ed1c5cbbd0f867795e661df066b2b0a581" checksum = "0020c875007ad96677dcc890298f4b942882c5d4eb7cc8f439fc3bf813dc9c95"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"libc", "libc",

View File

@@ -211,7 +211,9 @@ fn do_parsed(
} }
if let Some(chg_limit) = parsed.chg_limit { if let Some(chg_limit) = parsed.chg_limit {
dbus.proxies().charge().set_charge_control_end_threshold(chg_limit)?; dbus.proxies()
.charge()
.set_charge_control_end_threshold(chg_limit)?;
} }
Ok(()) Ok(())

View File

@@ -44,5 +44,5 @@ toml = "^0.5.8"
# Device control # Device control
sysfs-class = "^0.1.2" # used for backlight control and baord ID sysfs-class = "^0.1.2" # used for backlight control and baord ID
inotify = "0.10.0" inotify = { version = "0.10.0", default-features = false }
concat-idents = "1.1.3" concat-idents = "1.1.3"

View File

@@ -1,5 +1,5 @@
use crate::{CtrlTask, task_watch_item};
use crate::{config::Config, error::RogError, GetSupported}; use crate::{config::Config, error::RogError, GetSupported};
use crate::{task_watch_item, CtrlTask};
use async_trait::async_trait; use async_trait::async_trait;
use log::{info, warn}; use log::{info, warn};
use rog_platform::platform::{AsusPlatform, GpuMode}; use rog_platform::platform::{AsusPlatform, GpuMode};
@@ -311,8 +311,9 @@ impl CtrlTask for CtrlRogBios {
) )
.await; .await;
self.watch_panel_od(executor, signal_ctxt.clone())?; self.watch_panel_od(executor, signal_ctxt.clone()).await?;
self.watch_gpu_mux_mode(executor, signal_ctxt.clone())?; self.watch_gpu_mux_mode(executor, signal_ctxt.clone())
.await?;
Ok(()) Ok(())
} }

View File

@@ -167,7 +167,8 @@ impl CtrlTask for CtrlPower {
) )
.await; .await;
self.watch_charge_control_end_threshold(executor, signal_ctxt)?; self.watch_charge_control_end_threshold(executor, signal_ctxt)
.await?;
Ok(()) Ok(())
} }

View File

@@ -78,7 +78,7 @@ pub trait ZbusAdd {
macro_rules! task_watch_item { macro_rules! task_watch_item {
($name:ident $self_inner:ident) => { ($name:ident $self_inner:ident) => {
concat_idents::concat_idents!(fn_name = watch_, $name { concat_idents::concat_idents!(fn_name = watch_, $name {
fn fn_name<'a>( async fn fn_name<'a>(
&self, &self,
executor: &mut Executor<'a>, executor: &mut Executor<'a>,
signal_ctxt: SignalContext<'a>, signal_ctxt: SignalContext<'a>,
@@ -91,17 +91,15 @@ macro_rules! task_watch_item {
executor executor
.spawn(async move { .spawn(async move {
let mut buffer = [0; 1024]; let mut buffer = [0; 1024];
watch.event_stream(&mut buffer).unwrap().for_each(|e|{ watch.event_stream(&mut buffer).unwrap().for_each(|_| async {
let value = ctrl.$name(); let value = ctrl.$name();
dbg!(value); dbg!(value);
concat_idents::concat_idents!(notif_fn = notify_, $name { concat_idents::concat_idents!(notif_fn = notify_, $name {
Self::notif_fn(&signal_ctxt, value).await.unwrap(); Self::notif_fn(&signal_ctxt, value).await.unwrap();
}); });
smol::future::ready(())
}).await; }).await;
}) })
.detach(); .detach();
dbg!("SPWADEWFWEFE");
}); });
Ok(()) Ok(())
} }

View File

@@ -18,5 +18,6 @@ udev = "^0.6"
rusb = "^0.9" rusb = "^0.9"
sysfs-class = "^0.1" sysfs-class = "^0.1"
inotify = "^0.10.0" inotify = "^0.10.0"
# inotify = { version = "0.10.0", default-features = false }
concat-idents = "1.1.3" concat-idents = "1.1.3"