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:
@@ -903,18 +903,18 @@
|
||||
device_name: "RC71L",
|
||||
product_id: "",
|
||||
layout_name: "ga401q",
|
||||
basic_modes: [Static, Breathe, Pulse, RainbowCycle],
|
||||
basic_modes: [Static, Breathe, Pulse, RainbowCycle, RainbowWave],
|
||||
basic_zones: [],
|
||||
advanced_type: None,
|
||||
power_zones: [Keyboard],
|
||||
power_zones: [Ally],
|
||||
),
|
||||
(
|
||||
device_name: "RC72L",
|
||||
product_id: "",
|
||||
layout_name: "ga401q",
|
||||
basic_modes: [Static, Breathe, Pulse, RainbowCycle],
|
||||
basic_modes: [Static, Breathe, Pulse, RainbowCycle, RainbowWave],
|
||||
basic_zones: [],
|
||||
advanced_type: None,
|
||||
power_zones: [Keyboard],
|
||||
power_zones: [Ally],
|
||||
),
|
||||
])
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -74,6 +74,7 @@ pub enum AuraDeviceType {
|
||||
LaptopPre2021 = 1,
|
||||
LaptopTuf = 2,
|
||||
ScsiExtDisk = 3,
|
||||
Ally = 4,
|
||||
Unknown = 255,
|
||||
}
|
||||
|
||||
@@ -90,6 +91,10 @@ impl AuraDeviceType {
|
||||
*self == Self::LaptopPost2021
|
||||
}
|
||||
|
||||
pub fn is_ally(&self) -> bool {
|
||||
*self == Self::Ally
|
||||
}
|
||||
|
||||
pub fn is_scsi(&self) -> bool {
|
||||
*self == Self::ScsiExtDisk
|
||||
}
|
||||
@@ -101,6 +106,7 @@ impl From<&str> for AuraDeviceType {
|
||||
"tuf" => AuraDeviceType::LaptopTuf,
|
||||
"1932" => AuraDeviceType::ScsiExtDisk,
|
||||
"1866" | "18c6" | "1869" | "1854" => Self::LaptopPre2021,
|
||||
"1abe" | "1b4c" => Self::Ally,
|
||||
_ => Self::LaptopPost2021,
|
||||
}
|
||||
}
|
||||
@@ -128,5 +134,7 @@ pub enum PowerZones {
|
||||
RearGlow = 4,
|
||||
/// Exists for the older 0x1866 models
|
||||
KeyboardAndLightbar = 5,
|
||||
/// Ally specific for creating correct packet
|
||||
Ally = 6,
|
||||
None = 255,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user