mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Try to better handle pre-2021 laptops with lightbar
This commit is contained in:
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [v6.0.5]
|
||||
|
||||
### Changed
|
||||
|
||||
- Better more robust error handling in ROGCC
|
||||
- Try to better handle pre-2021 laptops with lightbar
|
||||
|
||||
## [v6.0.4]
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -645,25 +645,28 @@ fn handle_led_power_1_do_1866(
|
||||
aura: &AuraProxyBlocking,
|
||||
power: &LedPowerCommand1,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
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,
|
||||
let mut states = Vec::new();
|
||||
if power.keyboard {
|
||||
states.push(AuraPowerState {
|
||||
zone: PowerZones::Keyboard,
|
||||
boot: power.boot.unwrap_or_default(),
|
||||
awake: power.awake.unwrap_or_default(),
|
||||
sleep: power.sleep.unwrap_or_default(),
|
||||
shutdown: false,
|
||||
}],
|
||||
};
|
||||
});
|
||||
}
|
||||
if power.lightbar {
|
||||
states.push(AuraPowerState {
|
||||
zone: PowerZones::Lightbar,
|
||||
boot: power.boot.unwrap_or_default(),
|
||||
awake: power.awake.unwrap_or_default(),
|
||||
sleep: power.sleep.unwrap_or_default(),
|
||||
shutdown: false,
|
||||
});
|
||||
}
|
||||
|
||||
let states = LaptopAuraPower { states };
|
||||
aura.set_led_power(states)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -81,16 +81,10 @@ impl AuraPowerState {
|
||||
if self.sleep {
|
||||
a |= OldAuraPower::Sleep as u32;
|
||||
}
|
||||
if matches!(
|
||||
self.zone,
|
||||
PowerZones::Keyboard | PowerZones::KeyboardAndLightbar
|
||||
) {
|
||||
if matches!(self.zone, PowerZones::Keyboard) {
|
||||
a |= OldAuraPower::Keyboard as u32;
|
||||
}
|
||||
if matches!(
|
||||
self.zone,
|
||||
PowerZones::Lightbar | PowerZones::KeyboardAndLightbar
|
||||
) {
|
||||
if matches!(self.zone, PowerZones::Lightbar) {
|
||||
a |= OldAuraPower::Lightbar as u32;
|
||||
}
|
||||
vec![
|
||||
@@ -133,7 +127,7 @@ impl AuraPowerState {
|
||||
| (self.sleep as u32) << (23 + 3)
|
||||
| (self.shutdown as u32) << (23 + 4)
|
||||
}
|
||||
PowerZones::KeyboardAndLightbar | PowerZones::None => 0,
|
||||
PowerZones::None => 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,7 +190,7 @@ impl LaptopAuraPower {
|
||||
AuraDeviceType::LaptopPre2021 => {
|
||||
if support_data.power_zones.contains(&PowerZones::Lightbar) {
|
||||
Self {
|
||||
states: vec![AuraPowerState::default_for(PowerZones::KeyboardAndLightbar)],
|
||||
states: vec![AuraPowerState::default_for(PowerZones::Lightbar)],
|
||||
}
|
||||
} else {
|
||||
Self {
|
||||
@@ -326,7 +320,7 @@ mod test {
|
||||
assert_eq!(bytes, [0xc3, 0x12, 0x09, 0x00]);
|
||||
|
||||
let power = AuraPowerState {
|
||||
zone: PowerZones::KeyboardAndLightbar,
|
||||
zone: PowerZones::Keyboard,
|
||||
awake: true,
|
||||
boot: true,
|
||||
sleep: true,
|
||||
|
||||
@@ -126,7 +126,5 @@ 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,
|
||||
None = 255,
|
||||
}
|
||||
|
||||
@@ -63,7 +63,6 @@ impl From<PowerZones> for SlintPowerZones {
|
||||
PowerZones::Lightbar => SlintPowerZones::Lightbar,
|
||||
PowerZones::Lid => SlintPowerZones::Lid,
|
||||
PowerZones::RearGlow => SlintPowerZones::RearGlow,
|
||||
PowerZones::KeyboardAndLightbar => SlintPowerZones::KeyboardAndLightbar,
|
||||
PowerZones::None => SlintPowerZones::Keyboard,
|
||||
}
|
||||
}
|
||||
@@ -77,7 +76,6 @@ impl From<SlintPowerZones> for PowerZones {
|
||||
SlintPowerZones::Lightbar => PowerZones::Lightbar,
|
||||
SlintPowerZones::Lid => PowerZones::Lid,
|
||||
SlintPowerZones::RearGlow => PowerZones::RearGlow,
|
||||
SlintPowerZones::KeyboardAndLightbar => PowerZones::KeyboardAndLightbar,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2024-05-08 22:59+0000\n"
|
||||
"POT-Creation-Date: 2024-05-09 22:04+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"
|
||||
@@ -422,192 +422,192 @@ msgctxt "AuraPowerGroup"
|
||||
msgid "Shutdown"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:46
|
||||
#: rog-control-center/ui/types/aura_types.slint:45
|
||||
msgctxt "Aura power zone"
|
||||
msgid "Logo"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:47
|
||||
#: rog-control-center/ui/types/aura_types.slint:46
|
||||
msgctxt "Aura power zone"
|
||||
msgid "Keyboard"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:48
|
||||
#: rog-control-center/ui/types/aura_types.slint:47
|
||||
msgctxt "Aura power zone"
|
||||
msgid "Lightbar"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:49
|
||||
#: rog-control-center/ui/types/aura_types.slint:48
|
||||
msgctxt "Aura power zone"
|
||||
msgid "Lid"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:50
|
||||
#: rog-control-center/ui/types/aura_types.slint:49
|
||||
msgctxt "Aura power zone"
|
||||
msgid "Rear Glow"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:51
|
||||
#: rog-control-center/ui/types/aura_types.slint:50
|
||||
msgctxt "Aura power zone"
|
||||
msgid "Keyboard and Lightbar"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:54
|
||||
#: rog-control-center/ui/types/aura_types.slint:53
|
||||
msgctxt "Aura brightness"
|
||||
msgid "Off"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:55
|
||||
#: rog-control-center/ui/types/aura_types.slint:54
|
||||
msgctxt "Aura brightness"
|
||||
msgid "Low"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:56
|
||||
#: rog-control-center/ui/types/aura_types.slint:55
|
||||
msgctxt "Aura brightness"
|
||||
msgid "Med"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:57
|
||||
#: rog-control-center/ui/types/aura_types.slint:56
|
||||
msgctxt "Aura brightness"
|
||||
msgid "High"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:62 rog-control-center/ui/types/aura_types.slint:77
|
||||
#: rog-control-center/ui/types/aura_types.slint:61 rog-control-center/ui/types/aura_types.slint:76
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Static"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:63 rog-control-center/ui/types/aura_types.slint:78
|
||||
#: rog-control-center/ui/types/aura_types.slint:62 rog-control-center/ui/types/aura_types.slint:77
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Breathe"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:64 rog-control-center/ui/types/aura_types.slint:79
|
||||
#: rog-control-center/ui/types/aura_types.slint:63 rog-control-center/ui/types/aura_types.slint:78
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Strobe"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:65
|
||||
#: rog-control-center/ui/types/aura_types.slint:64
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Rainbow"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:66
|
||||
#: rog-control-center/ui/types/aura_types.slint:65
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Star"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:67
|
||||
#: rog-control-center/ui/types/aura_types.slint:66
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Rain"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:68
|
||||
#: rog-control-center/ui/types/aura_types.slint:67
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Highlight"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:69
|
||||
#: rog-control-center/ui/types/aura_types.slint:68
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Laser"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:70
|
||||
#: rog-control-center/ui/types/aura_types.slint:69
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Ripple"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:71
|
||||
#: rog-control-center/ui/types/aura_types.slint:70
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Nothing"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:72
|
||||
#: rog-control-center/ui/types/aura_types.slint:71
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Pulse"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:73
|
||||
#: rog-control-center/ui/types/aura_types.slint:72
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Comet"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:74
|
||||
#: rog-control-center/ui/types/aura_types.slint:73
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Flash"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:86
|
||||
#: rog-control-center/ui/types/aura_types.slint:85
|
||||
msgctxt "Aura zone"
|
||||
msgid "None"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:87
|
||||
#: rog-control-center/ui/types/aura_types.slint:86
|
||||
msgctxt "Aura zone"
|
||||
msgid "Key1"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:88
|
||||
#: rog-control-center/ui/types/aura_types.slint:87
|
||||
msgctxt "Aura zone"
|
||||
msgid "Key2"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:89
|
||||
#: rog-control-center/ui/types/aura_types.slint:88
|
||||
msgctxt "Aura zone"
|
||||
msgid "Key3"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:90
|
||||
#: rog-control-center/ui/types/aura_types.slint:89
|
||||
msgctxt "Aura zone"
|
||||
msgid "Key4"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:91
|
||||
#: rog-control-center/ui/types/aura_types.slint:90
|
||||
msgctxt "Aura zone"
|
||||
msgid "Logo"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:92
|
||||
#: rog-control-center/ui/types/aura_types.slint:91
|
||||
msgctxt "Aura zone"
|
||||
msgid "Lightbar Left"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:93
|
||||
#: rog-control-center/ui/types/aura_types.slint:92
|
||||
msgctxt "Aura zone"
|
||||
msgid "Lightbar Right"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:97
|
||||
#: rog-control-center/ui/types/aura_types.slint:96
|
||||
msgctxt "Aura direction"
|
||||
msgid "Right"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:98
|
||||
#: rog-control-center/ui/types/aura_types.slint:97
|
||||
msgctxt "Aura direction"
|
||||
msgid "Left"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:99
|
||||
#: rog-control-center/ui/types/aura_types.slint:98
|
||||
msgctxt "Aura direction"
|
||||
msgid "Up"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:100
|
||||
#: rog-control-center/ui/types/aura_types.slint:99
|
||||
msgctxt "Aura direction"
|
||||
msgid "Down"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:104
|
||||
#: rog-control-center/ui/types/aura_types.slint:103
|
||||
msgctxt "Aura speed"
|
||||
msgid "Low"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:105
|
||||
#: rog-control-center/ui/types/aura_types.slint:104
|
||||
msgctxt "Aura speed"
|
||||
msgid "Medium"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:106
|
||||
#: rog-control-center/ui/types/aura_types.slint:105
|
||||
msgctxt "Aura speed"
|
||||
msgid "High"
|
||||
msgstr ""
|
||||
|
||||
@@ -25,7 +25,6 @@ export enum PowerZones {
|
||||
Lightbar,
|
||||
Lid,
|
||||
RearGlow,
|
||||
KeyboardAndLightbar
|
||||
}
|
||||
|
||||
export struct AuraPowerState {
|
||||
|
||||
Reference in New Issue
Block a user