mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Unify the laptop aura power stuff
This commit is contained in:
58
Cargo.lock
generated
58
Cargo.lock
generated
@@ -236,9 +236,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "async-executor"
|
||||
version = "1.9.1"
|
||||
version = "1.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "10b3e585719c2358d2660232671ca8ca4ddb4be4ce8a1842d6c2dc8685303316"
|
||||
checksum = "5f98c37cf288e302c16ef6c8472aad1e034c6c84ce5ea7b8101c98eb4a802fee"
|
||||
dependencies = [
|
||||
"async-lock 3.3.0",
|
||||
"async-task",
|
||||
@@ -666,9 +666,9 @@ checksum = "7b02b629252fe8ef6460461409564e2c21d0c8e77e0944f3d189ff06c4e932ad"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.90"
|
||||
version = "1.0.91"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5"
|
||||
checksum = "1fd97381a8cc6493395a5afc4c691c1084b3768db713b73aa215217aa245d153"
|
||||
dependencies = [
|
||||
"jobserver",
|
||||
"libc",
|
||||
@@ -854,7 +854,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "const-field-offset"
|
||||
version = "0.1.5"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#44cee9c31ea256c381f59b9e93d9579a3a8423e9"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"const-field-offset-macro",
|
||||
"field-offset",
|
||||
@@ -863,7 +863,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "const-field-offset-macro"
|
||||
version = "0.1.5"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#44cee9c31ea256c381f59b9e93d9579a3a8423e9"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1168,9 +1168,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "downcast-rs"
|
||||
version = "1.2.0"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
|
||||
checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
|
||||
|
||||
[[package]]
|
||||
name = "drm"
|
||||
@@ -1877,9 +1877,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "half"
|
||||
version = "2.4.0"
|
||||
version = "2.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5eceaaeec696539ddaf7b333340f1af35a5aa87ae3e4f3ead0532f72affab2e"
|
||||
checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crunchy",
|
||||
@@ -1931,7 +1931,7 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
||||
[[package]]
|
||||
name = "i-slint-backend-linuxkms"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#44cee9c31ea256c381f59b9e93d9579a3a8423e9"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"calloop",
|
||||
"drm",
|
||||
@@ -1951,7 +1951,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "i-slint-backend-qt"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#44cee9c31ea256c381f59b9e93d9579a3a8423e9"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"const-field-offset",
|
||||
"i-slint-common",
|
||||
@@ -1963,7 +1963,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "i-slint-backend-selector"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#44cee9c31ea256c381f59b9e93d9579a3a8423e9"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"i-slint-backend-linuxkms",
|
||||
@@ -1976,7 +1976,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "i-slint-backend-winit"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#44cee9c31ea256c381f59b9e93d9579a3a8423e9"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"cfg-if",
|
||||
@@ -2009,7 +2009,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "i-slint-common"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#44cee9c31ea256c381f59b9e93d9579a3a8423e9"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"derive_more",
|
||||
@@ -2020,7 +2020,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "i-slint-compiler"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#44cee9c31ea256c381f59b9e93d9579a3a8423e9"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"by_address",
|
||||
"codemap",
|
||||
@@ -2049,7 +2049,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "i-slint-core"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#44cee9c31ea256c381f59b9e93d9579a3a8423e9"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"auto_enums",
|
||||
"bytemuck",
|
||||
@@ -2094,7 +2094,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "i-slint-core-macros"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#44cee9c31ea256c381f59b9e93d9579a3a8423e9"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 2.0.58",
|
||||
@@ -2103,7 +2103,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "i-slint-renderer-femtovg"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#44cee9c31ea256c381f59b9e93d9579a3a8423e9"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"const-field-offset",
|
||||
@@ -2134,7 +2134,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "i-slint-renderer-skia"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#44cee9c31ea256c381f59b9e93d9579a3a8423e9"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"cfg-if",
|
||||
@@ -3651,9 +3651,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.14"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
|
||||
checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47"
|
||||
|
||||
[[package]]
|
||||
name = "rustybuzz"
|
||||
@@ -3901,7 +3901,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "slint"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#44cee9c31ea256c381f59b9e93d9579a3a8423e9"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"const-field-offset",
|
||||
"i-slint-backend-selector",
|
||||
@@ -3917,7 +3917,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "slint-build"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#44cee9c31ea256c381f59b9e93d9579a3a8423e9"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"i-slint-compiler",
|
||||
"spin_on",
|
||||
@@ -3928,7 +3928,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "slint-macros"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#44cee9c31ea256c381f59b9e93d9579a3a8423e9"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"i-slint-compiler",
|
||||
"proc-macro2",
|
||||
@@ -4703,7 +4703,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "vtable"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#44cee9c31ea256c381f59b9e93d9579a3a8423e9"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"const-field-offset",
|
||||
"portable-atomic",
|
||||
@@ -4714,7 +4714,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "vtable-macro"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#44cee9c31ea256c381f59b9e93d9579a3a8423e9"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -4993,9 +4993,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "winapi-wsapoll"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44c17110f57155602a80dca10be03852116403c9ff3cd25b079d666f2aa3df6e"
|
||||
checksum = "1eafc5f679c576995526e81635d0cf9695841736712b4e892f87abbe6fed3f28"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
@@ -10,10 +10,10 @@ pub struct LedPowerCommand1 {
|
||||
pub help: bool,
|
||||
#[options(meta = "", help = "Control if LEDs enabled while awake <true/false>")]
|
||||
pub awake: Option<bool>,
|
||||
#[options(meta = "", help = "Use with awake option <true/false>")]
|
||||
pub keyboard: Option<bool>,
|
||||
#[options(meta = "", help = "Use with awake option <true/false>")]
|
||||
pub lightbar: Option<bool>,
|
||||
#[options(help = "Use with awake option, if excluded defaults to false")]
|
||||
pub keyboard: bool,
|
||||
#[options(help = "Use with awake option, if excluded defaults to false")]
|
||||
pub lightbar: bool,
|
||||
#[options(meta = "", help = "Control boot animations <true/false>")]
|
||||
pub boot: Option<bool>,
|
||||
#[options(meta = "", help = "Control suspend animations <true/false>")]
|
||||
|
||||
@@ -12,8 +12,9 @@ use fan_curve_cli::FanCurveCommand;
|
||||
use gumdrop::{Opt, Options};
|
||||
use rog_anime::usb::get_anime_type;
|
||||
use rog_anime::{AnimTime, AnimeDataBuffer, AnimeDiagonal, AnimeGif, AnimeImage, AnimeType, Vec2};
|
||||
use rog_aura::keyboard::{AuraPowerState, LaptopOldAuraPower, LaptopTufAuraPower};
|
||||
use rog_aura::usb::{AuraDevice, AuraPowerDev};
|
||||
use rog_aura::aura_detection::PowerZones;
|
||||
use rog_aura::keyboard::{AuraPowerState, LaptopAuraPower};
|
||||
use rog_aura::usb::AuraDevice;
|
||||
use rog_aura::{self, AuraEffect};
|
||||
use rog_dbus::zbus_anime::AnimeProxyBlocking;
|
||||
use rog_dbus::zbus_aura::AuraProxyBlocking;
|
||||
@@ -572,8 +573,8 @@ fn handle_led_power1(
|
||||
if power.awake.is_none()
|
||||
&& power.sleep.is_none()
|
||||
&& power.boot.is_none()
|
||||
&& power.keyboard.is_none()
|
||||
&& power.lightbar.is_none()
|
||||
&& !power.keyboard
|
||||
&& !power.lightbar
|
||||
{
|
||||
if !power.help {
|
||||
println!("Missing arg or command\n");
|
||||
@@ -582,15 +583,10 @@ fn handle_led_power1(
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if dev_type.is_old_style() {
|
||||
if dev_type.is_old_style() || dev_type.is_tuf_style() {
|
||||
handle_led_power_1_do_1866(aura, power)?;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if dev_type.is_tuf_style() {
|
||||
handle_led_power_1_do_tuf(aura, power)?;
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
println!("These options are for keyboards of product ID 0x1866 or TUF only");
|
||||
@@ -601,62 +597,24 @@ fn handle_led_power_1_do_1866(
|
||||
aura: &AuraProxyBlocking,
|
||||
power: &LedPowerCommand1,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut enabled: Vec<LaptopOldAuraPower> = Vec::new();
|
||||
let mut disabled: Vec<LaptopOldAuraPower> = Vec::new();
|
||||
|
||||
let mut check = |e: Option<bool>, a: LaptopOldAuraPower| {
|
||||
if let Some(arg) = e {
|
||||
if arg {
|
||||
enabled.push(a);
|
||||
} else {
|
||||
disabled.push(a);
|
||||
}
|
||||
}
|
||||
let zone = if power.keyboard && power.lightbar {
|
||||
PowerZones::KeyboardAndLightbar
|
||||
} else if power.lightbar {
|
||||
PowerZones::Lightbar
|
||||
} else {
|
||||
PowerZones::Keyboard
|
||||
};
|
||||
let states = LaptopAuraPower {
|
||||
states: vec![AuraPowerState {
|
||||
zone,
|
||||
boot: power.boot.unwrap_or_default(),
|
||||
awake: power.awake.unwrap_or_default(),
|
||||
sleep: power.sleep.unwrap_or_default(),
|
||||
shutdown: false,
|
||||
}],
|
||||
};
|
||||
|
||||
check(power.awake, LaptopOldAuraPower::Awake);
|
||||
check(power.boot, LaptopOldAuraPower::Boot);
|
||||
check(power.sleep, LaptopOldAuraPower::Sleep);
|
||||
check(power.keyboard, LaptopOldAuraPower::Keyboard);
|
||||
check(power.lightbar, LaptopOldAuraPower::Lightbar);
|
||||
|
||||
let data = AuraPowerDev {
|
||||
old_rog: enabled,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
aura.set_led_power(data.clone())?; // TODO: verify this
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_led_power_1_do_tuf(
|
||||
aura: &AuraProxyBlocking,
|
||||
power: &LedPowerCommand1,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut enabled: Vec<LaptopTufAuraPower> = Vec::new();
|
||||
let mut disabled: Vec<LaptopTufAuraPower> = Vec::new();
|
||||
|
||||
let mut check = |e: Option<bool>, a: LaptopTufAuraPower| {
|
||||
if let Some(arg) = e {
|
||||
if arg {
|
||||
enabled.push(a);
|
||||
} else {
|
||||
disabled.push(a);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
check(power.awake, LaptopTufAuraPower::Awake);
|
||||
check(power.boot, LaptopTufAuraPower::Boot);
|
||||
check(power.sleep, LaptopTufAuraPower::Sleep);
|
||||
check(power.keyboard, LaptopTufAuraPower::Keyboard);
|
||||
|
||||
let data = AuraPowerDev {
|
||||
tuf: enabled,
|
||||
..Default::default()
|
||||
};
|
||||
aura.set_led_power(data.clone())?; // TODO: verify this
|
||||
aura.set_led_power(states)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -696,25 +654,30 @@ fn handle_led_power2(
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let set = |power: &mut AuraPowerState, set_to: &AuraPowerStates| {
|
||||
power.boot = set_to.boot;
|
||||
power.awake = set_to.awake;
|
||||
power.sleep = set_to.sleep;
|
||||
power.shutdown = set_to.shutdown;
|
||||
let mut states = aura.led_power()?;
|
||||
let mut set = |zone: PowerZones, set_to: &AuraPowerStates| {
|
||||
for state in states.states.iter_mut() {
|
||||
if state.zone == zone {
|
||||
state.boot = set_to.boot;
|
||||
state.awake = set_to.awake;
|
||||
state.sleep = set_to.sleep;
|
||||
state.shutdown = set_to.shutdown;
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let mut enabled = aura.led_power()?;
|
||||
if let Some(cmd) = &power.command {
|
||||
match cmd {
|
||||
aura_cli::SetAuraZoneEnabled::Keyboard(k) => set(&mut enabled.rog.keyboard, k),
|
||||
aura_cli::SetAuraZoneEnabled::Logo(l) => set(&mut enabled.rog.logo, l),
|
||||
aura_cli::SetAuraZoneEnabled::Lightbar(l) => set(&mut enabled.rog.lightbar, l),
|
||||
aura_cli::SetAuraZoneEnabled::Lid(l) => set(&mut enabled.rog.lid, l),
|
||||
aura_cli::SetAuraZoneEnabled::RearGlow(r) => set(&mut enabled.rog.rear_glow, r),
|
||||
aura_cli::SetAuraZoneEnabled::Keyboard(k) => set(PowerZones::Keyboard, k),
|
||||
aura_cli::SetAuraZoneEnabled::Logo(l) => set(PowerZones::Logo, l),
|
||||
aura_cli::SetAuraZoneEnabled::Lightbar(l) => set(PowerZones::Lightbar, l),
|
||||
aura_cli::SetAuraZoneEnabled::Lid(l) => set(PowerZones::Lid, l),
|
||||
aura_cli::SetAuraZoneEnabled::RearGlow(r) => set(PowerZones::RearGlow, r),
|
||||
}
|
||||
}
|
||||
|
||||
aura.set_led_power(enabled)?;
|
||||
aura.set_led_power(states)?;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,112 +1,13 @@
|
||||
use std::collections::{BTreeMap, HashSet};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use config_traits::{StdConfig, StdConfigLoad};
|
||||
use log::{debug, info};
|
||||
use rog_aura::aura_detection::LaptopLedData;
|
||||
use rog_aura::keyboard::{LaptopAuraPower, LaptopOldAuraPower, LaptopTufAuraPower};
|
||||
use rog_aura::usb::{AuraDevice, AuraPowerDev};
|
||||
use rog_aura::keyboard::{LaptopAuraPower, LaptopAuraType};
|
||||
use rog_aura::usb::AuraDevice;
|
||||
use rog_aura::{AuraEffect, AuraModeNum, AuraZone, Direction, LedBrightness, Speed, GRADIENT};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
/// Enable/disable LED control in various states such as
|
||||
/// when the device is awake, suspended, shutting down or
|
||||
/// booting.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum AuraPowerConfig {
|
||||
AuraDevTuf(HashSet<LaptopTufAuraPower>),
|
||||
AuraDevRog1(HashSet<LaptopOldAuraPower>),
|
||||
AuraDevRog2(LaptopAuraPower),
|
||||
}
|
||||
|
||||
impl Default for AuraPowerConfig {
|
||||
fn default() -> Self {
|
||||
Self::AuraDevTuf(HashSet::default())
|
||||
}
|
||||
}
|
||||
|
||||
impl AuraPowerConfig {
|
||||
/// Invalid for TUF laptops
|
||||
pub fn to_bytes(control: &Self) -> [u8; 4] {
|
||||
match control {
|
||||
AuraPowerConfig::AuraDevTuf(_) => [0, 0, 0, 0],
|
||||
AuraPowerConfig::AuraDevRog1(c) => {
|
||||
let c: Vec<LaptopOldAuraPower> = c.iter().copied().collect();
|
||||
LaptopOldAuraPower::to_bytes(&c)
|
||||
}
|
||||
AuraPowerConfig::AuraDevRog2(c) => c.to_bytes(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_tuf_bool_array(control: &Self) -> Option<[bool; 5]> {
|
||||
if let Self::AuraDevTuf(c) = control {
|
||||
return Some([
|
||||
true,
|
||||
c.contains(&LaptopTufAuraPower::Boot),
|
||||
c.contains(&LaptopTufAuraPower::Awake),
|
||||
c.contains(&LaptopTufAuraPower::Sleep),
|
||||
c.contains(&LaptopTufAuraPower::Keyboard),
|
||||
]);
|
||||
}
|
||||
|
||||
if let Self::AuraDevRog1(c) = control {
|
||||
return Some([
|
||||
true,
|
||||
c.contains(&LaptopOldAuraPower::Boot),
|
||||
c.contains(&LaptopOldAuraPower::Awake),
|
||||
c.contains(&LaptopOldAuraPower::Sleep),
|
||||
c.contains(&LaptopOldAuraPower::Keyboard),
|
||||
]);
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
pub fn set_tuf(&mut self, power: LaptopTufAuraPower, on: bool) {
|
||||
if let Self::AuraDevTuf(p) = self {
|
||||
if on {
|
||||
p.insert(power);
|
||||
} else {
|
||||
p.remove(&power);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_0x1866(&mut self, power: LaptopOldAuraPower, on: bool) {
|
||||
if let Self::AuraDevRog1(p) = self {
|
||||
if on {
|
||||
p.insert(power);
|
||||
} else {
|
||||
p.remove(&power);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_0x19b6(&mut self, power: LaptopAuraPower) {
|
||||
if let Self::AuraDevRog2(p) = self {
|
||||
*p = power;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&AuraPowerConfig> for AuraPowerDev {
|
||||
fn from(config: &AuraPowerConfig) -> Self {
|
||||
match config {
|
||||
AuraPowerConfig::AuraDevTuf(d) => AuraPowerDev {
|
||||
tuf: d.iter().copied().collect(),
|
||||
..Default::default()
|
||||
},
|
||||
AuraPowerConfig::AuraDevRog1(d) => AuraPowerDev {
|
||||
old_rog: d.iter().copied().collect(),
|
||||
..Default::default()
|
||||
},
|
||||
AuraPowerConfig::AuraDevRog2(d) => AuraPowerDev {
|
||||
rog: d.clone(),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Default, Debug, Clone)]
|
||||
// #[serde(default)]
|
||||
pub struct AuraConfig {
|
||||
@@ -116,7 +17,7 @@ pub struct AuraConfig {
|
||||
pub builtins: BTreeMap<AuraModeNum, AuraEffect>,
|
||||
pub multizone: Option<BTreeMap<AuraModeNum, Vec<AuraEffect>>>,
|
||||
pub multizone_on: bool,
|
||||
pub enabled: AuraPowerConfig,
|
||||
pub enabled: LaptopAuraPower,
|
||||
}
|
||||
|
||||
impl AuraConfig {
|
||||
@@ -151,22 +52,11 @@ impl AuraConfig {
|
||||
pub fn from_default_support(prod_id: AuraDevice, support_data: &LaptopLedData) -> Self {
|
||||
// create a default config here
|
||||
let enabled = if prod_id.is_new_style() {
|
||||
AuraPowerConfig::AuraDevRog2(LaptopAuraPower::new_all_on())
|
||||
LaptopAuraPower::new(LaptopAuraType::New, support_data)
|
||||
} else if prod_id.is_tuf_style() {
|
||||
AuraPowerConfig::AuraDevTuf(HashSet::from([
|
||||
LaptopTufAuraPower::Awake,
|
||||
LaptopTufAuraPower::Boot,
|
||||
LaptopTufAuraPower::Sleep,
|
||||
LaptopTufAuraPower::Keyboard,
|
||||
]))
|
||||
LaptopAuraPower::new(LaptopAuraType::Tuf, support_data)
|
||||
} else {
|
||||
AuraPowerConfig::AuraDevRog1(HashSet::from([
|
||||
LaptopOldAuraPower::Awake,
|
||||
LaptopOldAuraPower::Boot,
|
||||
LaptopOldAuraPower::Sleep,
|
||||
LaptopOldAuraPower::Keyboard,
|
||||
LaptopOldAuraPower::Lightbar,
|
||||
]))
|
||||
LaptopAuraPower::new(LaptopAuraType::Old, support_data)
|
||||
};
|
||||
let mut config = AuraConfig {
|
||||
config_name: format!("aura_{prod_id:?}.ron"),
|
||||
|
||||
@@ -11,7 +11,7 @@ use rog_platform::hid_raw::HidRaw;
|
||||
use rog_platform::keyboard_led::KeyboardLed;
|
||||
use zbus::zvariant::OwnedObjectPath;
|
||||
|
||||
use super::config::{AuraConfig, AuraPowerConfig};
|
||||
use super::config::AuraConfig;
|
||||
use crate::ctrl_aura::manager::dbus_path_for_dev;
|
||||
use crate::error::RogError;
|
||||
|
||||
@@ -191,12 +191,14 @@ impl CtrlKbdLed {
|
||||
/// leds/side leds LED active
|
||||
pub(super) fn set_power_states(&mut self) -> Result<(), RogError> {
|
||||
if let LEDNode::KbdLed(platform) = &mut self.led_node {
|
||||
if let Some(pwr) = AuraPowerConfig::to_tuf_bool_array(&self.config.enabled) {
|
||||
let buf = [1, pwr[1] as u8, pwr[2] as u8, pwr[3] as u8, pwr[4] as u8];
|
||||
platform.set_kbd_rgb_state(&buf)?;
|
||||
}
|
||||
// TODO: tuf bool array
|
||||
// if let Some(pwr) =
|
||||
// AuraPowerConfig::to_tuf_bool_array(&self.config.enabled) {
|
||||
// let buf = [1, pwr[1] as u8, pwr[2] as u8, pwr[3] as u8,
|
||||
// pwr[4] as u8]; platform.set_kbd_rgb_state(&buf)?;
|
||||
// }
|
||||
} else if let LEDNode::Rog(_, hid_raw) = &self.led_node {
|
||||
let bytes = AuraPowerConfig::to_bytes(&self.config.enabled);
|
||||
let bytes = self.config.enabled.to_bytes(self.led_prod.into());
|
||||
let message = [0x5d, 0xbd, 0x01, bytes[0], bytes[1], bytes[2], bytes[3]];
|
||||
|
||||
hid_raw.write_bytes(&message)?;
|
||||
|
||||
@@ -4,8 +4,8 @@ use std::sync::Arc;
|
||||
use config_traits::StdConfig;
|
||||
use log::{debug, error, info, warn};
|
||||
use rog_aura::aura_detection::PowerZones;
|
||||
use rog_aura::keyboard::UsbPackets;
|
||||
use rog_aura::usb::{AuraDevice, AuraPowerDev};
|
||||
use rog_aura::keyboard::{LaptopAuraPower, UsbPackets};
|
||||
use rog_aura::usb::AuraDevice;
|
||||
use rog_aura::{AuraEffect, AuraModeNum, AuraZone, LedBrightness};
|
||||
use zbus::export::futures_util::lock::{Mutex, MutexGuard};
|
||||
use zbus::export::futures_util::StreamExt;
|
||||
@@ -167,9 +167,9 @@ impl CtrlAuraZbus {
|
||||
|
||||
// As property doesn't work for AuraPowerDev (complexity of serialization?)
|
||||
#[zbus(property)]
|
||||
async fn led_power(&self) -> AuraPowerDev {
|
||||
async fn led_power(&self) -> LaptopAuraPower {
|
||||
let ctrl = self.0.lock().await;
|
||||
AuraPowerDev::from(&ctrl.config.enabled)
|
||||
ctrl.config.enabled.clone()
|
||||
}
|
||||
|
||||
/// Set a variety of states, input is array of enum.
|
||||
@@ -177,16 +177,16 @@ impl CtrlAuraZbus {
|
||||
///
|
||||
/// For Modern ROG devices the "enabled" flag is ignored.
|
||||
#[zbus(property)]
|
||||
async fn set_led_power(&mut self, options: AuraPowerDev) -> Result<(), ZbErr> {
|
||||
async fn set_led_power(&mut self, options: LaptopAuraPower) -> Result<(), ZbErr> {
|
||||
let mut ctrl = self.0.lock().await;
|
||||
// TODO: set the older devices
|
||||
// for p in options.tuf {
|
||||
// ctrl.config.enabled.set_tuf(p, enabled);
|
||||
// }
|
||||
// for p in options.old_rog {
|
||||
// ctrl.config.enabled.set_0x1866(p, enabled);
|
||||
// }
|
||||
ctrl.config.enabled.set_0x19b6(options.rog);
|
||||
for opt in options.states {
|
||||
let zone = opt.zone;
|
||||
for config in ctrl.config.enabled.states.iter_mut() {
|
||||
if config.zone == zone {
|
||||
*config = opt;
|
||||
}
|
||||
}
|
||||
}
|
||||
ctrl.config.write();
|
||||
Ok(ctrl.set_power_states().map_err(|e| {
|
||||
warn!("{}", e);
|
||||
|
||||
@@ -31,7 +31,7 @@ pub struct LedSupportFile(Vec<LaptopLedData>);
|
||||
derive(Type, Value, OwnedValue),
|
||||
zvariant(signature = "u")
|
||||
)]
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Default, Copy, Clone)]
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Default, Copy, Clone)]
|
||||
pub enum PowerZones {
|
||||
/// The logo on some laptop lids
|
||||
#[default]
|
||||
@@ -44,6 +44,8 @@ pub enum PowerZones {
|
||||
Lid = 3,
|
||||
/// The led strip on the rear of some laptops
|
||||
RearGlow = 4,
|
||||
/// On pre-2021 laptops there is either 1 or 2 zones used
|
||||
KeyboardAndLightbar = 5,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize, Serialize)]
|
||||
|
||||
@@ -8,15 +8,64 @@ use typeshare::typeshare;
|
||||
#[cfg(feature = "dbus")]
|
||||
use zbus::zvariant::{OwnedValue, Type, Value};
|
||||
|
||||
use crate::aura_detection::PowerZones;
|
||||
use crate::aura_detection::{LaptopLedData, PowerZones};
|
||||
use crate::usb::AuraDevice;
|
||||
|
||||
// Possible API:
|
||||
// # Common parts:
|
||||
// - boot
|
||||
// - awake
|
||||
// - sleep
|
||||
// ## New only
|
||||
// - shutdown
|
||||
//
|
||||
// ## Only only
|
||||
// - keyboard
|
||||
// - lightbar
|
||||
// ## TUF only
|
||||
// - keyboard
|
||||
//
|
||||
// # New has parts:
|
||||
// - keyboard
|
||||
// - lightbar
|
||||
// - logo
|
||||
// - lid
|
||||
// - rear_glow
|
||||
|
||||
#[typeshare]
|
||||
#[cfg_attr(feature = "dbus", derive(Type, Value, OwnedValue))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum LaptopAuraType {
|
||||
New = 0,
|
||||
Old = 1,
|
||||
Tuf = 2,
|
||||
}
|
||||
|
||||
impl From<AuraDevice> for LaptopAuraType {
|
||||
fn from(value: AuraDevice) -> Self {
|
||||
if value.is_old_style() {
|
||||
Self::Old
|
||||
} else if value.is_tuf_style() {
|
||||
Self::Tuf
|
||||
} else {
|
||||
Self::New
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Meaning of this struct depends on the laptop generation.
|
||||
/// - 2021+, the struct is a single zone with 4 states
|
||||
/// - pre-2021, the struct is 1 or 2 zones and 3 states
|
||||
/// - Tuf, the struct is 1 zone and 3 states
|
||||
#[typeshare]
|
||||
#[cfg_attr(feature = "dbus", derive(Type, Value, OwnedValue))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct AuraPowerState {
|
||||
pub zone: PowerZones,
|
||||
pub boot: bool,
|
||||
pub awake: bool,
|
||||
pub sleep: bool,
|
||||
/// Ignored for pre-2021 and Tuf
|
||||
pub shutdown: bool,
|
||||
}
|
||||
|
||||
@@ -24,17 +73,77 @@ impl Default for AuraPowerState {
|
||||
/// Defaults all to off
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
boot: false,
|
||||
awake: false,
|
||||
sleep: false,
|
||||
shutdown: false,
|
||||
zone: PowerZones::Keyboard,
|
||||
boot: true,
|
||||
awake: true,
|
||||
sleep: true,
|
||||
shutdown: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl AuraPowerState {
|
||||
pub fn to_byte(&self, zone: PowerZones) -> u32 {
|
||||
match zone {
|
||||
fn default_for(zone: PowerZones) -> Self {
|
||||
Self {
|
||||
zone,
|
||||
boot: true,
|
||||
awake: true,
|
||||
sleep: true,
|
||||
shutdown: true,
|
||||
}
|
||||
}
|
||||
|
||||
fn tuf_to_bytes(&self) -> Vec<u8> {
|
||||
todo!("0s and 1s for bool array")
|
||||
}
|
||||
|
||||
/// # Bits for older 0x1866 keyboard model
|
||||
///
|
||||
/// Keybord and Lightbar require Awake, Boot and Sleep apply to both
|
||||
/// Keybord and Lightbar regardless of if either are enabled (or Awake is
|
||||
/// enabled)
|
||||
///
|
||||
/// | Byte 1 | Byte 2 | Byte 3 | function | hex |
|
||||
/// |------------|------------|------------|----------|----------|
|
||||
/// | 0000, 0000 | 0000, 0000 | 0000, 0010 | Awake | 00,00,02 |
|
||||
/// | 0000, 1000 | 0000, 0000 | 0000, 0000 | Keyboard | 08,00,00 |
|
||||
/// | 0000, 0100 | 0000, 0101 | 0000, 0000 | Lightbar | 04,05,00 |
|
||||
/// | 1100, 0011 | 0001, 0010 | 0000, 1001 | Boot/Sht | c3,12,09 |
|
||||
/// | 0011, 0000 | 0000, 1000 | 0000, 0100 | Sleep | 30,08,04 |
|
||||
/// | 1111, 1111 | 0001, 1111 | 0000, 1111 | all on | |
|
||||
fn old_to_bytes(&self) -> Vec<u8> {
|
||||
let mut a: u32 = 0;
|
||||
if self.awake {
|
||||
a |= OldAuraPower::Awake as u32;
|
||||
}
|
||||
if self.boot {
|
||||
a |= OldAuraPower::Boot as u32;
|
||||
}
|
||||
if self.sleep {
|
||||
a |= OldAuraPower::Sleep as u32;
|
||||
}
|
||||
if matches!(
|
||||
self.zone,
|
||||
PowerZones::Keyboard | PowerZones::KeyboardAndLightbar
|
||||
) {
|
||||
a |= OldAuraPower::Keyboard as u32;
|
||||
}
|
||||
if matches!(
|
||||
self.zone,
|
||||
PowerZones::Lightbar | PowerZones::KeyboardAndLightbar
|
||||
) {
|
||||
a |= OldAuraPower::Lightbar as u32;
|
||||
}
|
||||
vec![
|
||||
((a & 0xff0000) >> 16) as u8,
|
||||
((a & 0xff00) >> 8) as u8,
|
||||
(a & 0xff) as u8,
|
||||
0x00,
|
||||
]
|
||||
}
|
||||
|
||||
fn new_to_byte(&self) -> u32 {
|
||||
match self.zone {
|
||||
PowerZones::Logo => {
|
||||
self.boot as u32
|
||||
| (self.awake as u32) << 2
|
||||
@@ -65,126 +174,100 @@ impl AuraPowerState {
|
||||
| (self.sleep as u32) << (23 + 3)
|
||||
| (self.shutdown as u32) << (23 + 4)
|
||||
}
|
||||
PowerZones::KeyboardAndLightbar => 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Track and control the Aura keyboard power state
|
||||
///
|
||||
/// # Bits for newer 0x18c6, 0x19B6, 0x1a30, keyboard models
|
||||
///
|
||||
/// | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Label |
|
||||
/// |--------|---------|---------|---------|----------|
|
||||
/// |00000001| 00000000| 00000000| 00000000|boot_logo_|
|
||||
/// |00000010| 00000000| 00000000| 00000000|boot_keyb_|
|
||||
/// |00000100| 00000000| 00000000| 00000000|awake_logo|
|
||||
/// |00001000| 00000000| 00000000| 00000000|awake_keyb|
|
||||
/// |00010000| 00000000| 00000000| 00000000|sleep_logo|
|
||||
/// |00100000| 00000000| 00000000| 00000000|sleep_keyb|
|
||||
/// |01000000| 00000000| 00000000| 00000000|shut_logo_|
|
||||
/// |10000000| 00000000| 00000000| 00000000|shut_keyb_|
|
||||
/// |00000000| 00000010| 00000000| 00000000|boot_bar__|
|
||||
/// |00000000| 00000100| 00000000| 00000000|awake_bar_|
|
||||
/// |00000000| 00001000| 00000000| 00000000|sleep_bar_|
|
||||
/// |00000000| 00010000| 00000000| 00000000|shut_bar__|
|
||||
/// |00000000| 00000000| 00000001| 00000000|boot_lid__|
|
||||
/// |00000000| 00000000| 00000010| 00000000|awkae_lid_|
|
||||
/// |00000000| 00000000| 00000100| 00000000|sleep_lid_|
|
||||
/// |00000000| 00000000| 00001000| 00000000|shut_lid__|
|
||||
/// |00000000| 00000000| 00000000| 00000001|boot_rear_|
|
||||
/// |00000000| 00000000| 00000000| 00000010|awake_rear|
|
||||
/// |00000000| 00000000| 00000000| 00000100|sleep_rear|
|
||||
/// |00000000| 00000000| 00000000| 00001000|shut_rear_|
|
||||
#[typeshare]
|
||||
#[cfg_attr(feature = "dbus", derive(Type, Value, OwnedValue))]
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct LaptopAuraPower {
|
||||
pub keyboard: AuraPowerState,
|
||||
pub logo: AuraPowerState,
|
||||
pub lightbar: AuraPowerState,
|
||||
pub lid: AuraPowerState,
|
||||
pub rear_glow: AuraPowerState,
|
||||
pub states: Vec<AuraPowerState>,
|
||||
}
|
||||
|
||||
impl LaptopAuraPower {
|
||||
pub fn new_all_on() -> Self {
|
||||
Self {
|
||||
keyboard: AuraPowerState {
|
||||
boot: true,
|
||||
awake: true,
|
||||
sleep: true,
|
||||
shutdown: true,
|
||||
},
|
||||
logo: AuraPowerState {
|
||||
boot: true,
|
||||
awake: true,
|
||||
sleep: true,
|
||||
shutdown: true,
|
||||
},
|
||||
lightbar: AuraPowerState {
|
||||
boot: true,
|
||||
awake: true,
|
||||
sleep: true,
|
||||
shutdown: true,
|
||||
},
|
||||
lid: AuraPowerState {
|
||||
boot: true,
|
||||
awake: true,
|
||||
sleep: true,
|
||||
shutdown: true,
|
||||
},
|
||||
rear_glow: AuraPowerState {
|
||||
boot: true,
|
||||
awake: true,
|
||||
sleep: true,
|
||||
shutdown: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_bytes(&self) -> [u8; 4] {
|
||||
/// # Bits for newer 0x18c6, 0x19B6, 0x1a30, keyboard models
|
||||
///
|
||||
/// | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Label |
|
||||
/// |--------|---------|---------|---------|----------|
|
||||
/// |00000001| 00000000| 00000000| 00000000|boot_logo_|
|
||||
/// |00000010| 00000000| 00000000| 00000000|boot_keyb_|
|
||||
/// |00000100| 00000000| 00000000| 00000000|awake_logo|
|
||||
/// |00001000| 00000000| 00000000| 00000000|awake_keyb|
|
||||
/// |00010000| 00000000| 00000000| 00000000|sleep_logo|
|
||||
/// |00100000| 00000000| 00000000| 00000000|sleep_keyb|
|
||||
/// |01000000| 00000000| 00000000| 00000000|shut_logo_|
|
||||
/// |10000000| 00000000| 00000000| 00000000|shut_keyb_|
|
||||
/// |00000000| 00000010| 00000000| 00000000|boot_bar__|
|
||||
/// |00000000| 00000100| 00000000| 00000000|awake_bar_|
|
||||
/// |00000000| 00001000| 00000000| 00000000|sleep_bar_|
|
||||
/// |00000000| 00010000| 00000000| 00000000|shut_bar__|
|
||||
/// |00000000| 00000000| 00000001| 00000000|boot_lid__|
|
||||
/// |00000000| 00000000| 00000010| 00000000|awkae_lid_|
|
||||
/// |00000000| 00000000| 00000100| 00000000|sleep_lid_|
|
||||
/// |00000000| 00000000| 00001000| 00000000|shut_lid__|
|
||||
/// |00000000| 00000000| 00000000| 00000001|boot_rear_|
|
||||
/// |00000000| 00000000| 00000000| 00000010|awake_rear|
|
||||
/// |00000000| 00000000| 00000000| 00000100|sleep_rear|
|
||||
/// |00000000| 00000000| 00000000| 00001000|shut_rear_|
|
||||
fn new_to_bytes(&self) -> Vec<u8> {
|
||||
let mut a: u32 = 0;
|
||||
a |= self.keyboard.to_byte(PowerZones::Keyboard);
|
||||
a |= self.logo.to_byte(PowerZones::Logo);
|
||||
a |= self.lid.to_byte(PowerZones::Lid);
|
||||
a |= self.lightbar.to_byte(PowerZones::Lightbar);
|
||||
a |= self.rear_glow.to_byte(PowerZones::RearGlow);
|
||||
[
|
||||
for state in self.states.iter() {
|
||||
a |= state.new_to_byte();
|
||||
}
|
||||
vec![
|
||||
(a & 0xff) as u8,
|
||||
((a & 0xff00) >> 8) as u8,
|
||||
((a & 0xff0000) >> 16) as u8,
|
||||
((a & 0xff000000) >> 24) as u8,
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
#[typeshare]
|
||||
#[cfg_attr(
|
||||
feature = "dbus",
|
||||
derive(Type, Value, OwnedValue),
|
||||
zvariant(signature = "u")
|
||||
)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[repr(u32)]
|
||||
pub enum LaptopTufAuraPower {
|
||||
Boot = 0,
|
||||
Awake = 1,
|
||||
Sleep = 2,
|
||||
Keyboard = 3,
|
||||
}
|
||||
// TODO: use support data to setup correct zones
|
||||
pub fn new(aura_type: LaptopAuraType, _support_data: &LaptopLedData) -> Self {
|
||||
match aura_type {
|
||||
LaptopAuraType::New => {
|
||||
let mut states = Vec::new();
|
||||
for zone in [
|
||||
PowerZones::Keyboard,
|
||||
PowerZones::Lid,
|
||||
PowerZones::Lightbar,
|
||||
PowerZones::Logo,
|
||||
PowerZones::RearGlow,
|
||||
] {
|
||||
states.push(AuraPowerState::default_for(zone))
|
||||
}
|
||||
Self { states }
|
||||
}
|
||||
LaptopAuraType::Old => Self {
|
||||
states: vec![AuraPowerState::default_for(PowerZones::KeyboardAndLightbar)],
|
||||
},
|
||||
LaptopAuraType::Tuf => Self {
|
||||
states: vec![AuraPowerState::default_for(PowerZones::Keyboard)],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
impl LaptopTufAuraPower {
|
||||
pub const fn dev_id() -> &'static str {
|
||||
"tuf"
|
||||
pub fn to_bytes(&self, aura_type: LaptopAuraType) -> Vec<u8> {
|
||||
match aura_type {
|
||||
LaptopAuraType::New => self.new_to_bytes(),
|
||||
LaptopAuraType::Old => self
|
||||
.states
|
||||
.first()
|
||||
.cloned()
|
||||
.unwrap_or_default()
|
||||
.old_to_bytes(),
|
||||
LaptopAuraType::Tuf => self
|
||||
.states
|
||||
.first()
|
||||
.cloned()
|
||||
.unwrap_or_default()
|
||||
.tuf_to_bytes(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// # Bits for older 0x1866 keyboard model
|
||||
///
|
||||
/// Keybord and Lightbar require Awake, Boot and Sleep apply to both
|
||||
/// Keybord and Lightbar regardless of if either are enabled (or Awake is
|
||||
/// enabled)
|
||||
///
|
||||
/// | Byte 1 | Byte 2 | Byte 3 | function | hex |
|
||||
/// |------------|------------|------------|----------|----------|
|
||||
/// | 0000, 0000 | 0000, 0000 | 0000, 0010 | Awake | 00,00,02 |
|
||||
@@ -193,98 +276,97 @@ impl LaptopTufAuraPower {
|
||||
/// | 1100, 0011 | 0001, 0010 | 0000, 1001 | Boot/Sht | c3,12,09 |
|
||||
/// | 0011, 0000 | 0000, 1000 | 0000, 0100 | Sleep | 30,08,04 |
|
||||
/// | 1111, 1111 | 0001, 1111 | 0000, 1111 | all on | |
|
||||
#[typeshare]
|
||||
#[cfg_attr(
|
||||
feature = "dbus",
|
||||
derive(Type, Value, OwnedValue),
|
||||
zvariant(signature = "u")
|
||||
)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[repr(u32)]
|
||||
pub enum LaptopOldAuraPower {
|
||||
enum OldAuraPower {
|
||||
Awake = 0x000002,
|
||||
Keyboard = 0x080000,
|
||||
Lightbar = 0x040500,
|
||||
Boot = 0xc31209,
|
||||
Sleep = 0x300804,
|
||||
Keyboard = 0x080000,
|
||||
Lightbar = 0x040500,
|
||||
}
|
||||
|
||||
impl From<LaptopOldAuraPower> for u32 {
|
||||
fn from(a: LaptopOldAuraPower) -> Self {
|
||||
a as u32
|
||||
}
|
||||
}
|
||||
|
||||
impl LaptopOldAuraPower {
|
||||
pub fn to_bytes(control: &[Self]) -> [u8; 4] {
|
||||
let mut a: u32 = 0;
|
||||
for n in control {
|
||||
a |= *n as u32;
|
||||
}
|
||||
[
|
||||
((a & 0xff0000) >> 16) as u8,
|
||||
((a & 0xff00) >> 8) as u8,
|
||||
(a & 0xff) as u8,
|
||||
0x00,
|
||||
]
|
||||
}
|
||||
|
||||
pub const fn dev_id() -> &'static str {
|
||||
"0x1866"
|
||||
}
|
||||
}
|
||||
|
||||
impl BitOr<LaptopOldAuraPower> for LaptopOldAuraPower {
|
||||
impl BitOr<OldAuraPower> for OldAuraPower {
|
||||
type Output = u32;
|
||||
|
||||
fn bitor(self, rhs: LaptopOldAuraPower) -> Self::Output {
|
||||
fn bitor(self, rhs: OldAuraPower) -> Self::Output {
|
||||
self as u32 | rhs as u32
|
||||
}
|
||||
}
|
||||
|
||||
impl BitAnd<LaptopOldAuraPower> for LaptopOldAuraPower {
|
||||
impl BitAnd<OldAuraPower> for OldAuraPower {
|
||||
type Output = u32;
|
||||
|
||||
fn bitand(self, rhs: LaptopOldAuraPower) -> Self::Output {
|
||||
fn bitand(self, rhs: OldAuraPower) -> Self::Output {
|
||||
self as u32 & rhs as u32
|
||||
}
|
||||
}
|
||||
|
||||
impl From<OldAuraPower> for u32 {
|
||||
fn from(a: OldAuraPower) -> Self {
|
||||
a as u32
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use crate::keyboard::{AuraPowerState, LaptopAuraPower, LaptopOldAuraPower};
|
||||
use crate::aura_detection::{LaptopLedData, PowerZones};
|
||||
use crate::keyboard::{AuraPowerState, LaptopAuraPower, LaptopAuraType};
|
||||
|
||||
#[test]
|
||||
fn check_0x1866_control_bytes() {
|
||||
let bytes = [LaptopOldAuraPower::Keyboard, LaptopOldAuraPower::Awake];
|
||||
let bytes = LaptopOldAuraPower::to_bytes(&bytes);
|
||||
let state = AuraPowerState {
|
||||
zone: PowerZones::Keyboard,
|
||||
awake: true,
|
||||
boot: false,
|
||||
sleep: false,
|
||||
shutdown: false,
|
||||
};
|
||||
let bytes = state.old_to_bytes();
|
||||
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
|
||||
assert_eq!(bytes, [0x08, 0x00, 0x02, 0x00]);
|
||||
|
||||
let bytes = [LaptopOldAuraPower::Lightbar, LaptopOldAuraPower::Awake];
|
||||
let bytes = LaptopOldAuraPower::to_bytes(&bytes);
|
||||
let state = AuraPowerState {
|
||||
zone: PowerZones::Lightbar,
|
||||
awake: true,
|
||||
boot: false,
|
||||
sleep: false,
|
||||
shutdown: false,
|
||||
};
|
||||
let bytes = state.old_to_bytes();
|
||||
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
|
||||
assert_eq!(bytes, [0x04, 0x05, 0x02, 0x00]);
|
||||
|
||||
let bytes = [LaptopOldAuraPower::Sleep];
|
||||
let bytes = LaptopOldAuraPower::to_bytes(&bytes);
|
||||
let bytes = AuraPowerState {
|
||||
zone: PowerZones::Keyboard,
|
||||
awake: false,
|
||||
boot: false,
|
||||
sleep: true,
|
||||
shutdown: false,
|
||||
};
|
||||
let bytes = bytes.old_to_bytes();
|
||||
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
|
||||
assert_eq!(bytes, [0x30, 0x08, 0x04, 0x00]);
|
||||
|
||||
let bytes = [LaptopOldAuraPower::Boot];
|
||||
let bytes = LaptopOldAuraPower::to_bytes(&bytes);
|
||||
let bytes = AuraPowerState {
|
||||
zone: PowerZones::Keyboard,
|
||||
awake: false,
|
||||
boot: true,
|
||||
sleep: false,
|
||||
shutdown: false,
|
||||
};
|
||||
let bytes = bytes.old_to_bytes();
|
||||
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
|
||||
assert_eq!(bytes, [0xc3, 0x12, 0x09, 0x00]);
|
||||
|
||||
let bytes = [
|
||||
LaptopOldAuraPower::Keyboard,
|
||||
LaptopOldAuraPower::Lightbar,
|
||||
LaptopOldAuraPower::Awake,
|
||||
LaptopOldAuraPower::Sleep,
|
||||
LaptopOldAuraPower::Boot,
|
||||
];
|
||||
let power = AuraPowerState {
|
||||
zone: PowerZones::KeyboardAndLightbar,
|
||||
awake: true,
|
||||
boot: true,
|
||||
sleep: true,
|
||||
shutdown: false,
|
||||
};
|
||||
|
||||
let bytes = LaptopOldAuraPower::to_bytes(&bytes);
|
||||
let bytes = power.old_to_bytes();
|
||||
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
|
||||
assert_eq!(bytes, [0xff, 0x1f, 0x000f, 0x00]);
|
||||
}
|
||||
@@ -292,7 +374,7 @@ mod test {
|
||||
#[test]
|
||||
fn check_0x19b6_control_bytes_binary_rep() {
|
||||
fn to_binary_string(power: &LaptopAuraPower) -> String {
|
||||
let bytes = power.to_bytes();
|
||||
let bytes = power.to_bytes(LaptopAuraType::New);
|
||||
format!(
|
||||
"{:08b}, {:08b}, {:08b}, {:08b}",
|
||||
bytes[0], bytes[1], bytes[2], bytes[3]
|
||||
@@ -300,144 +382,144 @@ mod test {
|
||||
}
|
||||
|
||||
let boot_logo_ = to_binary_string(&LaptopAuraPower {
|
||||
logo: AuraPowerState {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Logo,
|
||||
boot: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let boot_keyb_ = to_binary_string(&LaptopAuraPower {
|
||||
keyboard: AuraPowerState {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Keyboard,
|
||||
boot: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let sleep_logo = to_binary_string(&LaptopAuraPower {
|
||||
logo: AuraPowerState {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Logo,
|
||||
sleep: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let sleep_keyb = to_binary_string(&LaptopAuraPower {
|
||||
keyboard: AuraPowerState {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Keyboard,
|
||||
sleep: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let awake_logo = to_binary_string(&LaptopAuraPower {
|
||||
logo: AuraPowerState {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Logo,
|
||||
awake: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let awake_keyb = to_binary_string(&LaptopAuraPower {
|
||||
keyboard: AuraPowerState {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Keyboard,
|
||||
awake: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let shut_logo_ = to_binary_string(&LaptopAuraPower {
|
||||
logo: AuraPowerState {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Logo,
|
||||
shutdown: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let shut_keyb_ = to_binary_string(&LaptopAuraPower {
|
||||
keyboard: AuraPowerState {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Keyboard,
|
||||
shutdown: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let boot_bar__ = to_binary_string(&LaptopAuraPower {
|
||||
lightbar: AuraPowerState {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Lightbar,
|
||||
boot: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let awake_bar_ = to_binary_string(&LaptopAuraPower {
|
||||
lightbar: AuraPowerState {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Lightbar,
|
||||
awake: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let sleep_bar_ = to_binary_string(&LaptopAuraPower {
|
||||
lightbar: AuraPowerState {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Lightbar,
|
||||
sleep: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let shut_bar__ = to_binary_string(&LaptopAuraPower {
|
||||
lightbar: AuraPowerState {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Lightbar,
|
||||
shutdown: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let boot_lid__ = to_binary_string(&LaptopAuraPower {
|
||||
lid: AuraPowerState {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Lid,
|
||||
boot: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let awake_lid_ = to_binary_string(&LaptopAuraPower {
|
||||
lid: AuraPowerState {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Lid,
|
||||
awake: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let sleep_lid_ = to_binary_string(&LaptopAuraPower {
|
||||
lid: AuraPowerState {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Lid,
|
||||
sleep: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let shut_lid__ = to_binary_string(&LaptopAuraPower {
|
||||
lid: AuraPowerState {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Lid,
|
||||
shutdown: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let boot_rear_ = to_binary_string(&LaptopAuraPower {
|
||||
rear_glow: AuraPowerState {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::RearGlow,
|
||||
boot: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let awake_rear = to_binary_string(&LaptopAuraPower {
|
||||
rear_glow: AuraPowerState {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::RearGlow,
|
||||
awake: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let sleep_rear = to_binary_string(&LaptopAuraPower {
|
||||
rear_glow: AuraPowerState {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::RearGlow,
|
||||
sleep: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let shut_rear_ = to_binary_string(&LaptopAuraPower {
|
||||
rear_glow: AuraPowerState {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::RearGlow,
|
||||
shutdown: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
|
||||
assert_eq!(boot_logo_, "00000001, 00000000, 00000000, 00000000");
|
||||
@@ -465,7 +547,7 @@ mod test {
|
||||
assert_eq!(shut_rear_, "00000000, 00000000, 00000000, 00001000");
|
||||
|
||||
// All on
|
||||
let byte1 = LaptopAuraPower::new_all_on();
|
||||
let byte1 = LaptopAuraPower::new(LaptopAuraType::New, &LaptopLedData::default());
|
||||
let out = to_binary_string(&byte1);
|
||||
assert_eq!(out, "11111111, 00011110, 00001111, 00001111");
|
||||
}
|
||||
|
||||
@@ -5,8 +5,6 @@ use typeshare::typeshare;
|
||||
#[cfg(feature = "dbus")]
|
||||
use zbus::zvariant::{OwnedValue, Type, Value};
|
||||
|
||||
use crate::keyboard::{LaptopAuraPower, LaptopOldAuraPower, LaptopTufAuraPower};
|
||||
|
||||
// Only these two packets must be 17 bytes
|
||||
pub const LED_APPLY: [u8; 17] = [0x5d, 0xb4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||
pub const LED_SET: [u8; 17] = [0x5d, 0xb5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||
@@ -106,18 +104,3 @@ impl Debug for AuraDevice {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// This struct is intended as a helper to pass args to generic dbus interface
|
||||
#[typeshare]
|
||||
#[cfg_attr(feature = "dbus", derive(Type, Value, OwnedValue))]
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct AuraPowerDev {
|
||||
/// TUF laptops use a similar style of control to the older ROG devices but
|
||||
/// through WMI
|
||||
pub tuf: Vec<LaptopTufAuraPower>,
|
||||
/// Pre-0x19b6 devices use a different smaller scheme to the newer ROG
|
||||
/// devices
|
||||
pub old_rog: Vec<LaptopOldAuraPower>,
|
||||
/// ASUS standardised control scheme from 2020 onwards
|
||||
pub rog: LaptopAuraPower,
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ impl From<crate::slint_generatedMainWindow::AuraEffect> for rog_aura::AuraEffect
|
||||
}
|
||||
}
|
||||
|
||||
use rog_aura::aura_detection::PowerZones;
|
||||
use rog_aura::keyboard::{AuraPowerState, LaptopOldAuraPower, LaptopTufAuraPower};
|
||||
use rog_aura::usb::AuraPowerDev;
|
||||
use slint::{Model, ModelRc, RgbaColor};
|
||||
@@ -102,11 +103,12 @@ use crate::slint_generatedMainWindow::PowerZones as SlintPowerZones;
|
||||
impl From<rog_aura::aura_detection::PowerZones> for SlintPowerZones {
|
||||
fn from(value: rog_aura::aura_detection::PowerZones) -> Self {
|
||||
match value {
|
||||
rog_aura::aura_detection::PowerZones::Logo => SlintPowerZones::Logo,
|
||||
rog_aura::aura_detection::PowerZones::Keyboard => SlintPowerZones::Keyboard,
|
||||
rog_aura::aura_detection::PowerZones::Lightbar => SlintPowerZones::Lightbar,
|
||||
rog_aura::aura_detection::PowerZones::Lid => SlintPowerZones::Lid,
|
||||
rog_aura::aura_detection::PowerZones::RearGlow => SlintPowerZones::RearGlow,
|
||||
PowerZones::Logo => SlintPowerZones::Logo,
|
||||
PowerZones::Keyboard => SlintPowerZones::Keyboard,
|
||||
PowerZones::Lightbar => SlintPowerZones::Lightbar,
|
||||
PowerZones::Lid => SlintPowerZones::Lid,
|
||||
PowerZones::RearGlow => SlintPowerZones::RearGlow,
|
||||
PowerZones::KeyboardAndLightbar => todo!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use rog_aura::usb::AuraPowerDev;
|
||||
use rog_aura::keyboard::LaptopAuraPower;
|
||||
use rog_dbus::zbus_aura::AuraProxy;
|
||||
use slint::{ComponentHandle, Model, RgbaColor, SharedString};
|
||||
|
||||
@@ -166,7 +166,7 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
|
||||
.on_set_led_power(move |power| {
|
||||
let handle_copy = handle_copy.clone();
|
||||
let proxy_copy = aura.clone();
|
||||
let power: AuraPowerDev = power.into();
|
||||
let power: LaptopAuraPower = power.into();
|
||||
tokio::spawn(async move {
|
||||
show_toast(
|
||||
"Anime builtin animations changed".into(),
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2024-04-05 08:20+0000\n"
|
||||
"POT-Creation-Date: 2024-04-08 09:19+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
||||
@@ -77,12 +77,12 @@ export component ColourSlider inherits VerticalLayout {
|
||||
callback external_colour_change();
|
||||
|
||||
external_colour_change => {
|
||||
if (root.final_colour.hue() < 0) {
|
||||
c1.value = (root.base_colours.length - 1) * ((root.final_colour.hue() + 360) / 360);
|
||||
if (root.final_colour.hue < 0) {
|
||||
c1.value = (root.base_colours.length - 1) * ((root.final_colour.hue + 360) / 360);
|
||||
} else {
|
||||
c1.value = (root.base_colours.length - 1) * (root.final_colour.hue() / 360);
|
||||
c1.value = (root.base_colours.length - 1) * (root.final_colour.hue / 360);
|
||||
}
|
||||
c2.value = root.base_shade.length - (root.base_shade.length * root.final_colour.brightness());
|
||||
c2.value = root.base_shade.length - (root.base_shade.length * root.final_colour.value);
|
||||
root.set_base_colour();
|
||||
}
|
||||
Rectangle {
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use rog_aura::aura_detection::PowerZones;
|
||||
use rog_aura::keyboard::UsbPackets;
|
||||
use rog_aura::usb::{AuraDevice, AuraPowerDev};
|
||||
use rog_aura::keyboard::{LaptopAuraPower, UsbPackets};
|
||||
use rog_aura::usb::AuraDevice;
|
||||
use rog_aura::{AuraEffect, AuraModeNum, AuraZone, LedBrightness};
|
||||
use zbus::blocking::Connection;
|
||||
use zbus::{proxy, Result};
|
||||
@@ -67,9 +67,9 @@ trait Aura {
|
||||
|
||||
/// LedPower property
|
||||
#[zbus(property)]
|
||||
fn led_power(&self) -> zbus::Result<AuraPowerDev>;
|
||||
fn led_power(&self) -> zbus::Result<LaptopAuraPower>;
|
||||
#[zbus(property)]
|
||||
fn set_led_power(&self, value: AuraPowerDev) -> zbus::Result<()>;
|
||||
fn set_led_power(&self, value: LaptopAuraPower) -> zbus::Result<()>;
|
||||
|
||||
/// SupportedBrightness property
|
||||
#[zbus(property)]
|
||||
|
||||
Reference in New Issue
Block a user