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