Support Rog Ally LED modes (basic)

This commit is contained in:
Luke D. Jones
2023-11-07 17:22:17 +13:00
parent fd37f41ef1
commit 0fd0aeff88
11 changed files with 58 additions and 24 deletions

View File

@@ -679,4 +679,12 @@
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "RC71L",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
)
])

View File

@@ -8,7 +8,7 @@ use crate::{AdvancedAuraType, AuraModeNum, AuraZone};
pub const ASUS_LED_MODE_CONF: &str = "/usr/share/asusd/aura_support.ron";
pub const ASUS_LED_MODE_USER_CONF: &str = "/etc/asusd/asusd_user_ledmodes.ron";
pub const ASUS_KEYBOARD_DEVICES: [AuraDevice; 7] = [
pub const ASUS_KEYBOARD_DEVICES: [AuraDevice; 8] = [
AuraDevice::Tuf,
AuraDevice::X1854,
AuraDevice::X1869,
@@ -16,6 +16,7 @@ pub const ASUS_KEYBOARD_DEVICES: [AuraDevice; 7] = [
AuraDevice::X18c6,
AuraDevice::X19b6,
AuraDevice::X1a30,
AuraDevice::X1abe,
];
#[derive(Debug, Default, Clone, PartialEq, Eq, Deserialize, Serialize)]

View File

@@ -37,9 +37,35 @@ pub enum AuraDevice {
#[default]
X19b6,
X1a30,
X1abe,
Unknown,
}
impl AuraDevice {
pub fn is_tuf_style(&self) -> bool {
matches!(self, AuraDevice::Tuf)
}
pub fn is_old_style(&self) -> bool {
!matches!(
self,
AuraDevice::Unknown
| AuraDevice::Tuf
| AuraDevice::X19b6
| AuraDevice::X18c6
| AuraDevice::X1a30
| AuraDevice::X1abe
)
}
pub fn is_new_style(&self) -> bool {
matches!(
self,
AuraDevice::X19b6 | AuraDevice::X18c6 | AuraDevice::X1a30 | AuraDevice::X1abe
)
}
}
impl From<AuraDevice> for &str {
fn from(a: AuraDevice) -> Self {
match a {
@@ -50,6 +76,7 @@ impl From<AuraDevice> for &str {
AuraDevice::X18c6 => "18c6",
AuraDevice::X19b6 => "19b6",
AuraDevice::X1a30 => "1a30",
AuraDevice::X1abe => "1abe",
AuraDevice::Unknown => "unknown",
}
}
@@ -65,6 +92,7 @@ impl From<&str> for AuraDevice {
"1854" | "0x1854" => AuraDevice::X1854,
"19b6" | "0x19b6" => AuraDevice::X19b6,
"1a30" | "0x1a30" => AuraDevice::X1a30,
"1abe" | "0x1abe" => AuraDevice::X1abe,
_ => AuraDevice::Unknown,
}
}
@@ -80,6 +108,7 @@ impl Debug for AuraDevice {
Self::X18c6 => write!(f, "0x18c6"),
Self::X19b6 => write!(f, "0x19B6"),
Self::X1a30 => write!(f, "0x1A30"),
Self::X1abe => write!(f, "0x1ABE"),
Self::Unknown => write!(f, "Unknown"),
}
}