mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Add Ally 1 and X as "old" style devices for power
These have a slightly different power settings data which needs to be verified. We can use the old style for now. Closes #542
This commit is contained in:
@@ -102,7 +102,7 @@ impl AuraPowerState {
|
||||
]
|
||||
}
|
||||
|
||||
fn new_to_byte(&self) -> u32 {
|
||||
pub fn new_to_byte(&self) -> u32 {
|
||||
match self.zone {
|
||||
PowerZones::Logo => {
|
||||
self.boot as u32
|
||||
@@ -110,6 +110,12 @@ impl AuraPowerState {
|
||||
| (self.sleep as u32) << 4
|
||||
| (self.shutdown as u32) << 6
|
||||
}
|
||||
PowerZones::Ally => {
|
||||
(self.boot as u32)
|
||||
| (self.awake as u32) << 1
|
||||
| (self.sleep as u32) << 2
|
||||
| (self.shutdown as u32) << 3
|
||||
}
|
||||
PowerZones::Keyboard => {
|
||||
(self.boot as u32) << 1
|
||||
| (self.awake as u32) << 3
|
||||
@@ -187,7 +193,7 @@ impl LaptopAuraPower {
|
||||
// TODO: use support data to setup correct zones
|
||||
pub fn new(aura_type: AuraDeviceType, support_data: &LedSupportData) -> Self {
|
||||
match aura_type {
|
||||
AuraDeviceType::Unknown | AuraDeviceType::LaptopPost2021 => {
|
||||
AuraDeviceType::Unknown | AuraDeviceType::Ally | AuraDeviceType::LaptopPost2021 => {
|
||||
let mut states = Vec::new();
|
||||
for zone in support_data.power_zones.iter() {
|
||||
states.push(AuraPowerState::default_for(*zone))
|
||||
@@ -217,8 +223,13 @@ impl LaptopAuraPower {
|
||||
}
|
||||
|
||||
pub fn to_bytes(&self, aura_type: AuraDeviceType) -> Vec<u8> {
|
||||
if let Some(stuff) = self.states.first() {
|
||||
if stuff.zone == PowerZones::Ally {
|
||||
return vec![0x5d, 0xd1, 0x09, 0x01, stuff.new_to_byte() as u8];
|
||||
}
|
||||
}
|
||||
match aura_type {
|
||||
AuraDeviceType::LaptopPost2021 => self.new_to_bytes(),
|
||||
AuraDeviceType::LaptopPost2021 | AuraDeviceType::Ally => self.new_to_bytes(),
|
||||
AuraDeviceType::LaptopPre2021 => {
|
||||
if self.states.len() == 1 {
|
||||
self.states
|
||||
|
||||
Reference in New Issue
Block a user