mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Add more support detection for bios/system level components
This commit is contained in:
@@ -5,9 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased ]
|
## [Unreleased ]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Add panel overdrive support (autodetects if supported)
|
||||||
|
- Add detection of dgpu_disable and egpu_enable for diagnostic
|
||||||
### Changed
|
### Changed
|
||||||
- Fixed save and restore of multizone LED settings
|
- Fixed save and restore of multizone LED settings
|
||||||
- Add panel overdrive support (autodetects if supported)
|
|
||||||
|
|
||||||
## [4.2.0] - 2022-07-16
|
## [4.2.0] - 2022-07-16
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
8
Cargo.lock
generated
8
Cargo.lock
generated
@@ -33,7 +33,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asusctl"
|
name = "asusctl"
|
||||||
version = "4.0.7"
|
version = "4.2.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"daemon",
|
"daemon",
|
||||||
"gif",
|
"gif",
|
||||||
@@ -278,7 +278,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "daemon"
|
name = "daemon"
|
||||||
version = "4.2.0"
|
version = "4.2.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
@@ -1034,7 +1034,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_aura"
|
name = "rog_aura"
|
||||||
version = "1.1.1"
|
version = "1.1.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
@@ -1067,7 +1067,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_supported"
|
name = "rog_supported"
|
||||||
version = "4.0.0"
|
version = "4.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rog_aura",
|
"rog_aura",
|
||||||
"serde",
|
"serde",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "asusctl"
|
name = "asusctl"
|
||||||
version = "4.0.7"
|
version = "4.2.1"
|
||||||
authors = ["Luke D Jones <luke@ljones.dev>"]
|
authors = ["Luke D Jones <luke@ljones.dev>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
|||||||
@@ -709,8 +709,8 @@ fn handle_bios_option(
|
|||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
for line in usage.iter().filter(|line| {
|
for line in usage.iter().filter(|line| {
|
||||||
line.contains("sound") && supported.post_sound_toggle
|
line.contains("sound") && supported.post_sound
|
||||||
|| line.contains("GPU") && supported.dedicated_gfx_toggle
|
|| line.contains("GPU") && supported.dedicated_gfx
|
||||||
|| line.contains("panel") && supported.panel_overdrive
|
|| line.contains("panel") && supported.panel_overdrive
|
||||||
}) {
|
}) {
|
||||||
println!("{}", line);
|
println!("{}", line);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "daemon"
|
name = "daemon"
|
||||||
version = "4.2.0"
|
version = "4.2.1"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = ["Luke <luke@ljones.dev>"]
|
authors = ["Luke <luke@ljones.dev>"]
|
||||||
|
|||||||
@@ -490,7 +490,7 @@ mod tests {
|
|||||||
.set_effect(effect.clone())
|
.set_effect(effect.clone())
|
||||||
.unwrap_err()
|
.unwrap_err()
|
||||||
.to_string(),
|
.to_string(),
|
||||||
"Aura efect not supported"
|
"Aura effect not supported"
|
||||||
);
|
);
|
||||||
|
|
||||||
effect.mode = AuraModeNum::Static;
|
effect.mode = AuraModeNum::Static;
|
||||||
@@ -500,7 +500,7 @@ mod tests {
|
|||||||
.set_effect(effect.clone())
|
.set_effect(effect.clone())
|
||||||
.unwrap_err()
|
.unwrap_err()
|
||||||
.to_string(),
|
.to_string(),
|
||||||
"Aura efect not supported"
|
"Aura effect not supported"
|
||||||
);
|
);
|
||||||
|
|
||||||
controller.supported_modes.multizone.push(AuraZone::Key2);
|
controller.supported_modes.multizone.push(AuraZone::Key2);
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ impl CtrlKbdLedZbus {
|
|||||||
&mut self,
|
&mut self,
|
||||||
#[zbus(signal_context)] ctxt: SignalContext<'_>,
|
#[zbus(signal_context)] ctxt: SignalContext<'_>,
|
||||||
enabled: Vec<AuraControl>,
|
enabled: Vec<AuraControl>,
|
||||||
) {
|
) -> zbus::fdo::Result<()> {
|
||||||
let mut states = None;
|
let mut states = None;
|
||||||
if let Ok(mut ctrl) = self.0.try_lock() {
|
if let Ok(mut ctrl) = self.0.try_lock() {
|
||||||
for s in enabled {
|
for s in enabled {
|
||||||
@@ -54,9 +54,10 @@ impl CtrlKbdLedZbus {
|
|||||||
}
|
}
|
||||||
ctrl.config.write();
|
ctrl.config.write();
|
||||||
|
|
||||||
ctrl.set_power_states(&ctrl.config)
|
ctrl.set_power_states(&ctrl.config).map_err(|e| {
|
||||||
.map_err(|err| warn!("{}", err))
|
warn!("{}", e);
|
||||||
.ok();
|
e
|
||||||
|
})?;
|
||||||
|
|
||||||
let set: Vec<AuraControl> = ctrl.config.enabled.iter().map(|v| *v).collect();
|
let set: Vec<AuraControl> = ctrl.config.enabled.iter().map(|v| *v).collect();
|
||||||
states = Some(set);
|
states = Some(set);
|
||||||
@@ -67,13 +68,14 @@ impl CtrlKbdLedZbus {
|
|||||||
.await
|
.await
|
||||||
.unwrap_or_else(|err| warn!("{}", err));
|
.unwrap_or_else(|err| warn!("{}", err));
|
||||||
}
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn set_leds_disabled(
|
async fn set_leds_disabled(
|
||||||
&mut self,
|
&mut self,
|
||||||
#[zbus(signal_context)] ctxt: SignalContext<'_>,
|
#[zbus(signal_context)] ctxt: SignalContext<'_>,
|
||||||
disabled: Vec<AuraControl>,
|
disabled: Vec<AuraControl>,
|
||||||
) {
|
) -> zbus::fdo::Result<()> {
|
||||||
let mut states = None;
|
let mut states = None;
|
||||||
if let Ok(mut ctrl) = self.0.try_lock() {
|
if let Ok(mut ctrl) = self.0.try_lock() {
|
||||||
for s in disabled {
|
for s in disabled {
|
||||||
@@ -81,9 +83,10 @@ impl CtrlKbdLedZbus {
|
|||||||
}
|
}
|
||||||
ctrl.config.write();
|
ctrl.config.write();
|
||||||
|
|
||||||
ctrl.set_power_states(&ctrl.config)
|
ctrl.set_power_states(&ctrl.config).map_err(|e| {
|
||||||
.map_err(|err| warn!("{}", err))
|
warn!("{}", e);
|
||||||
.ok();
|
e
|
||||||
|
})?;
|
||||||
|
|
||||||
let set: Vec<AuraControl> = ctrl.config.enabled.iter().map(|v| *v).collect();
|
let set: Vec<AuraControl> = ctrl.config.enabled.iter().map(|v| *v).collect();
|
||||||
states = Some(set);
|
states = Some(set);
|
||||||
@@ -94,24 +97,22 @@ impl CtrlKbdLedZbus {
|
|||||||
.await
|
.await
|
||||||
.unwrap_or_else(|err| warn!("{}", err));
|
.unwrap_or_else(|err| warn!("{}", err));
|
||||||
}
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn set_led_mode(
|
async fn set_led_mode(
|
||||||
&mut self,
|
&mut self,
|
||||||
#[zbus(signal_context)] ctxt: SignalContext<'_>,
|
#[zbus(signal_context)] ctxt: SignalContext<'_>,
|
||||||
effect: AuraEffect,
|
effect: AuraEffect,
|
||||||
) {
|
) -> zbus::fdo::Result<()> {
|
||||||
let mut led = None;
|
let mut led = None;
|
||||||
if let Ok(mut ctrl) = self.0.try_lock() {
|
if let Ok(mut ctrl) = self.0.try_lock() {
|
||||||
match ctrl.set_effect(effect) {
|
ctrl.set_effect(effect).map_err(|e| {
|
||||||
Ok(_) => {
|
warn!("{}", e);
|
||||||
if let Some(mode) = ctrl.config.builtins.get(&ctrl.config.current_mode) {
|
e
|
||||||
led = Some(mode.clone());
|
})?;
|
||||||
}
|
if let Some(mode) = ctrl.config.builtins.get(&ctrl.config.current_mode) {
|
||||||
}
|
led = Some(mode.clone());
|
||||||
Err(err) => {
|
|
||||||
warn!("{}", err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(led) = led {
|
if let Some(led) = led {
|
||||||
@@ -119,13 +120,19 @@ impl CtrlKbdLedZbus {
|
|||||||
.await
|
.await
|
||||||
.unwrap_or_else(|err| warn!("{}", err));
|
.unwrap_or_else(|err| warn!("{}", err));
|
||||||
}
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn next_led_mode(&self, #[zbus(signal_context)] ctxt: SignalContext<'_>) {
|
async fn next_led_mode(
|
||||||
|
&self,
|
||||||
|
#[zbus(signal_context)] ctxt: SignalContext<'_>,
|
||||||
|
) -> zbus::fdo::Result<()> {
|
||||||
let mut led = None;
|
let mut led = None;
|
||||||
if let Ok(mut ctrl) = self.0.lock() {
|
if let Ok(mut ctrl) = self.0.lock() {
|
||||||
ctrl.toggle_mode(false)
|
ctrl.toggle_mode(false).map_err(|e| {
|
||||||
.unwrap_or_else(|err| warn!("{}", err));
|
warn!("{}", e);
|
||||||
|
e
|
||||||
|
})?;
|
||||||
|
|
||||||
if let Some(mode) = ctrl.config.builtins.get(&ctrl.config.current_mode) {
|
if let Some(mode) = ctrl.config.builtins.get(&ctrl.config.current_mode) {
|
||||||
led = Some(mode.clone());
|
led = Some(mode.clone());
|
||||||
@@ -136,13 +143,19 @@ impl CtrlKbdLedZbus {
|
|||||||
.await
|
.await
|
||||||
.unwrap_or_else(|err| warn!("{}", err));
|
.unwrap_or_else(|err| warn!("{}", err));
|
||||||
}
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn prev_led_mode(&self, #[zbus(signal_context)] ctxt: SignalContext<'_>) {
|
async fn prev_led_mode(
|
||||||
|
&self,
|
||||||
|
#[zbus(signal_context)] ctxt: SignalContext<'_>,
|
||||||
|
) -> zbus::fdo::Result<()> {
|
||||||
let mut led = None;
|
let mut led = None;
|
||||||
if let Ok(mut ctrl) = self.0.lock() {
|
if let Ok(mut ctrl) = self.0.lock() {
|
||||||
ctrl.toggle_mode(true)
|
ctrl.toggle_mode(true).map_err(|e| {
|
||||||
.unwrap_or_else(|err| warn!("{}", err));
|
warn!("{}", e);
|
||||||
|
e
|
||||||
|
})?;
|
||||||
|
|
||||||
if let Some(mode) = ctrl.config.builtins.get(&ctrl.config.current_mode) {
|
if let Some(mode) = ctrl.config.builtins.get(&ctrl.config.current_mode) {
|
||||||
led = Some(mode.clone());
|
led = Some(mode.clone());
|
||||||
@@ -153,20 +166,27 @@ impl CtrlKbdLedZbus {
|
|||||||
.await
|
.await
|
||||||
.unwrap_or_else(|err| warn!("{}", err));
|
.unwrap_or_else(|err| warn!("{}", err));
|
||||||
}
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn next_led_brightness(&self) {
|
async fn next_led_brightness(&self) -> zbus::fdo::Result<()> {
|
||||||
if let Ok(mut ctrl) = self.0.try_lock() {
|
if let Ok(mut ctrl) = self.0.try_lock() {
|
||||||
ctrl.next_brightness()
|
ctrl.next_brightness().map_err(|e| {
|
||||||
.unwrap_or_else(|err| warn!("{}", err));
|
warn!("{}", e);
|
||||||
|
e
|
||||||
|
})?;
|
||||||
}
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn prev_led_brightness(&self) {
|
async fn prev_led_brightness(&self) -> zbus::fdo::Result<()> {
|
||||||
if let Ok(mut ctrl) = self.0.try_lock() {
|
if let Ok(mut ctrl) = self.0.try_lock() {
|
||||||
ctrl.prev_brightness()
|
ctrl.prev_brightness().map_err(|e| {
|
||||||
.unwrap_or_else(|err| warn!("{}", err));
|
warn!("{}", e);
|
||||||
|
e
|
||||||
|
})?;
|
||||||
}
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[dbus_interface(property)]
|
#[dbus_interface(property)]
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ static ASUS_SWITCH_GRAPHIC_MODE: &str =
|
|||||||
static ASUS_POST_LOGO_SOUND: &str =
|
static ASUS_POST_LOGO_SOUND: &str =
|
||||||
"/sys/firmware/efi/efivars/AsusPostLogoSound-607005d5-3f75-4b2e-98f0-85ba66797a3e";
|
"/sys/firmware/efi/efivars/AsusPostLogoSound-607005d5-3f75-4b2e-98f0-85ba66797a3e";
|
||||||
static ASUS_PANEL_OD_PATH: &str = "/sys/devices/platform/asus-nb-wmi/panel_od";
|
static ASUS_PANEL_OD_PATH: &str = "/sys/devices/platform/asus-nb-wmi/panel_od";
|
||||||
|
static ASUS_DGPU_DISABLE_PATH: &str = "/sys/devices/platform/asus-nb-wmi/dgpu_disable";
|
||||||
|
static ASUS_EGPU_ENABLE_PATH: &str = "/sys/devices/platform/asus-nb-wmi/egpu_enable";
|
||||||
|
|
||||||
pub struct CtrlRogBios {
|
pub struct CtrlRogBios {
|
||||||
_config: Arc<Mutex<Config>>,
|
_config: Arc<Mutex<Config>>,
|
||||||
@@ -30,9 +32,11 @@ impl GetSupported for CtrlRogBios {
|
|||||||
|
|
||||||
fn get_supported() -> Self::A {
|
fn get_supported() -> Self::A {
|
||||||
RogBiosSupportedFunctions {
|
RogBiosSupportedFunctions {
|
||||||
post_sound_toggle: Path::new(ASUS_POST_LOGO_SOUND).exists(),
|
post_sound: Path::new(ASUS_POST_LOGO_SOUND).exists(),
|
||||||
dedicated_gfx_toggle: Path::new(ASUS_SWITCH_GRAPHIC_MODE).exists(),
|
dedicated_gfx: Path::new(ASUS_SWITCH_GRAPHIC_MODE).exists(),
|
||||||
panel_overdrive: Path::new(ASUS_PANEL_OD_PATH).exists(),
|
panel_overdrive: Path::new(ASUS_PANEL_OD_PATH).exists(),
|
||||||
|
dgpu_disable: Path::new(ASUS_DGPU_DISABLE_PATH).exists(),
|
||||||
|
egpu_enable: Path::new(ASUS_EGPU_ENABLE_PATH).exists(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ impl fmt::Display for RogError {
|
|||||||
RogError::Io(detail) => write!(f, "std::io error: {}", detail),
|
RogError::Io(detail) => write!(f, "std::io error: {}", detail),
|
||||||
RogError::Zbus(detail) => write!(f, "Zbus error: {}", detail),
|
RogError::Zbus(detail) => write!(f, "Zbus error: {}", detail),
|
||||||
RogError::ChargeLimit(value) => write!(f, "Invalid charging limit, not in range 20-100%: {}", value),
|
RogError::ChargeLimit(value) => write!(f, "Invalid charging limit, not in range 20-100%: {}", value),
|
||||||
RogError::AuraEffectNotSupported => write!(f, "Aura efect not supported"),
|
RogError::AuraEffectNotSupported => write!(f, "Aura effect not supported"),
|
||||||
RogError::NoAuraKeyboard => write!(f, "No supported Aura keyboard"),
|
RogError::NoAuraKeyboard => write!(f, "No supported Aura keyboard"),
|
||||||
RogError::NoAuraNode => write!(f, "No Aura keyboard node found"),
|
RogError::NoAuraNode => write!(f, "No Aura keyboard node found"),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rog_aura"
|
name = "rog_aura"
|
||||||
version = "1.1.1"
|
version = "1.1.2"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = ["Luke <luke@ljones.dev>"]
|
authors = ["Luke <luke@ljones.dev>"]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rog_supported"
|
name = "rog_supported"
|
||||||
version = "4.0.0"
|
version = "4.2.0"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = ["Luke <luke@ljones.dev>"]
|
authors = ["Luke <luke@ljones.dev>"]
|
||||||
|
|||||||
@@ -38,9 +38,11 @@ pub struct LedSupportedFunctions {
|
|||||||
|
|
||||||
#[derive(Serialize, Deserialize, Type, Debug)]
|
#[derive(Serialize, Deserialize, Type, Debug)]
|
||||||
pub struct RogBiosSupportedFunctions {
|
pub struct RogBiosSupportedFunctions {
|
||||||
pub post_sound_toggle: bool,
|
pub post_sound: bool,
|
||||||
pub dedicated_gfx_toggle: bool,
|
pub dedicated_gfx: bool,
|
||||||
pub panel_overdrive: bool,
|
pub panel_overdrive: bool,
|
||||||
|
pub dgpu_disable: bool,
|
||||||
|
pub egpu_enable: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for SupportedFunctions {
|
impl fmt::Display for SupportedFunctions {
|
||||||
@@ -88,7 +90,11 @@ impl fmt::Display for LedSupportedFunctions {
|
|||||||
impl fmt::Display for RogBiosSupportedFunctions {
|
impl fmt::Display for RogBiosSupportedFunctions {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
writeln!(f, "ROG BIOS:")?;
|
writeln!(f, "ROG BIOS:")?;
|
||||||
writeln!(f, "\tPOST sound toggle: {}", self.post_sound_toggle)?;
|
writeln!(f, "\tPOST sound switch: {}", self.post_sound)?;
|
||||||
writeln!(f, "\tDedicated GFX toggle: {}", self.dedicated_gfx_toggle)
|
writeln!(f, "\tPanel Overdrive: {}", self.panel_overdrive)?;
|
||||||
|
writeln!(f, "\tdGPU disable switch: {}", self.dgpu_disable)?;
|
||||||
|
writeln!(f, "\teGPU enable switch: {}", self.egpu_enable)?;
|
||||||
|
writeln!(f, "\tDedicated GFX switch: {}", self.dedicated_gfx)?;
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user