mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-01-22 17:33:19 +01:00
Update deps
This commit is contained in:
@@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Fix attribute writes. At some point the kernel API seems to have changed.
|
||||||
|
|
||||||
## [v6.0.12]
|
## [v6.0.12]
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
2033
Cargo.lock
generated
2033
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -44,11 +44,11 @@ tokio = { version = "^1.39.0", default-features = false, features = [
|
|||||||
] }
|
] }
|
||||||
concat-idents = "^1.1"
|
concat-idents = "^1.1"
|
||||||
dirs = "^4.0"
|
dirs = "^4.0"
|
||||||
smol = "^1.3"
|
smol = "^2.0"
|
||||||
mio = "0.8.11"
|
mio = "0.8.11"
|
||||||
|
|
||||||
zbus = "4.4"
|
zbus = "5.1"
|
||||||
logind-zbus = { version = "4.0.3" } #, default-features = false, features = ["non_blocking"] }
|
logind-zbus = { version = "5.0.0" } #, default-features = false, features = ["non_blocking"] }
|
||||||
|
|
||||||
serde = { version = "^1.0", features = ["serde_derive"] }
|
serde = { version = "^1.0", features = ["serde_derive"] }
|
||||||
ron = "*"
|
ron = "*"
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ pub struct CtrlAnimeInner<'a> {
|
|||||||
do_early_return: Arc<AtomicBool>,
|
do_early_return: Arc<AtomicBool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> CtrlAnimeInner<'static> {
|
impl CtrlAnimeInner<'static> {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
sequences: Sequences,
|
sequences: Sequences,
|
||||||
client: AnimeProxyBlocking<'static>,
|
client: AnimeProxyBlocking<'static>,
|
||||||
@@ -81,7 +81,7 @@ impl<'a> CtrlAnimeInner<'static> {
|
|||||||
|
|
||||||
/// To be called on each main loop iteration to pump out commands to the
|
/// To be called on each main loop iteration to pump out commands to the
|
||||||
/// anime
|
/// anime
|
||||||
pub fn run(&'a self) -> Result<(), Error> {
|
pub fn run(&self) -> Result<(), Error> {
|
||||||
if self.do_early_return.load(Ordering::SeqCst) {
|
if self.do_early_return.load(Ordering::SeqCst) {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ use rog_anime::usb::{
|
|||||||
};
|
};
|
||||||
use rog_anime::{Animations, AnimeDataBuffer, DeviceState};
|
use rog_anime::{Animations, AnimeDataBuffer, DeviceState};
|
||||||
use zbus::export::futures_util::lock::Mutex;
|
use zbus::export::futures_util::lock::Mutex;
|
||||||
use zbus::{interface, CacheProperties, Connection, SignalContext};
|
use zbus::object_server::SignalEmitter;
|
||||||
|
use zbus::proxy::CacheProperties;
|
||||||
|
use zbus::{interface, Connection};
|
||||||
|
|
||||||
use super::config::AnimeConfig;
|
use super::config::AnimeConfig;
|
||||||
use super::CtrlAnime;
|
use super::CtrlAnime;
|
||||||
@@ -297,7 +299,7 @@ impl crate::CtrlTask for CtrlAnimeZbus {
|
|||||||
ANIME_ZBUS_PATH
|
ANIME_ZBUS_PATH
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn create_tasks(&self, _: SignalContext<'static>) -> Result<(), RogError> {
|
async fn create_tasks(&self, _: SignalEmitter<'static>) -> Result<(), RogError> {
|
||||||
let inner1 = self.0.clone();
|
let inner1 = self.0.clone();
|
||||||
let inner2 = self.0.clone();
|
let inner2 = self.0.clone();
|
||||||
let inner3 = self.0.clone();
|
let inner3 = self.0.clone();
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ impl AuraConfig {
|
|||||||
for enabled_init in &mut config_init.enabled.states {
|
for enabled_init in &mut config_init.enabled.states {
|
||||||
for enabled in &mut config_loaded.enabled.states {
|
for enabled in &mut config_loaded.enabled.states {
|
||||||
if enabled.zone == enabled_init.zone {
|
if enabled.zone == enabled_init.zone {
|
||||||
*enabled_init = enabled.clone();
|
*enabled_init = *enabled;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use log::{error, info, warn};
|
|||||||
use mio::{Events, Interest, Poll, Token};
|
use mio::{Events, Interest, Poll, Token};
|
||||||
use tokio::task::spawn_blocking;
|
use tokio::task::spawn_blocking;
|
||||||
use udev::{Device, MonitorBuilder};
|
use udev::{Device, MonitorBuilder};
|
||||||
use zbus::object_server::SignalContext;
|
use zbus::object_server::SignalEmitter;
|
||||||
use zbus::zvariant::{ObjectPath, OwnedObjectPath};
|
use zbus::zvariant::{ObjectPath, OwnedObjectPath};
|
||||||
use zbus::Connection;
|
use zbus::Connection;
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ pub(crate) fn dbus_path_for_tuf() -> OwnedObjectPath {
|
|||||||
pub async fn start_tasks(
|
pub async fn start_tasks(
|
||||||
mut zbus: CtrlAuraZbus,
|
mut zbus: CtrlAuraZbus,
|
||||||
connection: Connection,
|
connection: Connection,
|
||||||
_signal_ctx: SignalContext<'static>,
|
_signal_ctx: SignalEmitter<'static>,
|
||||||
path: OwnedObjectPath,
|
path: OwnedObjectPath,
|
||||||
) -> Result<(), RogError> {
|
) -> Result<(), RogError> {
|
||||||
// let task = zbus.clone();
|
// let task = zbus.clone();
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ use rog_aura::{AuraDeviceType, AuraEffect, AuraModeNum, AuraZone, LedBrightness,
|
|||||||
use zbus::export::futures_util::lock::{Mutex, MutexGuard};
|
use zbus::export::futures_util::lock::{Mutex, MutexGuard};
|
||||||
use zbus::export::futures_util::StreamExt;
|
use zbus::export::futures_util::StreamExt;
|
||||||
use zbus::fdo::Error as ZbErr;
|
use zbus::fdo::Error as ZbErr;
|
||||||
use zbus::{interface, SignalContext};
|
use zbus::interface;
|
||||||
|
use zbus::object_server::SignalEmitter;
|
||||||
|
|
||||||
use super::controller::CtrlKbdLed;
|
use super::controller::CtrlKbdLed;
|
||||||
use crate::error::RogError;
|
use crate::error::RogError;
|
||||||
@@ -18,10 +19,10 @@ pub const AURA_ZBUS_NAME: &str = "Aura";
|
|||||||
pub const AURA_ZBUS_PATH: &str = "/org/asuslinux";
|
pub const AURA_ZBUS_PATH: &str = "/org/asuslinux";
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct CtrlAuraZbus(Arc<Mutex<CtrlKbdLed>>, SignalContext<'static>);
|
pub struct CtrlAuraZbus(Arc<Mutex<CtrlKbdLed>>, SignalEmitter<'static>);
|
||||||
|
|
||||||
impl CtrlAuraZbus {
|
impl CtrlAuraZbus {
|
||||||
pub fn new(controller: CtrlKbdLed, signal: SignalContext<'static>) -> Self {
|
pub fn new(controller: CtrlKbdLed, signal: SignalEmitter<'static>) -> Self {
|
||||||
Self(Arc::new(Mutex::new(controller)), signal)
|
Self(Arc::new(Mutex::new(controller)), signal)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +116,7 @@ impl CtrlAuraZbus {
|
|||||||
}
|
}
|
||||||
ctrl.config.write();
|
ctrl.config.write();
|
||||||
|
|
||||||
self.led_mode_data_invalidate(&self.1).await.ok();
|
self.led_mode_data_changed(&self.1).await.ok();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,7 +158,7 @@ impl CtrlAuraZbus {
|
|||||||
ctrl.config.set_builtin(effect);
|
ctrl.config.set_builtin(effect);
|
||||||
ctrl.config.write();
|
ctrl.config.write();
|
||||||
|
|
||||||
self.led_mode_invalidate(&self.1).await.ok();
|
self.led_mode_changed(&self.1).await.ok();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,7 +212,7 @@ impl CtrlTask for CtrlAuraZbus {
|
|||||||
"/org/asuslinux"
|
"/org/asuslinux"
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn create_tasks(&self, _: SignalContext<'static>) -> Result<(), RogError> {
|
async fn create_tasks(&self, _: SignalEmitter<'static>) -> Result<(), RogError> {
|
||||||
let load_save =
|
let load_save =
|
||||||
|start: bool, mut lock: MutexGuard<'_, CtrlKbdLed>| -> Result<(), RogError> {
|
|start: bool, mut lock: MutexGuard<'_, CtrlKbdLed>| -> Result<(), RogError> {
|
||||||
// If waking up
|
// If waking up
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ use rog_profiles::fan_curve_set::CurveData;
|
|||||||
use rog_profiles::{find_fan_curve_node, FanCurvePU, FanCurveProfiles};
|
use rog_profiles::{find_fan_curve_node, FanCurvePU, FanCurveProfiles};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use zbus::{interface, Connection, SignalContext};
|
use zbus::object_server::SignalEmitter;
|
||||||
|
use zbus::{interface, Connection};
|
||||||
|
|
||||||
use crate::error::RogError;
|
use crate::error::RogError;
|
||||||
use crate::{CtrlTask, CONFIG_PATH_BASE};
|
use crate::{CtrlTask, CONFIG_PATH_BASE};
|
||||||
@@ -234,7 +235,7 @@ impl CtrlTask for CtrlFanCurveZbus {
|
|||||||
FAN_CURVE_ZBUS_PATH
|
FAN_CURVE_ZBUS_PATH
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn create_tasks(&self, _signal_ctxt: SignalContext<'static>) -> Result<(), RogError> {
|
async fn create_tasks(&self, _signal_ctxt: SignalEmitter<'static>) -> Result<(), RogError> {
|
||||||
let watch_throttle_thermal_policy = self.platform.monitor_throttle_thermal_policy()?;
|
let watch_throttle_thermal_policy = self.platform.monitor_throttle_thermal_policy()?;
|
||||||
let platform = self.platform.clone();
|
let platform = self.platform.clone();
|
||||||
let config = self.config.clone();
|
let config = self.config.clone();
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ use rog_platform::platform::{GpuMode, Properties, RogPlatform, ThrottlePolicy};
|
|||||||
use rog_platform::power::AsusPower;
|
use rog_platform::power::AsusPower;
|
||||||
use zbus::export::futures_util::lock::Mutex;
|
use zbus::export::futures_util::lock::Mutex;
|
||||||
use zbus::fdo::Error as FdoErr;
|
use zbus::fdo::Error as FdoErr;
|
||||||
use zbus::{interface, Connection, SignalContext};
|
use zbus::object_server::SignalEmitter;
|
||||||
|
use zbus::{interface, Connection};
|
||||||
|
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::error::RogError;
|
use crate::error::RogError;
|
||||||
@@ -44,7 +45,7 @@ macro_rules! platform_set_value {
|
|||||||
concat_idents::concat_idents!(set = set_, $property {
|
concat_idents::concat_idents!(set = set_, $property {
|
||||||
$self.platform.set($new_value).map_err(|err| {
|
$self.platform.set($new_value).map_err(|err| {
|
||||||
error!("RogPlatform: {} {err}", $prop_name);
|
error!("RogPlatform: {} {err}", $prop_name);
|
||||||
FdoErr::NotSupported(format!("RogPlatform: {} {err}", $prop_name))
|
FdoErr::Failed(format!("RogPlatform: {} {err}", $prop_name))
|
||||||
})?;
|
})?;
|
||||||
});
|
});
|
||||||
let mut lock = $self.config.lock().await;
|
let mut lock = $self.config.lock().await;
|
||||||
@@ -93,7 +94,7 @@ impl CtrlPlatform {
|
|||||||
pub fn new(
|
pub fn new(
|
||||||
config: Arc<Mutex<Config>>,
|
config: Arc<Mutex<Config>>,
|
||||||
config_path: &Path,
|
config_path: &Path,
|
||||||
signal_context: SignalContext<'static>,
|
signal_context: SignalEmitter<'static>,
|
||||||
) -> Result<Self, RogError> {
|
) -> Result<Self, RogError> {
|
||||||
// let attrs = FirmwareAttributes::new();
|
// let attrs = FirmwareAttributes::new();
|
||||||
let platform = RogPlatform::new()?;
|
let platform = RogPlatform::new()?;
|
||||||
@@ -384,7 +385,7 @@ impl CtrlPlatform {
|
|||||||
/// If fan-curves are supported will also activate a fan curve for profile.
|
/// If fan-curves are supported will also activate a fan curve for profile.
|
||||||
async fn next_throttle_thermal_policy(
|
async fn next_throttle_thermal_policy(
|
||||||
&mut self,
|
&mut self,
|
||||||
#[zbus(signal_context)] ctxt: SignalContext<'_>,
|
#[zbus(signal_context)] ctxt: SignalEmitter<'_>,
|
||||||
) -> Result<(), FdoErr> {
|
) -> Result<(), FdoErr> {
|
||||||
let policy: ThrottlePolicy =
|
let policy: ThrottlePolicy =
|
||||||
platform_get_value!(self, throttle_thermal_policy, "throttle_thermal_policy")
|
platform_get_value!(self, throttle_thermal_policy, "throttle_thermal_policy")
|
||||||
@@ -715,7 +716,7 @@ impl ReloadAndNotify for CtrlPlatform {
|
|||||||
/// Called on config file changed externally
|
/// Called on config file changed externally
|
||||||
async fn reload_and_notify(
|
async fn reload_and_notify(
|
||||||
&mut self,
|
&mut self,
|
||||||
signal_context: &SignalContext<'static>,
|
signal_context: &SignalEmitter<'static>,
|
||||||
data: Self::Data,
|
data: Self::Data,
|
||||||
) -> Result<(), RogError> {
|
) -> Result<(), RogError> {
|
||||||
let mut config = self.config.lock().await;
|
let mut config = self.config.lock().await;
|
||||||
@@ -878,7 +879,7 @@ impl CtrlTask for CtrlPlatform {
|
|||||||
PLATFORM_ZBUS_PATH
|
PLATFORM_ZBUS_PATH
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn create_tasks(&self, signal_ctxt: SignalContext<'static>) -> Result<(), RogError> {
|
async fn create_tasks(&self, signal_ctxt: SignalEmitter<'static>) -> Result<(), RogError> {
|
||||||
let platform1 = self.clone();
|
let platform1 = self.clone();
|
||||||
let platform2 = self.clone();
|
let platform2 = self.clone();
|
||||||
let platform3 = self.clone();
|
let platform3 = self.clone();
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ use log::warn;
|
|||||||
use rog_slash::usb::{pkt_set_mode, pkt_set_options};
|
use rog_slash::usb::{pkt_set_mode, pkt_set_options};
|
||||||
use rog_slash::{DeviceState, SlashMode};
|
use rog_slash::{DeviceState, SlashMode};
|
||||||
use zbus::export::futures_util::lock::Mutex;
|
use zbus::export::futures_util::lock::Mutex;
|
||||||
use zbus::{interface, Connection, SignalContext};
|
use zbus::object_server::SignalEmitter;
|
||||||
|
use zbus::{interface, Connection};
|
||||||
|
|
||||||
use crate::ctrl_slash::CtrlSlash;
|
use crate::ctrl_slash::CtrlSlash;
|
||||||
use crate::error::RogError;
|
use crate::error::RogError;
|
||||||
@@ -153,7 +154,7 @@ impl crate::CtrlTask for CtrlSlashZbus {
|
|||||||
SLASH_ZBUS_PATH
|
SLASH_ZBUS_PATH
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn create_tasks(&self, _: SignalContext<'static>) -> Result<(), RogError> {
|
async fn create_tasks(&self, _: SignalEmitter<'static>) -> Result<(), RogError> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,10 @@ use futures_lite::stream::StreamExt;
|
|||||||
use log::{debug, info, warn};
|
use log::{debug, info, warn};
|
||||||
use logind_zbus::manager::ManagerProxy;
|
use logind_zbus::manager::ManagerProxy;
|
||||||
use tokio::time::sleep;
|
use tokio::time::sleep;
|
||||||
|
use zbus::object_server::{Interface, SignalEmitter};
|
||||||
|
use zbus::proxy::CacheProperties;
|
||||||
use zbus::zvariant::ObjectPath;
|
use zbus::zvariant::ObjectPath;
|
||||||
use zbus::{CacheProperties, Connection, SignalContext};
|
use zbus::Connection;
|
||||||
|
|
||||||
use crate::error::RogError;
|
use crate::error::RogError;
|
||||||
|
|
||||||
@@ -39,7 +41,7 @@ pub static DBUS_IFACE: &str = "org.asuslinux.Daemon";
|
|||||||
/// methods to be available:
|
/// methods to be available:
|
||||||
/// - `<name>() -> SomeValue`, functionally is a getter, but is allowed to have
|
/// - `<name>() -> SomeValue`, functionally is a getter, but is allowed to have
|
||||||
/// side effects.
|
/// side effects.
|
||||||
/// - `notify_<name>(SignalContext, SomeValue)`
|
/// - `notify_<name>(SignalEmitter, SomeValue)`
|
||||||
///
|
///
|
||||||
/// In most cases if `SomeValue` is stored in a config then `<name>()` getter is
|
/// In most cases if `SomeValue` is stored in a config then `<name>()` getter is
|
||||||
/// expected to update it. The getter should *never* write back to the path or
|
/// expected to update it. The getter should *never* write back to the path or
|
||||||
@@ -60,7 +62,7 @@ macro_rules! task_watch_item {
|
|||||||
concat_idents::concat_idents!(fn_name = watch_, $name {
|
concat_idents::concat_idents!(fn_name = watch_, $name {
|
||||||
async fn fn_name(
|
async fn fn_name(
|
||||||
&self,
|
&self,
|
||||||
signal_ctxt: SignalContext<'static>,
|
signal_ctxt: SignalEmitter<'static>,
|
||||||
) -> Result<(), RogError> {
|
) -> Result<(), RogError> {
|
||||||
use zbus::export::futures_util::StreamExt;
|
use zbus::export::futures_util::StreamExt;
|
||||||
|
|
||||||
@@ -100,7 +102,7 @@ macro_rules! task_watch_item_notify {
|
|||||||
concat_idents::concat_idents!(fn_name = watch_, $name {
|
concat_idents::concat_idents!(fn_name = watch_, $name {
|
||||||
async fn fn_name(
|
async fn fn_name(
|
||||||
&self,
|
&self,
|
||||||
signal_ctxt: SignalContext<'static>,
|
signal_ctxt: SignalEmitter<'static>,
|
||||||
) -> Result<(), RogError> {
|
) -> Result<(), RogError> {
|
||||||
use zbus::export::futures_util::StreamExt;
|
use zbus::export::futures_util::StreamExt;
|
||||||
|
|
||||||
@@ -143,7 +145,7 @@ pub trait ReloadAndNotify {
|
|||||||
|
|
||||||
fn reload_and_notify(
|
fn reload_and_notify(
|
||||||
&mut self,
|
&mut self,
|
||||||
signal_context: &SignalContext<'static>,
|
signal_context: &SignalEmitter<'static>,
|
||||||
data: Self::Data,
|
data: Self::Data,
|
||||||
) -> impl Future<Output = Result<(), RogError>> + Send;
|
) -> impl Future<Output = Result<(), RogError>> + Send;
|
||||||
}
|
}
|
||||||
@@ -152,7 +154,7 @@ pub trait ZbusRun {
|
|||||||
fn add_to_server(self, server: &mut Connection) -> impl Future<Output = ()> + Send;
|
fn add_to_server(self, server: &mut Connection) -> impl Future<Output = ()> + Send;
|
||||||
|
|
||||||
fn add_to_server_helper(
|
fn add_to_server_helper(
|
||||||
iface: impl zbus::Interface,
|
iface: impl Interface,
|
||||||
path: &str,
|
path: &str,
|
||||||
server: &mut Connection,
|
server: &mut Connection,
|
||||||
) -> impl Future<Output = ()> + Send {
|
) -> impl Future<Output = ()> + Send {
|
||||||
@@ -174,8 +176,8 @@ pub trait ZbusRun {
|
|||||||
pub trait CtrlTask {
|
pub trait CtrlTask {
|
||||||
fn zbus_path() -> &'static str;
|
fn zbus_path() -> &'static str;
|
||||||
|
|
||||||
fn signal_context(connection: &Connection) -> Result<SignalContext<'static>, zbus::Error> {
|
fn signal_context(connection: &Connection) -> Result<SignalEmitter<'static>, zbus::Error> {
|
||||||
SignalContext::new(connection, Self::zbus_path())
|
SignalEmitter::new(connection, Self::zbus_path())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Implement to set up various tasks that may be required, using the
|
/// Implement to set up various tasks that may be required, using the
|
||||||
@@ -183,7 +185,7 @@ pub trait CtrlTask {
|
|||||||
/// separate thread.
|
/// separate thread.
|
||||||
fn create_tasks(
|
fn create_tasks(
|
||||||
&self,
|
&self,
|
||||||
signal: SignalContext<'static>,
|
signal: SignalEmitter<'static>,
|
||||||
) -> impl Future<Output = Result<(), RogError>> + Send;
|
) -> impl Future<Output = Result<(), RogError>> + Send;
|
||||||
|
|
||||||
// /// Create a timed repeating task
|
// /// Create a timed repeating task
|
||||||
@@ -297,7 +299,7 @@ pub trait GetSupported {
|
|||||||
pub async fn start_tasks<T>(
|
pub async fn start_tasks<T>(
|
||||||
mut zbus: T,
|
mut zbus: T,
|
||||||
connection: &mut Connection,
|
connection: &mut Connection,
|
||||||
signal_ctx: SignalContext<'static>,
|
signal_ctx: SignalEmitter<'static>,
|
||||||
) -> Result<(), RogError>
|
) -> Result<(), RogError>
|
||||||
where
|
where
|
||||||
T: ZbusRun + Reloadable + CtrlTask + Clone,
|
T: ZbusRun + Reloadable + CtrlTask + Clone,
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ console-subscriber = { version = "^0.4", optional = true }
|
|||||||
|
|
||||||
nix = { version = "^0.29.0", features = ["fs"] }
|
nix = { version = "^0.29.0", features = ["fs"] }
|
||||||
tempfile = "3.3.0"
|
tempfile = "3.3.0"
|
||||||
betrayer = { version = "0.2.0" }
|
betrayer = { version = "0.3.0" }
|
||||||
|
|
||||||
asusd = { path = "../asusd" }
|
asusd = { path = "../asusd" }
|
||||||
config-traits = { path = "../config-traits" }
|
config-traits = { path = "../config-traits" }
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"POT-Creation-Date: 2024-09-07 05:05+0000\n"
|
"POT-Creation-Date: 2024-11-28 03:29+0000\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use zbus::proxy;
|
|||||||
default_service = "org.asuslinux.Daemon",
|
default_service = "org.asuslinux.Daemon",
|
||||||
default_path = "/org/asuslinux"
|
default_path = "/org/asuslinux"
|
||||||
)]
|
)]
|
||||||
trait Anime {
|
pub trait Anime {
|
||||||
/// DeviceState method
|
/// DeviceState method
|
||||||
fn device_state(&self) -> zbus::Result<AnimeDeviceState>;
|
fn device_state(&self) -> zbus::Result<AnimeDeviceState>;
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ const BLOCKING_TIME: u64 = 33; // 100ms = 10 FPS, max 50ms = 20 FPS, 40ms = 25 F
|
|||||||
default_service = "org.asuslinux.Daemon",
|
default_service = "org.asuslinux.Daemon",
|
||||||
default_path = "/org/asuslinux/Aura"
|
default_path = "/org/asuslinux/Aura"
|
||||||
)]
|
)]
|
||||||
trait Aura {
|
pub trait Aura {
|
||||||
/// AllModeData method
|
/// AllModeData method
|
||||||
fn all_mode_data(&self) -> zbus::Result<BTreeMap<AuraModeNum, AuraEffect>>;
|
fn all_mode_data(&self) -> zbus::Result<BTreeMap<AuraModeNum, AuraEffect>>;
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ use zbus::proxy;
|
|||||||
default_service = "org.asuslinux.Daemon",
|
default_service = "org.asuslinux.Daemon",
|
||||||
default_path = "/org/asuslinux"
|
default_path = "/org/asuslinux"
|
||||||
)]
|
)]
|
||||||
trait FanCurves {
|
pub trait FanCurves {
|
||||||
/// Get the fan-curve data for the currently active PlatformProfile
|
/// Get the fan-curve data for the currently active PlatformProfile
|
||||||
fn fan_curve_data(&self, profile: ThrottlePolicy) -> zbus::Result<Vec<CurveData>>;
|
fn fan_curve_data(&self, profile: ThrottlePolicy) -> zbus::Result<Vec<CurveData>>;
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ use zbus::proxy;
|
|||||||
default_service = "org.asuslinux.Daemon",
|
default_service = "org.asuslinux.Daemon",
|
||||||
default_path = "/org/asuslinux"
|
default_path = "/org/asuslinux"
|
||||||
)]
|
)]
|
||||||
trait Platform {
|
pub trait Platform {
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn version(&self) -> zbus::Result<String>;
|
fn version(&self) -> zbus::Result<String>;
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use zbus::proxy;
|
|||||||
default_service = "org.asuslinux.Daemon",
|
default_service = "org.asuslinux.Daemon",
|
||||||
default_path = "/org/asuslinux"
|
default_path = "/org/asuslinux"
|
||||||
)]
|
)]
|
||||||
trait Slash {
|
pub trait Slash {
|
||||||
/// EnableDisplay property
|
/// EnableDisplay property
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn enabled(&self) -> zbus::Result<bool>;
|
fn enabled(&self) -> zbus::Result<bool>;
|
||||||
|
|||||||
@@ -244,25 +244,26 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[ignore = "Can't check in docker env"]
|
||||||
fn find_attributes() {
|
fn find_attributes() {
|
||||||
let attrs = FirmwareAttributes::new();
|
let attrs = FirmwareAttributes::new();
|
||||||
for attr in attrs.attributes() {
|
for attr in attrs.attributes() {
|
||||||
dbg!(attr.name());
|
dbg!(attr.name());
|
||||||
match attr.name() {
|
match attr.name() {
|
||||||
"nv_dynamic_boost" => {
|
"dgpu_disable" => {
|
||||||
assert!(!attr.help().is_empty());
|
assert!(!attr.help().is_empty());
|
||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
attr.current_value().unwrap(),
|
attr.current_value().unwrap(),
|
||||||
AttrValue::Integer(_)
|
AttrValue::Integer(_)
|
||||||
));
|
));
|
||||||
if let AttrValue::Integer(val) = attr.current_value().unwrap() {
|
if let AttrValue::Integer(val) = attr.current_value().unwrap() {
|
||||||
assert_eq!(val, 5);
|
assert_eq!(val, 0);
|
||||||
}
|
}
|
||||||
if let AttrValue::Integer(val) = attr.default_value {
|
if let AttrValue::Integer(val) = attr.default_value {
|
||||||
assert_eq!(val, 25);
|
assert_eq!(val, 25);
|
||||||
}
|
}
|
||||||
assert_eq!(attr.min_value, AttrValue::Integer(0));
|
assert_eq!(attr.min_value, AttrValue::None);
|
||||||
assert_eq!(attr.max_value, AttrValue::Integer(25));
|
assert_eq!(attr.max_value, AttrValue::None);
|
||||||
}
|
}
|
||||||
"boot_sound" => {
|
"boot_sound" => {
|
||||||
assert!(!attr.help().is_empty());
|
assert!(!attr.help().is_empty());
|
||||||
@@ -278,6 +279,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[ignore = "Can't check in docker env"]
|
||||||
fn test_boot_sound() {
|
fn test_boot_sound() {
|
||||||
let attrs = FirmwareAttributes::new();
|
let attrs = FirmwareAttributes::new();
|
||||||
let attr = attrs
|
let attr = attrs
|
||||||
@@ -302,7 +304,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[ignore = "Requires root to set the value"]
|
#[ignore = "Can't check in docker env"]
|
||||||
fn test_set_boot_sound() {
|
fn test_set_boot_sound() {
|
||||||
let attrs = FirmwareAttributes::new();
|
let attrs = FirmwareAttributes::new();
|
||||||
let attr = attrs
|
let attr = attrs
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ pub mod usb_raw;
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use error::{PlatformError, Result};
|
use error::{PlatformError, Result};
|
||||||
|
use log::warn;
|
||||||
use udev::Device;
|
use udev::Device;
|
||||||
|
|
||||||
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
@@ -44,9 +45,13 @@ pub fn read_attr_bool(device: &Device, attr_name: &str) -> Result<bool> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn write_attr_bool(device: &mut Device, attr: &str, value: bool) -> Result<()> {
|
pub fn write_attr_bool(device: &mut Device, attr: &str, value: bool) -> Result<()> {
|
||||||
|
let value = if value { 1 } else { 0 };
|
||||||
device
|
device
|
||||||
.set_attribute_value(attr, value.to_string())
|
.set_attribute_value(attr, value.to_string())
|
||||||
.map_err(|e| PlatformError::IoPath(attr.into(), e))
|
.map_err(|e| {
|
||||||
|
warn!("attr write error: {e:?}");
|
||||||
|
PlatformError::IoPath(attr.into(), e)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn read_attr_u8(device: &Device, attr_name: &str) -> Result<u8> {
|
pub fn read_attr_u8(device: &Device, attr_name: &str) -> Result<u8> {
|
||||||
|
|||||||
Reference in New Issue
Block a user