Complete building

This commit is contained in:
Luke D. Jones
2024-04-09 14:33:24 +12:00
parent 91ca049298
commit 4f70055f85
20 changed files with 477 additions and 967 deletions

View File

@@ -79,8 +79,8 @@ panic = "abort"
codegen-units = 1 codegen-units = 1
[profile.dev] [profile.dev]
debug = true
opt-level = 1 opt-level = 1
codegen-units = 16
[profile.bench] [profile.bench]
debug = false debug = false

View File

@@ -14,8 +14,7 @@ use rog_anime::usb::get_anime_type;
use rog_anime::{AnimTime, AnimeDataBuffer, AnimeDiagonal, AnimeGif, AnimeImage, AnimeType, Vec2}; use rog_anime::{AnimTime, AnimeDataBuffer, AnimeDiagonal, AnimeGif, AnimeImage, AnimeType, Vec2};
use rog_aura::aura_detection::PowerZones; use rog_aura::aura_detection::PowerZones;
use rog_aura::keyboard::{AuraPowerState, LaptopAuraPower}; use rog_aura::keyboard::{AuraPowerState, LaptopAuraPower};
use rog_aura::usb::AuraDevice; use rog_aura::{self, AuraDeviceType, AuraEffect};
use rog_aura::{self, AuraEffect};
use rog_dbus::zbus_anime::AnimeProxyBlocking; use rog_dbus::zbus_anime::AnimeProxyBlocking;
use rog_dbus::zbus_aura::AuraProxyBlocking; use rog_dbus::zbus_aura::AuraProxyBlocking;
use rog_dbus::zbus_fan_curves::FanCurvesProxyBlocking; use rog_dbus::zbus_fan_curves::FanCurvesProxyBlocking;
@@ -189,19 +188,19 @@ fn do_parsed(
.first() .first()
.unwrap() .unwrap()
.device_type() .device_type()
.unwrap_or(AuraDevice::Unknown) .unwrap_or(AuraDeviceType::Unknown)
} else { } else {
AuraDevice::Unknown AuraDeviceType::Unknown
}; };
let commands: Vec<String> = cmdlist.lines().map(|s| s.to_owned()).collect(); let commands: Vec<String> = cmdlist.lines().map(|s| s.to_owned()).collect();
for command in commands.iter().filter(|command| { for command in commands.iter().filter(|command| {
if !dev_type.is_old_style() if !dev_type.is_old_laptop()
&& !dev_type.is_tuf_style() && !dev_type.is_tuf_laptop()
&& command.trim().starts_with("led-pow-1") && command.trim().starts_with("led-pow-1")
{ {
return false; return false;
} }
if !dev_type.is_new_style() && command.trim().starts_with("led-pow-2") { if !dev_type.is_new_laptop() && command.trim().starts_with("led-pow-2") {
return false; return false;
} }
true true
@@ -566,7 +565,7 @@ fn handle_led_power1(
) -> Result<(), Box<dyn std::error::Error>> { ) -> Result<(), Box<dyn std::error::Error>> {
for aura in aura { for aura in aura {
let dev_type = aura.device_type()?; let dev_type = aura.device_type()?;
if !dev_type.is_old_style() && !dev_type.is_tuf_style() { if !dev_type.is_old_laptop() && !dev_type.is_tuf_laptop() {
println!("This option applies only to keyboards 2021+"); println!("This option applies only to keyboards 2021+");
} }
@@ -583,7 +582,7 @@ fn handle_led_power1(
return Ok(()); return Ok(());
} }
if dev_type.is_old_style() || dev_type.is_tuf_style() { if dev_type.is_old_laptop() || dev_type.is_tuf_laptop() {
handle_led_power_1_do_1866(aura, power)?; handle_led_power_1_do_1866(aura, power)?;
return Ok(()); return Ok(());
} }
@@ -625,7 +624,7 @@ fn handle_led_power2(
) -> Result<(), Box<dyn std::error::Error>> { ) -> Result<(), Box<dyn std::error::Error>> {
for aura in aura { for aura in aura {
let dev_type = aura.device_type()?; let dev_type = aura.device_type()?;
if !dev_type.is_new_style() { if !dev_type.is_new_laptop() {
println!("This option applies only to keyboards 2021+"); println!("This option applies only to keyboards 2021+");
continue; continue;
} }

View File

@@ -1,11 +1,12 @@
use std::collections::BTreeMap; use std::collections::BTreeMap;
use config_traits::{StdConfig, StdConfigLoad}; use config_traits::{StdConfig, StdConfigLoad};
use log::{debug, info}; use log::{debug, info, warn};
use rog_aura::aura_detection::LaptopLedData; use rog_aura::aura_detection::LaptopLedData;
use rog_aura::keyboard::{LaptopAuraPower, LaptopAuraType}; use rog_aura::keyboard::LaptopAuraPower;
use rog_aura::usb::AuraDevice; use rog_aura::{
use rog_aura::{AuraEffect, AuraModeNum, AuraZone, Direction, LedBrightness, Speed, GRADIENT}; AuraDeviceType, AuraEffect, AuraModeNum, AuraZone, Direction, LedBrightness, Speed, GRADIENT,
};
use serde_derive::{Deserialize, Serialize}; use serde_derive::{Deserialize, Serialize};
#[derive(Deserialize, Serialize, Default, Debug, Clone)] #[derive(Deserialize, Serialize, Default, Debug, Clone)]
@@ -20,14 +21,6 @@ pub struct AuraConfig {
pub enabled: LaptopAuraPower, pub enabled: LaptopAuraPower,
} }
impl AuraConfig {
/// Detect the keyboard type and load from default DB if data available
pub fn new_with(prod_id: AuraDevice) -> Self {
info!("Setting up AuraConfig for {prod_id:?}");
Self::from_default_support(prod_id, &LaptopLedData::get_data())
}
}
impl StdConfig for AuraConfig { impl StdConfig for AuraConfig {
/// Detect the keyboard type and load from default DB if data available /// Detect the keyboard type and load from default DB if data available
fn new() -> Self { fn new() -> Self {
@@ -49,17 +42,18 @@ impl StdConfig for AuraConfig {
impl StdConfigLoad for AuraConfig {} impl StdConfigLoad for AuraConfig {}
impl AuraConfig { impl AuraConfig {
pub fn from_default_support(prod_id: AuraDevice, support_data: &LaptopLedData) -> Self { /// Detect the keyboard type and load from default DB if data available
pub fn new(prod_id: &str) -> Self {
info!("Setting up AuraConfig for {prod_id:?}");
// create a default config here // create a default config here
let enabled = if prod_id.is_new_style() { let device_type = AuraDeviceType::from(&*prod_id);
LaptopAuraPower::new(LaptopAuraType::New, support_data) if device_type == AuraDeviceType::Unknown {
} else if prod_id.is_tuf_style() { warn!("idProduct:{prod_id:?} is unknown");
LaptopAuraPower::new(LaptopAuraType::Tuf, support_data) }
} else { let support_data = LaptopLedData::get_data();
LaptopAuraPower::new(LaptopAuraType::Old, support_data) let enabled = LaptopAuraPower::new(device_type, &support_data);
};
let mut config = AuraConfig { let mut config = AuraConfig {
config_name: format!("aura_{prod_id:?}.ron"), config_name: format!("aura_{prod_id}.ron"),
brightness: LedBrightness::Med, brightness: LedBrightness::Med,
current_mode: AuraModeNum::Static, current_mode: AuraModeNum::Static,
builtins: BTreeMap::new(), builtins: BTreeMap::new(),
@@ -139,16 +133,13 @@ impl AuraConfig {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use rog_aura::aura_detection::LaptopLedData;
use rog_aura::usb::AuraDevice;
use rog_aura::{AuraEffect, AuraModeNum, AuraZone, Colour}; use rog_aura::{AuraEffect, AuraModeNum, AuraZone, Colour};
use super::AuraConfig; use super::AuraConfig;
#[test] #[test]
fn set_multizone_4key_config() { fn set_multizone_4key_config() {
let mut config = let mut config = AuraConfig::new("19b6");
AuraConfig::from_default_support(AuraDevice::X19b6, &LaptopLedData::default());
let effect = AuraEffect { let effect = AuraEffect {
colour1: Colour { colour1: Colour {
@@ -238,8 +229,7 @@ mod tests {
#[test] #[test]
fn set_multizone_multimode_config() { fn set_multizone_multimode_config() {
let mut config = let mut config = AuraConfig::new("19b6");
AuraConfig::from_default_support(AuraDevice::X19b6, &LaptopLedData::default());
let effect = AuraEffect { let effect = AuraEffect {
zone: AuraZone::Key1, zone: AuraZone::Key1,

View File

@@ -5,8 +5,10 @@ use inotify::Inotify;
use log::{debug, info, warn}; use log::{debug, info, warn};
use rog_aura::aura_detection::LaptopLedData; use rog_aura::aura_detection::LaptopLedData;
use rog_aura::keyboard::{LedUsbPackets, UsbPackets}; use rog_aura::keyboard::{LedUsbPackets, UsbPackets};
use rog_aura::usb::{AuraDevice, LED_APPLY, LED_SET}; use rog_aura::usb::{LED_APPLY, LED_SET};
use rog_aura::{AuraEffect, Direction, LedBrightness, Speed, GRADIENT, LED_MSG_LEN}; use rog_aura::{
AuraDeviceType, AuraEffect, Direction, LedBrightness, Speed, GRADIENT, LED_MSG_LEN,
};
use rog_platform::hid_raw::HidRaw; use rog_platform::hid_raw::HidRaw;
use rog_platform::keyboard_led::KeyboardLed; use rog_platform::keyboard_led::KeyboardLed;
use zbus::zvariant::OwnedObjectPath; use zbus::zvariant::OwnedObjectPath;
@@ -50,7 +52,7 @@ impl LEDNode {
/// Individual controller for one Aura device /// Individual controller for one Aura device
pub struct CtrlKbdLed { pub struct CtrlKbdLed {
pub led_prod: AuraDevice, pub led_type: AuraDeviceType,
pub led_node: LEDNode, pub led_node: LEDNode,
pub supported_data: LaptopLedData, // TODO: is storing this really required? pub supported_data: LaptopLedData, // TODO: is storing this really required?
pub per_key_mode_active: bool, pub per_key_mode_active: bool,
@@ -92,10 +94,11 @@ impl CtrlKbdLed {
} }
// Device is something like 002, while its parent is the MCU // Device is something like 002, while its parent is the MCU
// Think of it like the device is an endpoint of the USB device attached // Think of it like the device is an endpoint of the USB device attached
let mut aura_dev = AuraDevice::Unknown; let mut prod_id = String::new();
if let Some(usb_id) = usb_device.attribute_value("idProduct") { if let Some(usb_id) = usb_device.attribute_value("idProduct") {
aura_dev = AuraDevice::from(usb_id.to_str().unwrap()); prod_id = usb_id.to_string_lossy().to_string();
if aura_dev == AuraDevice::Unknown || found.contains(&aura_dev) { let aura_dev = AuraDeviceType::from(prod_id.as_str());
if aura_dev == AuraDeviceType::Unknown || found.contains(&aura_dev) {
log::debug!("Unknown or invalid device: {usb_id:?}, skipping"); log::debug!("Unknown or invalid device: {usb_id:?}, skipping");
continue; continue;
} }
@@ -112,7 +115,7 @@ impl CtrlKbdLed {
let dbus_path = dbus_path_for_dev(&usb_device).unwrap_or_default(); let dbus_path = dbus_path_for_dev(&usb_device).unwrap_or_default();
let dev = HidRaw::from_device(end_point)?; let dev = HidRaw::from_device(end_point)?;
let mut dev = Self::from_hidraw(dev, dbus_path, data)?; let mut dev = Self::from_hidraw(dev, dbus_path, data)?;
dev.config = Self::init_config(aura_dev, data); dev.config = Self::init_config(&prod_id, data);
devices.push(dev); devices.push(dev);
} }
} }
@@ -130,8 +133,8 @@ impl CtrlKbdLed {
data: &LaptopLedData, data: &LaptopLedData,
) -> Result<Self, RogError> { ) -> Result<Self, RogError> {
let rgb_led = KeyboardLed::new()?; let rgb_led = KeyboardLed::new()?;
let prod_id = AuraDevice::from(device.prod_id()); let prod_id = AuraDeviceType::from(device.prod_id());
if prod_id == AuraDevice::Unknown { if prod_id == AuraDeviceType::Unknown {
log::error!("{} is AuraDevice::Unknown", device.prod_id()); log::error!("{} is AuraDevice::Unknown", device.prod_id());
return Err(RogError::NoAuraNode); return Err(RogError::NoAuraNode);
} }
@@ -140,7 +143,7 @@ impl CtrlKbdLed {
// let config = Self::init_config(prod_id, data); // let config = Self::init_config(prod_id, data);
let ctrl = CtrlKbdLed { let ctrl = CtrlKbdLed {
led_prod: prod_id, led_type: prod_id,
led_node: LEDNode::Rog(rgb_led, device), led_node: LEDNode::Rog(rgb_led, device),
supported_data: data.clone(), supported_data: data.clone(),
per_key_mode_active: false, per_key_mode_active: false,
@@ -150,9 +153,9 @@ impl CtrlKbdLed {
Ok(ctrl) Ok(ctrl)
} }
pub fn init_config(prod_id: AuraDevice, supported_basic_modes: &LaptopLedData) -> AuraConfig { pub fn init_config(prod_id: &str, supported_basic_modes: &LaptopLedData) -> AuraConfig {
// New loads data from the DB also // New loads data from the DB also
let mut config_init = AuraConfig::new_with(prod_id); let mut config_init = AuraConfig::new(prod_id);
// config_init.set_filename(prod_id); // config_init.set_filename(prod_id);
let mut config_loaded = config_init.clone().load(); let mut config_loaded = config_init.clone().load();
// update the initialised data with what we loaded from disk // update the initialised data with what we loaded from disk
@@ -198,7 +201,7 @@ impl CtrlKbdLed {
// pwr[4] as u8]; platform.set_kbd_rgb_state(&buf)?; // pwr[4] as u8]; platform.set_kbd_rgb_state(&buf)?;
// } // }
} else if let LEDNode::Rog(_, hid_raw) = &self.led_node { } else if let LEDNode::Rog(_, hid_raw) = &self.led_node {
let bytes = self.config.enabled.to_bytes(self.led_prod.into()); let bytes = self.config.enabled.to_bytes(self.led_type.into());
let message = [0x5d, 0xbd, 0x01, bytes[0], bytes[1], bytes[2], bytes[3]]; let message = [0x5d, 0xbd, 0x01, bytes[0], bytes[1], bytes[2], bytes[3]];
hid_raw.write_bytes(&message)?; hid_raw.write_bytes(&message)?;
@@ -344,8 +347,7 @@ impl CtrlKbdLed {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use rog_aura::aura_detection::{LaptopLedData, PowerZones}; use rog_aura::aura_detection::{LaptopLedData, PowerZones};
use rog_aura::usb::AuraDevice; use rog_aura::{AuraDeviceType, AuraModeNum, AuraZone};
use rog_aura::{AuraModeNum, AuraZone};
use rog_platform::hid_raw::HidRaw; use rog_platform::hid_raw::HidRaw;
use rog_platform::keyboard_led::KeyboardLed; use rog_platform::keyboard_led::KeyboardLed;
use zbus::zvariant::OwnedObjectPath; use zbus::zvariant::OwnedObjectPath;
@@ -358,7 +360,7 @@ mod tests {
#[ignore = "Unable to run in CI as the HIDRAW device is required"] #[ignore = "Unable to run in CI as the HIDRAW device is required"]
fn create_multizone_if_no_config() { fn create_multizone_if_no_config() {
// Checking to ensure set_mode errors when unsupported modes are tried // Checking to ensure set_mode errors when unsupported modes are tried
let config = AuraConfig::from_default_support(AuraDevice::X19b6, &LaptopLedData::default()); let config = AuraConfig::new("19b6");
let supported_basic_modes = LaptopLedData { let supported_basic_modes = LaptopLedData {
board_name: String::new(), board_name: String::new(),
layout_name: "ga401".to_owned(), layout_name: "ga401".to_owned(),
@@ -368,11 +370,8 @@ mod tests {
power_zones: vec![PowerZones::Keyboard, PowerZones::RearGlow], power_zones: vec![PowerZones::Keyboard, PowerZones::RearGlow],
}; };
let mut controller = CtrlKbdLed { let mut controller = CtrlKbdLed {
led_prod: AuraDevice::X19b6, led_type: AuraDeviceType::LaptopPost2021,
led_node: LEDNode::Rog( led_node: LEDNode::Rog(KeyboardLed::default(), HidRaw::new("19b6").unwrap()),
KeyboardLed::default(),
HidRaw::new(AuraDevice::X19b6.into()).unwrap(),
),
supported_data: supported_basic_modes, supported_data: supported_basic_modes,
per_key_mode_active: false, per_key_mode_active: false,
config, config,
@@ -401,7 +400,7 @@ mod tests {
// TODO: use sim device // TODO: use sim device
fn next_mode_create_multizone_if_no_config() { fn next_mode_create_multizone_if_no_config() {
// Checking to ensure set_mode errors when unsupported modes are tried // Checking to ensure set_mode errors when unsupported modes are tried
let config = AuraConfig::from_default_support(AuraDevice::X19b6, &LaptopLedData::default()); let config = AuraConfig::new("19b6");
let supported_basic_modes = LaptopLedData { let supported_basic_modes = LaptopLedData {
board_name: String::new(), board_name: String::new(),
layout_name: "ga401".to_owned(), layout_name: "ga401".to_owned(),
@@ -411,11 +410,8 @@ mod tests {
power_zones: vec![PowerZones::Keyboard, PowerZones::RearGlow], power_zones: vec![PowerZones::Keyboard, PowerZones::RearGlow],
}; };
let mut controller = CtrlKbdLed { let mut controller = CtrlKbdLed {
led_prod: AuraDevice::X19b6, led_type: AuraDeviceType::LaptopPost2021,
led_node: LEDNode::Rog( led_node: LEDNode::Rog(KeyboardLed::default(), HidRaw::new("19b6").unwrap()),
KeyboardLed::default(),
HidRaw::new(AuraDevice::X19b6.into()).unwrap(),
),
supported_data: supported_basic_modes, supported_data: supported_basic_modes,
per_key_mode_active: false, per_key_mode_active: false,
config, config,

View File

@@ -9,7 +9,7 @@ use std::collections::HashSet;
use log::{debug, error, info, warn}; use log::{debug, error, info, warn};
use mio::{Events, Interest, Poll, Token}; use mio::{Events, Interest, Poll, Token};
use rog_aura::aura_detection::LaptopLedData; use rog_aura::aura_detection::LaptopLedData;
use rog_aura::usb::AuraDevice; use rog_aura::AuraDeviceType;
use rog_platform::hid_raw::HidRaw; use rog_platform::hid_raw::HidRaw;
use tokio::task::spawn_blocking; use tokio::task::spawn_blocking;
use udev::{Device, MonitorBuilder}; use udev::{Device, MonitorBuilder};
@@ -86,8 +86,8 @@ impl AuraManager {
continue; continue;
}; };
let aura_device = AuraDevice::from(&*id_product); let aura_device = AuraDeviceType::from(&*id_product);
if aura_device == AuraDevice::Unknown { if aura_device == AuraDeviceType::Unknown {
warn!("idProduct:{id_product:?} is unknown, not using"); warn!("idProduct:{id_product:?} is unknown, not using");
continue; continue;
} }
@@ -135,7 +135,7 @@ impl AuraManager {
if let Ok(mut ctrl) = if let Ok(mut ctrl) =
CtrlKbdLed::from_hidraw(raw, path.clone(), &data) CtrlKbdLed::from_hidraw(raw, path.clone(), &data)
{ {
ctrl.config = CtrlKbdLed::init_config(aura_device, &data); ctrl.config = CtrlKbdLed::init_config(&id_product, &data);
interfaces.insert(path.clone()); interfaces.insert(path.clone());
info!("AuraManager starting device at: {dev_node:?}, {path:?}"); info!("AuraManager starting device at: {dev_node:?}, {path:?}");
let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?; let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?;

View File

@@ -5,8 +5,7 @@ use config_traits::StdConfig;
use log::{debug, error, info, warn}; use log::{debug, error, info, warn};
use rog_aura::aura_detection::PowerZones; use rog_aura::aura_detection::PowerZones;
use rog_aura::keyboard::{LaptopAuraPower, UsbPackets}; use rog_aura::keyboard::{LaptopAuraPower, UsbPackets};
use rog_aura::usb::AuraDevice; use rog_aura::{AuraDeviceType, AuraEffect, AuraModeNum, AuraZone, LedBrightness};
use rog_aura::{AuraEffect, AuraModeNum, AuraZone, LedBrightness};
use zbus::export::futures_util::lock::{Mutex, MutexGuard}; use zbus::export::futures_util::lock::{Mutex, MutexGuard};
use zbus::export::futures_util::StreamExt; use zbus::export::futures_util::StreamExt;
use zbus::fdo::Error as ZbErr; use zbus::fdo::Error as ZbErr;
@@ -43,9 +42,9 @@ impl CtrlAuraZbus {
impl CtrlAuraZbus { impl CtrlAuraZbus {
/// Return the device type for this Aura keyboard /// Return the device type for this Aura keyboard
#[zbus(property)] #[zbus(property)]
async fn device_type(&self) -> AuraDevice { async fn device_type(&self) -> AuraDeviceType {
let ctrl = self.0.lock().await; let ctrl = self.0.lock().await;
ctrl.led_prod ctrl.led_type
} }
/// Return the current LED brightness /// Return the current LED brightness

View File

@@ -5,21 +5,10 @@ use typeshare::typeshare;
use zbus::zvariant::{OwnedValue, Type, Value}; use zbus::zvariant::{OwnedValue, Type, Value};
use crate::keyboard::AdvancedAuraType; use crate::keyboard::AdvancedAuraType;
use crate::usb::AuraDevice;
use crate::{AuraModeNum, AuraZone}; use crate::{AuraModeNum, AuraZone};
pub const ASUS_LED_MODE_CONF: &str = "/usr/share/asusd/aura_support.ron"; 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_LED_MODE_USER_CONF: &str = "/etc/asusd/asusd_user_ledmodes.ron";
pub const ASUS_KEYBOARD_DEVICES: [AuraDevice; 8] = [
AuraDevice::Tuf,
AuraDevice::X1854,
AuraDevice::X1869,
AuraDevice::X1866,
AuraDevice::X18c6,
AuraDevice::X19b6,
AuraDevice::X1a30,
AuraDevice::X1abe,
];
#[derive(Debug, Default, Clone, PartialEq, Eq, Deserialize, Serialize)] #[derive(Debug, Default, Clone, PartialEq, Eq, Deserialize, Serialize)]
pub struct LedSupportFile(Vec<LaptopLedData>); pub struct LedSupportFile(Vec<LaptopLedData>);

View File

@@ -3,55 +3,14 @@
use std::fmt::Debug; use std::fmt::Debug;
use std::ops::{BitAnd, BitOr}; use std::ops::{BitAnd, BitOr};
use log::warn;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use typeshare::typeshare; use typeshare::typeshare;
#[cfg(feature = "dbus")] #[cfg(feature = "dbus")]
use zbus::zvariant::{OwnedValue, Type, Value}; use zbus::zvariant::{OwnedValue, Type, Value};
use crate::aura_detection::{LaptopLedData, PowerZones}; use crate::aura_detection::{LaptopLedData, PowerZones};
use crate::usb::AuraDevice; use crate::AuraDeviceType;
// Possible API:
// # Common parts:
// - boot
// - awake
// - sleep
// ## New only
// - shutdown
//
// ## Only only
// - keyboard
// - lightbar
// ## TUF only
// - keyboard
//
// # New has parts:
// - keyboard
// - lightbar
// - logo
// - lid
// - rear_glow
#[typeshare]
#[cfg_attr(feature = "dbus", derive(Type, Value, OwnedValue))]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum LaptopAuraType {
New = 0,
Old = 1,
Tuf = 2,
}
impl From<AuraDevice> for LaptopAuraType {
fn from(value: AuraDevice) -> Self {
if value.is_old_style() {
Self::Old
} else if value.is_tuf_style() {
Self::Tuf
} else {
Self::New
}
}
}
/// Meaning of this struct depends on the laptop generation. /// Meaning of this struct depends on the laptop generation.
/// - 2021+, the struct is a single zone with 4 states /// - 2021+, the struct is a single zone with 4 states
@@ -225,45 +184,53 @@ impl LaptopAuraPower {
} }
// TODO: use support data to setup correct zones // TODO: use support data to setup correct zones
pub fn new(aura_type: LaptopAuraType, _support_data: &LaptopLedData) -> Self { pub fn new(aura_type: AuraDeviceType, support_data: &LaptopLedData) -> Self {
match aura_type { match aura_type {
LaptopAuraType::New => { AuraDeviceType::Unknown | AuraDeviceType::LaptopPost2021 => {
let mut states = Vec::new(); let mut states = Vec::new();
for zone in [ for zone in support_data.power_zones.iter() {
PowerZones::Keyboard, states.push(AuraPowerState::default_for(*zone))
PowerZones::Lid,
PowerZones::Lightbar,
PowerZones::Logo,
PowerZones::RearGlow,
] {
states.push(AuraPowerState::default_for(zone))
} }
Self { states } Self { states }
} }
LaptopAuraType::Old => Self { AuraDeviceType::LaptopPre2021 => {
states: vec![AuraPowerState::default_for(PowerZones::KeyboardAndLightbar)], if support_data.power_zones.contains(&PowerZones::Lightbar) {
}, Self {
LaptopAuraType::Tuf => Self { states: vec![AuraPowerState::default_for(PowerZones::KeyboardAndLightbar)],
}
} else {
Self {
states: vec![AuraPowerState::default_for(PowerZones::Keyboard)],
}
}
}
AuraDeviceType::LaptopTuf => Self {
states: vec![AuraPowerState::default_for(PowerZones::Keyboard)], states: vec![AuraPowerState::default_for(PowerZones::Keyboard)],
}, },
AuraDeviceType::ScsiExtDisk => todo!(),
} }
} }
pub fn to_bytes(&self, aura_type: LaptopAuraType) -> Vec<u8> { pub fn to_bytes(&self, aura_type: AuraDeviceType) -> Vec<u8> {
match aura_type { match aura_type {
LaptopAuraType::New => self.new_to_bytes(), AuraDeviceType::LaptopPost2021 => self.new_to_bytes(),
LaptopAuraType::Old => self AuraDeviceType::LaptopPre2021 => self
.states .states
.first() .first()
.cloned() .cloned()
.unwrap_or_default() .unwrap_or_default()
.old_to_bytes(), .old_to_bytes(),
LaptopAuraType::Tuf => self AuraDeviceType::LaptopTuf => self
.states .states
.first() .first()
.cloned() .cloned()
.unwrap_or_default() .unwrap_or_default()
.tuf_to_bytes(), .tuf_to_bytes(),
AuraDeviceType::Unknown => {
warn!("Trying to create bytes for an unknown device");
self.new_to_bytes()
}
AuraDeviceType::ScsiExtDisk => todo!(),
} }
} }
} }
@@ -310,7 +277,8 @@ impl From<OldAuraPower> for u32 {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use crate::aura_detection::{LaptopLedData, PowerZones}; use crate::aura_detection::{LaptopLedData, PowerZones};
use crate::keyboard::{AuraPowerState, LaptopAuraPower, LaptopAuraType}; use crate::keyboard::{AuraPowerState, LaptopAuraPower};
use crate::AuraDeviceType;
#[test] #[test]
fn check_0x1866_control_bytes() { fn check_0x1866_control_bytes() {
@@ -374,7 +342,7 @@ mod test {
#[test] #[test]
fn check_0x19b6_control_bytes_binary_rep() { fn check_0x19b6_control_bytes_binary_rep() {
fn to_binary_string(power: &LaptopAuraPower) -> String { fn to_binary_string(power: &LaptopAuraPower) -> String {
let bytes = power.to_bytes(LaptopAuraType::New); let bytes = power.to_bytes(AuraDeviceType::LaptopPost2021);
format!( format!(
"{:08b}, {:08b}, {:08b}, {:08b}", "{:08b}, {:08b}, {:08b}, {:08b}",
bytes[0], bytes[1], bytes[2], bytes[3] bytes[0], bytes[1], bytes[2], bytes[3]
@@ -547,7 +515,7 @@ mod test {
assert_eq!(shut_rear_, "00000000, 00000000, 00000000, 00001000"); assert_eq!(shut_rear_, "00000000, 00000000, 00000000, 00001000");
// All on // All on
let byte1 = LaptopAuraPower::new(LaptopAuraType::New, &LaptopLedData::default()); let byte1 = LaptopAuraPower::new(AuraDeviceType::LaptopPost2021, &LaptopLedData::default());
let out = to_binary_string(&byte1); let out = to_binary_string(&byte1);
assert_eq!(out, "11111111, 00011110, 00001111, 00001111"); assert_eq!(out, "11111111, 00011110, 00001111, 00001111");
} }

View File

@@ -3,6 +3,13 @@
// TODO: Traits for writing aura_sync // TODO: Traits for writing aura_sync
// TODO: separate keyboard and laptop parts? // TODO: separate keyboard and laptop parts?
use std::fmt::Debug;
use serde::{Deserialize, Serialize};
use typeshare::typeshare;
#[cfg(feature = "dbus")]
use zbus::zvariant::{OwnedValue, Type, Value};
/// A container of images/grids/gifs/pauses which can be iterated over to /// A container of images/grids/gifs/pauses which can be iterated over to
/// generate cool effects /// generate cool effects
pub mod effects; pub mod effects;
@@ -56,3 +63,45 @@ pub const ORANGE: Colour = Colour {
b: 0x00, b: 0x00,
}; };
pub const GRADIENT: [Colour; 7] = [RED, VIOLET, BLUE, TEAL, GREEN, YELLOW, ORANGE]; pub const GRADIENT: [Colour; 7] = [RED, VIOLET, BLUE, TEAL, GREEN, YELLOW, ORANGE];
#[typeshare]
#[cfg_attr(feature = "dbus", derive(Type, Value, OwnedValue))]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum AuraDeviceType {
/// Most new laptops
#[default]
LaptopPost2021 = 0,
LaptopPre2021 = 1,
LaptopTuf = 2,
ScsiExtDisk = 3,
Unknown = 255,
}
impl AuraDeviceType {
pub fn is_old_laptop(&self) -> bool {
*self == Self::LaptopPre2021
}
pub fn is_tuf_laptop(&self) -> bool {
*self == Self::LaptopTuf
}
pub fn is_new_laptop(&self) -> bool {
*self == Self::LaptopPost2021
}
pub fn is_scsi(&self) -> bool {
*self == Self::ScsiExtDisk
}
}
impl From<&str> for AuraDeviceType {
fn from(s: &str) -> Self {
match s.to_lowercase().trim_start_matches("0x") {
"tuf" => AuraDeviceType::LaptopTuf,
"1932" => AuraDeviceType::ScsiExtDisk,
"1866" | "18c6" | "1869" | "1854" => Self::LaptopPre2021,
_ => Self::LaptopPost2021,
}
}
}

View File

@@ -1,10 +1,3 @@
use std::fmt::Debug;
use serde::{Deserialize, Serialize};
use typeshare::typeshare;
#[cfg(feature = "dbus")]
use zbus::zvariant::{OwnedValue, Type, Value};
// Only these two packets must be 17 bytes // Only these two packets must be 17 bytes
pub const LED_APPLY: [u8; 17] = [0x5d, 0xb4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; pub const LED_APPLY: [u8; 17] = [0x5d, 0xb4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
pub const LED_SET: [u8; 17] = [0x5d, 0xb5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; pub const LED_SET: [u8; 17] = [0x5d, 0xb5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
@@ -15,92 +8,3 @@ pub const fn aura_brightness_bytes(brightness: u8) -> [u8; 17] {
0x5a, 0xba, 0xc5, 0xc4, brightness, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x5a, 0xba, 0xc5, 0xc4, brightness, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
] ]
} }
#[typeshare]
#[cfg_attr(
feature = "dbus",
derive(Type, Value, OwnedValue),
zvariant(signature = "s")
)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
pub enum AuraDevice {
Tuf = 0,
X1854 = 1,
X1869 = 2,
/// Pre-2020 laptops
X1866 = 3,
/// Z13 lightbar
X18c6 = 4,
/// Most modern laptops
#[default]
X19b6 = 5,
X1a30 = 6,
/// The ROG Ally
X1abe = 7,
Unknown = 99,
}
impl AuraDevice {
pub fn is_tuf_style(&self) -> bool {
matches!(self, AuraDevice::Tuf)
}
pub fn is_old_style(&self) -> bool {
matches!(
self,
AuraDevice::X1854 | AuraDevice::X1869 | AuraDevice::X1866 | AuraDevice::X1abe
)
}
pub fn is_new_style(&self) -> bool {
!self.is_old_style() && !self.is_tuf_style()
}
}
impl From<AuraDevice> for &str {
fn from(a: AuraDevice) -> Self {
match a {
AuraDevice::Tuf => "tuf",
AuraDevice::X1854 => "1854",
AuraDevice::X1869 => "1869",
AuraDevice::X1866 => "1866",
AuraDevice::X18c6 => "18c6",
AuraDevice::X19b6 => "19b6",
AuraDevice::X1a30 => "1a30",
AuraDevice::X1abe => "1abe",
AuraDevice::Unknown => "unknown",
}
}
}
impl From<&str> for AuraDevice {
fn from(s: &str) -> Self {
match s.to_lowercase().as_str() {
"tuf" => AuraDevice::Tuf,
"1866" | "0x1866" => AuraDevice::X1866,
"18c6" | "0x18c6" => AuraDevice::X18c6,
"1869" | "0x1869" => AuraDevice::X1869,
"1854" | "0x1854" => AuraDevice::X1854,
"19b6" | "0x19b6" => AuraDevice::X19b6,
"1a30" | "0x1a30" => AuraDevice::X1a30,
"1abe" | "0x1abe" => AuraDevice::X1abe,
_ => AuraDevice::Unknown,
}
}
}
impl Debug for AuraDevice {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Tuf => write!(f, "Tuf"),
Self::X1854 => write!(f, "0x1854"),
Self::X1869 => write!(f, "0x1869"),
Self::X1866 => write!(f, "0x1866"),
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"),
}
}
}

View File

@@ -1,3 +1,7 @@
use crate::slint_generatedMainWindow::{
AuraPowerState as SlintAuraPowerState, LaptopAuraPower as SlintLaptopAuraPower,
};
impl From<rog_aura::AuraEffect> for crate::slint_generatedMainWindow::AuraEffect { impl From<rog_aura::AuraEffect> for crate::slint_generatedMainWindow::AuraEffect {
fn from(m: rog_aura::AuraEffect) -> Self { fn from(m: rog_aura::AuraEffect) -> Self {
Self { Self {
@@ -47,58 +51,9 @@ impl From<crate::slint_generatedMainWindow::AuraEffect> for rog_aura::AuraEffect
} }
use rog_aura::aura_detection::PowerZones; use rog_aura::aura_detection::PowerZones;
use rog_aura::keyboard::{AuraPowerState, LaptopOldAuraPower, LaptopTufAuraPower}; use rog_aura::keyboard::{AuraPowerState, LaptopAuraPower};
use rog_aura::usb::AuraPowerDev;
use slint::{Model, ModelRc, RgbaColor}; use slint::{Model, ModelRc, RgbaColor};
use crate::slint_generatedMainWindow::AuraDevTuf as SlintAuraDevTuf;
impl From<LaptopTufAuraPower> for SlintAuraDevTuf {
fn from(value: LaptopTufAuraPower) -> Self {
match value {
LaptopTufAuraPower::Boot => SlintAuraDevTuf::Boot,
LaptopTufAuraPower::Awake => SlintAuraDevTuf::Awake,
LaptopTufAuraPower::Sleep => SlintAuraDevTuf::Sleep,
LaptopTufAuraPower::Keyboard => SlintAuraDevTuf::Keyboard,
}
}
}
impl From<SlintAuraDevTuf> for LaptopTufAuraPower {
fn from(value: SlintAuraDevTuf) -> Self {
match value {
SlintAuraDevTuf::Boot => LaptopTufAuraPower::Boot,
SlintAuraDevTuf::Awake => LaptopTufAuraPower::Awake,
SlintAuraDevTuf::Sleep => LaptopTufAuraPower::Sleep,
SlintAuraDevTuf::Keyboard => LaptopTufAuraPower::Keyboard,
}
}
}
use crate::slint_generatedMainWindow::AuraDevRog1 as SlintAuraDevRog1;
impl From<LaptopOldAuraPower> for SlintAuraDevRog1 {
fn from(value: LaptopOldAuraPower) -> Self {
match value {
LaptopOldAuraPower::Awake => SlintAuraDevRog1::Awake,
LaptopOldAuraPower::Keyboard => SlintAuraDevRog1::Keyboard,
LaptopOldAuraPower::Lightbar => SlintAuraDevRog1::Lightbar,
LaptopOldAuraPower::Boot => SlintAuraDevRog1::Boot,
LaptopOldAuraPower::Sleep => SlintAuraDevRog1::Sleep,
}
}
}
impl From<SlintAuraDevRog1> for LaptopOldAuraPower {
fn from(value: SlintAuraDevRog1) -> Self {
match value {
SlintAuraDevRog1::Awake => LaptopOldAuraPower::Awake,
SlintAuraDevRog1::Keyboard => LaptopOldAuraPower::Keyboard,
SlintAuraDevRog1::Lightbar => LaptopOldAuraPower::Lightbar,
SlintAuraDevRog1::Boot => LaptopOldAuraPower::Boot,
SlintAuraDevRog1::Sleep => LaptopOldAuraPower::Sleep,
}
}
}
use crate::slint_generatedMainWindow::PowerZones as SlintPowerZones; use crate::slint_generatedMainWindow::PowerZones as SlintPowerZones;
impl From<rog_aura::aura_detection::PowerZones> for SlintPowerZones { impl From<rog_aura::aura_detection::PowerZones> for SlintPowerZones {
fn from(value: rog_aura::aura_detection::PowerZones) -> Self { fn from(value: rog_aura::aura_detection::PowerZones) -> Self {
@@ -121,117 +76,72 @@ impl From<SlintPowerZones> for rog_aura::aura_detection::PowerZones {
SlintPowerZones::Lightbar => rog_aura::aura_detection::PowerZones::Lightbar, SlintPowerZones::Lightbar => rog_aura::aura_detection::PowerZones::Lightbar,
SlintPowerZones::Lid => rog_aura::aura_detection::PowerZones::Lid, SlintPowerZones::Lid => rog_aura::aura_detection::PowerZones::Lid,
SlintPowerZones::RearGlow => rog_aura::aura_detection::PowerZones::RearGlow, SlintPowerZones::RearGlow => rog_aura::aura_detection::PowerZones::RearGlow,
SlintPowerZones::KeyboardAndLightbar => {
rog_aura::aura_detection::PowerZones::KeyboardAndLightbar
}
} }
} }
} }
use crate::slint_generatedMainWindow::{ impl From<SlintAuraPowerState> for AuraPowerState {
AuraPower as SlintAuraPower, KbAuraPowerState as SlintKbAuraPowerState, fn from(value: SlintAuraPowerState) -> Self {
};
impl From<rog_aura::keyboard::LaptopAuraPower> for SlintAuraPower {
fn from(value: rog_aura::keyboard::LaptopAuraPower) -> Self {
Self { Self {
keyboard: SlintKbAuraPowerState { zone: value.zone.into(),
awake: value.keyboard.awake, boot: value.boot.into(),
boot: value.keyboard.boot, awake: value.awake.into(),
shutdown: value.keyboard.shutdown, sleep: value.sleep.into(),
sleep: value.keyboard.sleep, shutdown: value.shutdown.into(),
},
lid: SlintKbAuraPowerState {
awake: value.lid.awake,
boot: value.lid.boot,
shutdown: value.lid.shutdown,
sleep: value.lid.sleep,
},
lightbar: SlintKbAuraPowerState {
awake: value.lightbar.awake,
boot: value.lightbar.boot,
shutdown: value.lightbar.shutdown,
sleep: value.lightbar.sleep,
},
logo: SlintKbAuraPowerState {
awake: value.logo.awake,
boot: value.logo.boot,
shutdown: value.logo.shutdown,
sleep: value.logo.sleep,
},
rear_glow: SlintKbAuraPowerState {
awake: value.rear_glow.awake,
boot: value.rear_glow.boot,
shutdown: value.rear_glow.shutdown,
sleep: value.rear_glow.sleep,
},
} }
} }
} }
impl From<SlintAuraPower> for rog_aura::keyboard::LaptopAuraPower { impl From<AuraPowerState> for SlintAuraPowerState {
fn from(value: SlintAuraPower) -> Self { fn from(value: AuraPowerState) -> Self {
Self { let zone = value.zone.into();
keyboard: AuraPowerState { SlintAuraPowerState {
awake: value.keyboard.awake, boot: value.boot.into(),
boot: value.keyboard.boot, awake: value.awake.into(),
shutdown: value.keyboard.shutdown, sleep: value.sleep.into(),
sleep: value.keyboard.sleep, shutdown: value.shutdown.into(),
}, zone,
lid: AuraPowerState { zone_name_idx: zone as i32,
awake: value.lid.awake,
boot: value.lid.boot,
shutdown: value.lid.shutdown,
sleep: value.lid.sleep,
},
lightbar: AuraPowerState {
awake: value.lightbar.awake,
boot: value.lightbar.boot,
shutdown: value.lightbar.shutdown,
sleep: value.lightbar.sleep,
},
logo: AuraPowerState {
awake: value.logo.awake,
boot: value.logo.boot,
shutdown: value.logo.shutdown,
sleep: value.logo.sleep,
},
rear_glow: AuraPowerState {
awake: value.rear_glow.awake,
boot: value.rear_glow.boot,
shutdown: value.rear_glow.shutdown,
sleep: value.rear_glow.sleep,
},
} }
} }
} }
use crate::slint_generatedMainWindow::AuraPowerDev as SlintAuraPowerDev; impl From<&AuraPowerState> for SlintAuraPowerState {
impl From<AuraPowerDev> for SlintAuraPowerDev { fn from(value: &AuraPowerState) -> Self {
fn from(value: AuraPowerDev) -> Self { let zone = value.zone.into();
let tuf: Vec<SlintAuraDevTuf> = value SlintAuraPowerState {
.tuf boot: value.boot.into(),
awake: value.awake.into(),
sleep: value.sleep.into(),
shutdown: value.shutdown.into(),
zone,
zone_name_idx: zone as i32,
}
}
}
impl From<SlintLaptopAuraPower> for rog_aura::keyboard::LaptopAuraPower {
fn from(value: SlintLaptopAuraPower) -> Self {
let mut states = Vec::new();
for state in value.states.iter() {
states.push(state.into());
}
Self { states }
}
}
impl From<LaptopAuraPower> for SlintLaptopAuraPower {
fn from(value: LaptopAuraPower) -> Self {
let converted: Vec<SlintAuraPowerState> = value
.states
.iter() .iter()
.map(|n| SlintAuraDevTuf::from(*n)) .map(|s| SlintAuraPowerState::from(s))
.collect();
let old_rog: Vec<SlintAuraDevRog1> = value
.old_rog
.iter()
.map(|n| SlintAuraDevRog1::from(*n))
.collect(); .collect();
Self { Self {
tuf: ModelRc::from(tuf.as_slice()), states: ModelRc::from(converted.as_slice()),
old_rog: ModelRc::from(old_rog.as_slice()),
rog: value.rog.into(),
}
}
}
impl From<SlintAuraPowerDev> for AuraPowerDev {
fn from(value: SlintAuraPowerDev) -> Self {
let tuf: Vec<LaptopTufAuraPower> = value.tuf.iter().map(LaptopTufAuraPower::from).collect();
let old_rog: Vec<LaptopOldAuraPower> =
value.old_rog.iter().map(LaptopOldAuraPower::from).collect();
Self {
tuf,
old_rog,
rog: value.rog.into(),
} }
} }
} }

View File

@@ -169,8 +169,8 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
let power: LaptopAuraPower = power.into(); let power: LaptopAuraPower = power.into();
tokio::spawn(async move { tokio::spawn(async move {
show_toast( show_toast(
"Anime builtin animations changed".into(), "Aura power settings changed".into(),
"Failed to set Anime builtin animations".into(), "Failed to set Aura power settings".into(),
handle_copy, handle_copy,
proxy_copy.set_led_power(power).await, proxy_copy.set_led_power(power).await,
); );

View File

@@ -2,7 +2,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-04-08 09:19+0000\n" "POT-Creation-Date: 2024-04-09 06:25+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"
@@ -12,6 +12,46 @@ msgstr ""
"Language: \n" "Language: \n"
"Plural-Forms: nplurals=1; plural=0;\n" "Plural-Forms: nplurals=1; plural=0;\n"
#: rog-control-center/ui/main_window.slint:50
msgctxt "MainWindow"
msgid "ROG"
msgstr ""
#: rog-control-center/ui/main_window.slint:52
msgctxt "Menu1"
msgid "System Control"
msgstr ""
#: rog-control-center/ui/main_window.slint:53
msgctxt "Menu2"
msgid "Keyboard Aura"
msgstr ""
#: rog-control-center/ui/main_window.slint:54
msgctxt "Menu3"
msgid "AniMe Matrix"
msgstr ""
#: rog-control-center/ui/main_window.slint:55
msgctxt "Menu4"
msgid "Fan Curves"
msgstr ""
#: rog-control-center/ui/main_window.slint:56
msgctxt "Menu5"
msgid "App Settings"
msgstr ""
#: rog-control-center/ui/main_window.slint:57
msgctxt "Menu6"
msgid "About"
msgstr ""
#: rog-control-center/ui/main_window.slint:69
msgctxt "MainWindow"
msgid "Quit"
msgstr ""
#: rog-control-center/ui/pages/anime.slint:6 #: rog-control-center/ui/pages/anime.slint:6
msgctxt "Anime Brightness" msgctxt "Anime Brightness"
msgid "Off" msgid "Off"
@@ -157,6 +197,51 @@ msgctxt "PageAppSettings"
msgid "Enable change notifications" msgid "Enable change notifications"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/aura.slint:27
msgctxt "PageAura"
msgid "Brightness"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:38
msgctxt "PageAura"
msgid "Aura mode"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:56
msgctxt "PageAura"
msgid "Colour 1"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:82
msgctxt "PageAura"
msgid "Colour 2"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:114
msgctxt "PageAura"
msgid "Zone"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:137
msgctxt "PageAura"
msgid "Direction"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:159
msgctxt "PageAura"
msgid "Speed"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:180
msgctxt "PageAura"
msgid "Power Settings"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:211
msgctxt "PageAura"
msgid "Keyboard"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:27 #: rog-control-center/ui/pages/fans.slint:27
msgctxt "FanTab" msgctxt "FanTab"
msgid "This fan is not avilable on this machine" msgid "This fan is not avilable on this machine"
@@ -362,89 +447,164 @@ msgctxt "PageSystem"
msgid "Throttle Policy on AC" msgid "Throttle Policy on AC"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/aura.slint:27 #: rog-control-center/ui/types/aura_types.slint:45
msgctxt "PageAura" msgctxt "Aura brightness"
msgid "Brightness" msgid "Off"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/aura.slint:38 #: rog-control-center/ui/types/aura_types.slint:46
msgctxt "PageAura" msgctxt "Aura brightness"
msgid "Aura mode" msgid "Low"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/aura.slint:56 #: rog-control-center/ui/types/aura_types.slint:47
msgctxt "PageAura" msgctxt "Aura brightness"
msgid "Colour 1" msgid "Med"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/aura.slint:82 #: rog-control-center/ui/types/aura_types.slint:48
msgctxt "PageAura" msgctxt "Aura brightness"
msgid "Colour 2" msgid "High"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/aura.slint:114 #: rog-control-center/ui/types/aura_types.slint:53 rog-control-center/ui/types/aura_types.slint:68
msgctxt "PageAura" msgctxt "Basic aura mode"
msgid "Zone" msgid "Static"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/aura.slint:137 #: rog-control-center/ui/types/aura_types.slint:54 rog-control-center/ui/types/aura_types.slint:69
msgctxt "PageAura" msgctxt "Basic aura mode"
msgid "Direction" msgid "Breathe"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/aura.slint:159 #: rog-control-center/ui/types/aura_types.slint:55 rog-control-center/ui/types/aura_types.slint:70
msgctxt "PageAura" msgctxt "Basic aura mode"
msgid "Speed" msgid "Strobe"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/aura.slint:180 #: rog-control-center/ui/types/aura_types.slint:56
msgctxt "PageAura" msgctxt "Basic aura mode"
msgid "Power Settings" msgid "Rainbow"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/aura.slint:211 rog-control-center/ui/pages/aura.slint:369 rog-control-center/ui/pages/aura.slint:434 #: rog-control-center/ui/types/aura_types.slint:57
msgctxt "PageAura" msgctxt "Basic aura mode"
msgid "Keyboard" msgid "Star"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/aura.slint:235 #: rog-control-center/ui/types/aura_types.slint:58
msgctxt "PageAura" msgctxt "Basic aura mode"
msgid "Lid Logo" msgid "Rain"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/aura.slint:259 #: rog-control-center/ui/types/aura_types.slint:59
msgctxt "PageAura" msgctxt "Basic aura mode"
msgid "Lightbar" msgid "Highlight"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/aura.slint:283 #: rog-control-center/ui/types/aura_types.slint:60
msgctxt "PageAura" msgctxt "Basic aura mode"
msgid "Lid Zone" msgid "Laser"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/aura.slint:307 #: rog-control-center/ui/types/aura_types.slint:61
msgctxt "PageAura" msgctxt "Basic aura mode"
msgid "Rear Glow" msgid "Ripple"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/aura.slint:375 rog-control-center/ui/pages/aura.slint:440 #: rog-control-center/ui/types/aura_types.slint:62
msgctxt "PageAura" msgctxt "Basic aura mode"
msgid "Boot" msgid "Nothing"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/aura.slint:380 rog-control-center/ui/pages/aura.slint:445 #: rog-control-center/ui/types/aura_types.slint:63
msgctxt "PageAura" msgctxt "Basic aura mode"
msgid "Awake" msgid "Pulse"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/aura.slint:385 rog-control-center/ui/pages/aura.slint:450 #: rog-control-center/ui/types/aura_types.slint:64
msgctxt "PageAura" msgctxt "Basic aura mode"
msgid "Sleep" msgid "Comet"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/aura.slint:390 rog-control-center/ui/pages/aura.slint:455 #: rog-control-center/ui/types/aura_types.slint:65
msgctxt "PageAura" msgctxt "Basic aura mode"
msgid "Shutdown" msgid "Flash"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:77
msgctxt "Aura zone"
msgid "None"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:78
msgctxt "Aura zone"
msgid "Key1"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:79
msgctxt "Aura zone"
msgid "Key2"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:80
msgctxt "Aura zone"
msgid "Key3"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:81
msgctxt "Aura zone"
msgid "Key4"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:82
msgctxt "Aura zone"
msgid "Logo"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:83
msgctxt "Aura zone"
msgid "Lightbar Left"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:84
msgctxt "Aura zone"
msgid "Lightbar Right"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:88
msgctxt "Aura direction"
msgid "Right"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:89
msgctxt "Aura direction"
msgid "Left"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:90
msgctxt "Aura direction"
msgid "Up"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:91
msgctxt "Aura direction"
msgid "Down"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:95
msgctxt "Aura speed"
msgid "Low"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:96
msgctxt "Aura speed"
msgid "Medium"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:97
msgctxt "Aura speed"
msgid "High"
msgstr "" msgstr ""
#: rog-control-center/ui/widgets/aura_power.slint:32 #: rog-control-center/ui/widgets/aura_power.slint:32
@@ -467,203 +627,3 @@ msgctxt "AuraPowerGroup"
msgid "Shutdown" msgid "Shutdown"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:68
msgctxt "Aura brightness"
msgid "Off"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:69
msgctxt "Aura brightness"
msgid "Low"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:70
msgctxt "Aura brightness"
msgid "Med"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:71
msgctxt "Aura brightness"
msgid "High"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:76 rog-control-center/ui/types/aura_types.slint:91
msgctxt "Basic aura mode"
msgid "Static"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:77 rog-control-center/ui/types/aura_types.slint:92
msgctxt "Basic aura mode"
msgid "Breathe"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:78 rog-control-center/ui/types/aura_types.slint:93
msgctxt "Basic aura mode"
msgid "Strobe"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:79
msgctxt "Basic aura mode"
msgid "Rainbow"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:80
msgctxt "Basic aura mode"
msgid "Star"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:81
msgctxt "Basic aura mode"
msgid "Rain"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:82
msgctxt "Basic aura mode"
msgid "Highlight"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:83
msgctxt "Basic aura mode"
msgid "Laser"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:84
msgctxt "Basic aura mode"
msgid "Ripple"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:85
msgctxt "Basic aura mode"
msgid "Nothing"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:86
msgctxt "Basic aura mode"
msgid "Pulse"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:87
msgctxt "Basic aura mode"
msgid "Comet"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:88
msgctxt "Basic aura mode"
msgid "Flash"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:100
msgctxt "Aura zone"
msgid "None"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:101
msgctxt "Aura zone"
msgid "Key1"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:102
msgctxt "Aura zone"
msgid "Key2"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:103
msgctxt "Aura zone"
msgid "Key3"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:104
msgctxt "Aura zone"
msgid "Key4"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:105
msgctxt "Aura zone"
msgid "Logo"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:106
msgctxt "Aura zone"
msgid "Lightbar Left"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:107
msgctxt "Aura zone"
msgid "Lightbar Right"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:111
msgctxt "Aura direction"
msgid "Right"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:112
msgctxt "Aura direction"
msgid "Left"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:113
msgctxt "Aura direction"
msgid "Up"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:114
msgctxt "Aura direction"
msgid "Down"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:118
msgctxt "Aura speed"
msgid "Low"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:119
msgctxt "Aura speed"
msgid "Medium"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:120
msgctxt "Aura speed"
msgid "High"
msgstr ""
#: rog-control-center/ui/main_window.slint:50
msgctxt "MainWindow"
msgid "ROG"
msgstr ""
#: rog-control-center/ui/main_window.slint:52
msgctxt "Menu1"
msgid "System Control"
msgstr ""
#: rog-control-center/ui/main_window.slint:53
msgctxt "Menu2"
msgid "Keyboard Aura"
msgstr ""
#: rog-control-center/ui/main_window.slint:54
msgctxt "Menu3"
msgid "AniMe Matrix"
msgstr ""
#: rog-control-center/ui/main_window.slint:55
msgctxt "Menu4"
msgid "Fan Curves"
msgstr ""
#: rog-control-center/ui/main_window.slint:56
msgctxt "Menu5"
msgid "App Settings"
msgstr ""
#: rog-control-center/ui/main_window.slint:57
msgctxt "Menu6"
msgid "About"
msgstr ""
#: rog-control-center/ui/main_window.slint:69
msgctxt "MainWindow"
msgid "Quit"
msgstr ""

View File

@@ -10,8 +10,8 @@ import { Node } from "widgets/graph.slint";
export { Node } export { Node }
import { FanPageData, FanType, Profile } from "types/fan_types.slint"; import { FanPageData, FanType, Profile } from "types/fan_types.slint";
export { FanPageData, FanType, Profile } export { FanPageData, FanType, Profile }
import { AuraPageData, AuraDevType, AuraDevTuf, AuraDevRog1, PowerZones, KbAuraPowerState, AuraPowerDev, AuraEffect } from "types/aura_types.slint"; import { AuraPageData, AuraDevType, LaptopAuraPower, AuraPowerState, PowerZones, AuraEffect } from "types/aura_types.slint";
export { AuraPageData, AuraDevType, AuraDevTuf, AuraDevRog1, PowerZones, KbAuraPowerState, AuraPowerDev, AuraEffect } export { AuraPageData, AuraDevType, LaptopAuraPower, AuraPowerState, PowerZones, AuraEffect }
import { PageAppSettings, AppSettingsPageData } from "pages/app_settings.slint"; import { PageAppSettings, AppSettingsPageData } from "pages/app_settings.slint";
export { AppSize, AvailableSystemProperties, SystemPageData, AnimePageData, AppSettingsPageData } export { AppSize, AvailableSystemProperties, SystemPageData, AnimePageData, AppSettingsPageData }

View File

@@ -2,7 +2,7 @@ import { SystemDropdown, RogItem, SystemToggle, SystemToggleVert } from "../widg
import { Palette, Button, ComboBox, VerticalBox, GroupBox } from "std-widgets.slint"; import { Palette, Button, ComboBox, VerticalBox, GroupBox } from "std-widgets.slint";
import { StyleMetrics, Slider, HorizontalBox, TextEdit, SpinBox, LineEdit, ScrollView } from "std-widgets.slint"; import { StyleMetrics, Slider, HorizontalBox, TextEdit, SpinBox, LineEdit, ScrollView } from "std-widgets.slint";
import { ColourSlider } from "../widgets/colour_picker.slint"; import { ColourSlider } from "../widgets/colour_picker.slint";
import { AuraPageData, AuraDevType, AuraDevTuf, AuraDevRog1, PowerZones, KbAuraPowerState, AuraPowerDev, AuraEffect } from "../types/aura_types.slint"; import { AuraPageData, AuraDevType, PowerZones, LaptopAuraPower, AuraEffect } from "../types/aura_types.slint";
import { AuraPowerGroup } from "../widgets/aura_power.slint"; import { AuraPowerGroup } from "../widgets/aura_power.slint";
export component PageAura inherits Rectangle { export component PageAura inherits Rectangle {
@@ -206,268 +206,42 @@ export component PageAura inherits Rectangle {
padding: 30px; padding: 30px;
padding-top: 10px; padding-top: 10px;
spacing: 10px; spacing: 10px;
for power in AuraPageData.supported_power_zones: gr := HorizontalLayout {
if power == PowerZones.Keyboard: zone1 := AuraPowerGroup {
group-title: @tr("Keyboard");
boot_checked: AuraPageData.led_power.rog.keyboard.boot;
boot_toggled => {
AuraPageData.led_power.rog.keyboard.boot = zone1.boot_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
awake_checked: AuraPageData.led_power.rog.keyboard.awake;
awake_toggled => {
AuraPageData.led_power.rog.keyboard.awake = zone1.awake_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
sleep_checked: AuraPageData.led_power.rog.keyboard.sleep;
sleep_toggled => {
AuraPageData.led_power.rog.keyboard.sleep = zone1.sleep_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
shutdown_checked: AuraPageData.led_power.rog.keyboard.shutdown;
shutdown_toggled => {
AuraPageData.led_power.rog.keyboard.shutdown = zone1.shutdown_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
}
if power == PowerZones.Logo: zone2 := AuraPowerGroup { for state[idx] in AuraPageData.led_power.states: zone := AuraPowerGroup {
group-title: @tr("Lid Logo"); group-title: AuraPageData.power_zone_names[state.zone_name_idx];
boot_checked: AuraPageData.led_power.rog.logo.boot; // TODO: use the zone name
boot_toggled => { boot_checked: state.boot;
AuraPageData.led_power.rog.logo.boot = zone2.boot_checked; boot_toggled => {
AuraPageData.set_led_power(AuraPageData.led_power); AuraPageData.led_power.states[idx].boot = zone.boot_checked;
} AuraPageData.set_led_power(AuraPageData.led_power);
awake_checked: AuraPageData.led_power.rog.logo.awake;
awake_toggled => {
AuraPageData.led_power.rog.logo.awake = zone2.awake_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
sleep_checked: AuraPageData.led_power.rog.logo.sleep;
sleep_toggled => {
AuraPageData.led_power.rog.logo.sleep = zone2.sleep_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
shutdown_checked: AuraPageData.led_power.rog.logo.shutdown;
shutdown_toggled => {
AuraPageData.led_power.rog.logo.shutdown = zone2.shutdown_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
} }
awake_checked: state.awake;
if power == PowerZones.Lightbar: zone3 := AuraPowerGroup { awake_toggled => {
group-title: @tr("Lightbar"); AuraPageData.led_power.states[idx].awake = zone.awake_checked;
boot_checked: AuraPageData.led_power.rog.lightbar.boot; AuraPageData.set_led_power(AuraPageData.led_power);
boot_toggled => {
AuraPageData.led_power.rog.lightbar.boot = zone3.boot_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
awake_checked: AuraPageData.led_power.rog.lightbar.awake;
awake_toggled => {
AuraPageData.led_power.rog.lightbar.awake = zone3.awake_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
sleep_checked: AuraPageData.led_power.rog.lightbar.sleep;
sleep_toggled => {
AuraPageData.led_power.rog.lightbar.sleep = zone3.sleep_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
shutdown_checked: AuraPageData.led_power.rog.lightbar.shutdown;
shutdown_toggled => {
AuraPageData.led_power.rog.lightbar.shutdown = zone3.shutdown_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
} }
sleep_checked: state.sleep;
if power == PowerZones.Lid: zone4 := AuraPowerGroup { sleep_toggled => {
group-title: @tr("Lid Zone"); AuraPageData.led_power.states[idx].sleep = zone.sleep_checked;
boot_checked: AuraPageData.led_power.rog.lid.boot; AuraPageData.set_led_power(AuraPageData.led_power);
boot_toggled => {
AuraPageData.led_power.rog.lid.boot = zone4.boot_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
awake_checked: AuraPageData.led_power.rog.lid.awake;
awake_toggled => {
AuraPageData.led_power.rog.lid.awake = zone4.awake_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
sleep_checked: AuraPageData.led_power.rog.lid.sleep;
sleep_toggled => {
AuraPageData.led_power.rog.lid.sleep = zone4.sleep_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
shutdown_checked: AuraPageData.led_power.rog.lid.shutdown;
shutdown_toggled => {
AuraPageData.led_power.rog.lid.shutdown = zone4.shutdown_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
} }
shutdown_checked: state.shutdown;
if power == PowerZones.RearGlow: zone5 := AuraPowerGroup { shutdown_toggled => {
group-title: @tr("Rear Glow"); AuraPageData.led_power.states[idx].shutdown = zone.shutdown_checked;
boot_checked: AuraPageData.led_power.rog.rear-glow.boot; AuraPageData.set_led_power(AuraPageData.led_power);
boot_toggled => {
AuraPageData.led_power.rog.rear-glow.boot = zone5.boot_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
awake_checked: AuraPageData.led_power.rog.rear-glow.awake;
awake_toggled => {
AuraPageData.led_power.rog.rear-glow.awake = zone5.awake_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
sleep_checked: AuraPageData.led_power.rog.rear-glow.sleep;
sleep_toggled => {
AuraPageData.led_power.rog.rear-glow.sleep = zone5.sleep_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
shutdown_checked: AuraPageData.led_power.rog.rear-glow.shutdown;
shutdown_toggled => {
AuraPageData.led_power.rog.rear-glow.shutdown = zone5.shutdown_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
} }
} }
} }
}
Button { Button {
x: root.width - self.width - 6px; x: root.width - self.width - 6px;
y: 6px; y: 6px;
text: "X"; text: "X";
height: 40px; height: 40px;
clicked => { clicked => {
root.show_aura_power = false; root.show_aura_power = false;
root.show_fade_cover = false; root.show_fade_cover = false;
}
}
}
if root.show_aura_power && AuraPageData.aura_type == AuraDevType.Old: Rectangle {
width: 100%;
height: 100%;
opacity: 1;
ScrollView {
VerticalLayout {
padding: 30px;
padding-top: 10px;
spacing: 10px;
Text {
text: "WIP: this is not complete and won't change keyboard state";
} }
Rectangle {
border-radius: 20px;
background: Palette.control-background;
VerticalBox {
spacing: 10px;
alignment: LayoutAlignment.start;
Text {
font-size: 18px;
color: Palette.control-foreground;
horizontal-alignment: TextHorizontalAlignment.center;
text: @tr("Keyboard");
}
HorizontalBox {
SystemToggleVert {
max-height: 42px;
text: @tr("Boot");
}
SystemToggleVert {
max-height: 42px;
text: @tr("Awake");
}
SystemToggleVert {
max-height: 42px;
text: @tr("Sleep");
}
SystemToggleVert {
max-height: 42px;
text: @tr("Shutdown");
}
}
}
}
}
}
Button {
x: root.width - self.width - 6px;
y: 6px;
text: "X";
height: 40px;
clicked => {
root.show_aura_power = false;
root.show_fade_cover = false;
}
}
}
if root.show_aura_power && AuraPageData.aura_type == AuraDevType.Tuf: Rectangle {
width: 100%;
height: 100%;
opacity: 1;
ScrollView {
VerticalLayout {
padding: 30px;
padding-top: 10px;
spacing: 10px;
Text {
text: "WIP: this is not complete and won't change keyboard state";
}
Rectangle {
border-radius: 20px;
background: Palette.control-background;
VerticalBox {
spacing: 10px;
alignment: LayoutAlignment.start;
Text {
font-size: 18px;
color: Palette.control-foreground;
horizontal-alignment: TextHorizontalAlignment.center;
text: @tr("Keyboard");
}
HorizontalBox {
SystemToggleVert {
max-height: 42px;
text: @tr("Boot");
}
SystemToggleVert {
max-height: 42px;
text: @tr("Awake");
}
SystemToggleVert {
max-height: 42px;
text: @tr("Sleep");
}
SystemToggleVert {
max-height: 42px;
text: @tr("Shutdown");
}
}
}
}
}
}
Button {
x: root.width - self.width - 6px;
y: 6px;
text: "X";
height: 40px;
clicked => {
root.show_aura_power = false;
root.show_fade_cover = false;
} }
} }
} }

View File

@@ -1,7 +1,7 @@
export enum AuraDevType { export enum AuraDevType {
Tuf,
Old,
New, New,
Old,
Tuf,
} }
export struct AuraEffect { export struct AuraEffect {
@@ -19,51 +19,37 @@ export struct AuraEffect {
direction: int, direction: int,
} }
export enum AuraDevTuf {
Boot,
Awake,
Sleep,
Keyboard,
}
export enum AuraDevRog1 {
Awake,
Keyboard,
Lightbar,
Boot,
Sleep,
}
export enum PowerZones { export enum PowerZones {
Logo, Logo,
Keyboard, Keyboard,
Lightbar, Lightbar,
Lid, Lid,
RearGlow, RearGlow,
KeyboardAndLightbar
} }
export struct KbAuraPowerState { export struct AuraPowerState {
zone: PowerZones,
zone_name_idx: int,
boot: bool, boot: bool,
awake: bool, awake: bool,
sleep: bool, sleep: bool,
shutdown: bool, shutdown: bool,
} }
export struct AuraPower { export struct LaptopAuraPower {
keyboard: KbAuraPowerState, states: [AuraPowerState],
logo: KbAuraPowerState,
lightbar: KbAuraPowerState,
lid: KbAuraPowerState,
rear_glow: KbAuraPowerState,
}
export struct AuraPowerDev {
tuf: [AuraDevTuf],
old_rog: [AuraDevRog1],
rog: AuraPower,
} }
export global AuraPageData { export global AuraPageData {
in-out property <[string]> power_zone_names: [
@tr("Aura power zone" => "Logo"),
@tr("Aura power zone" => "Keyboard"),
@tr("Aura power zone" => "Lightbar"),
@tr("Aura power zone" => "Lid"),
@tr("Aura power zone" => "Rear Glow"),
@tr("Aura power zone" => "Keyboard and Lightbar"),
];
in-out property <[string]> brightness_names: [ in-out property <[string]> brightness_names: [
@tr("Aura brightness" => "Off"), @tr("Aura brightness" => "Off"),
@tr("Aura brightness" => "Low"), @tr("Aura brightness" => "Low"),
@@ -157,6 +143,14 @@ export global AuraPageData {
PowerZones.Lightbar, PowerZones.Lightbar,
PowerZones.Logo PowerZones.Logo
]; ];
in-out property <AuraPowerDev> led_power; in-out property <LaptopAuraPower> led_power: {
callback set_led_power(AuraPowerDev); states: [{
zone: PowerZones.Keyboard,
boot: true,
awake: true,
sleep: true,
shutdown: true,
}]
};
callback set_led_power(LaptopAuraPower);
} }

View File

@@ -24,8 +24,7 @@ use std::collections::BTreeMap;
use rog_aura::aura_detection::PowerZones; use rog_aura::aura_detection::PowerZones;
use rog_aura::keyboard::{LaptopAuraPower, UsbPackets}; use rog_aura::keyboard::{LaptopAuraPower, UsbPackets};
use rog_aura::usb::AuraDevice; use rog_aura::{AuraDeviceType, AuraEffect, AuraModeNum, AuraZone, LedBrightness};
use rog_aura::{AuraEffect, AuraModeNum, AuraZone, LedBrightness};
use zbus::blocking::Connection; use zbus::blocking::Connection;
use zbus::{proxy, Result}; use zbus::{proxy, Result};
@@ -51,7 +50,7 @@ trait Aura {
/// DeviceType property /// DeviceType property
#[zbus(property)] #[zbus(property)]
fn device_type(&self) -> zbus::Result<AuraDevice>; fn device_type(&self) -> zbus::Result<AuraDeviceType>;
/// LedMode property /// LedMode property
#[zbus(property)] #[zbus(property)]

View File

@@ -1,23 +1,16 @@
use std::error::Error; use std::error::Error;
use rog_aura::usb::AuraDevice;
use rog_platform::hid_raw::HidRaw; use rog_platform::hid_raw::HidRaw;
pub fn main() -> Result<(), Box<dyn Error>> { pub fn main() -> Result<(), Box<dyn Error>> {
let mut usb_node = None; let mut usb_node = None;
let prod = AuraDevice::X1abe; match HidRaw::new("1abe") {
match HidRaw::new(prod.into()) {
Ok(node) => { Ok(node) => {
let id = node.prod_id().to_owned();
usb_node = Some(node); usb_node = Some(node);
println!( println!("Looked for keyboard controller 0x{}: Found", id);
"Looked for keyboard controller 0x{}: Found",
<&str>::from(prod)
);
} }
Err(err) => println!( Err(err) => println!("Looked for keyboard controller: {err}"),
"Looked for keyboard controller 0x{}: {err}",
<&str>::from(prod)
),
} }
if usb_node.is_none() { if usb_node.is_none() {

View File

@@ -2,24 +2,17 @@ use std::error::Error;
use std::thread::sleep; use std::thread::sleep;
use std::time::Duration; use std::time::Duration;
use rog_aura::usb::AuraDevice;
use rog_platform::hid_raw::HidRaw; use rog_platform::hid_raw::HidRaw;
pub fn main() -> Result<(), Box<dyn Error>> { pub fn main() -> Result<(), Box<dyn Error>> {
let mut usb_node = None; let mut usb_node = None;
let prod = AuraDevice::X1abe; match HidRaw::new("1abe") {
match HidRaw::new(prod.into()) {
Ok(node) => { Ok(node) => {
let id = node.prod_id().to_owned();
usb_node = Some(node); usb_node = Some(node);
println!( println!("Looked for keyboard controller 0x{}: Found", id);
"Looked for keyboard controller 0x{}: Found",
<&str>::from(prod)
);
} }
Err(err) => println!( Err(err) => println!("Looked for keyboard controller: {err}"),
"Looked for keyboard controller 0x{}: {err}",
<&str>::from(prod)
),
} }
if usb_node.is_none() { if usb_node.is_none() {

View File

@@ -1,23 +1,16 @@
use std::error::Error; use std::error::Error;
use rog_aura::usb::AuraDevice;
use rog_platform::hid_raw::HidRaw; use rog_platform::hid_raw::HidRaw;
pub fn main() -> Result<(), Box<dyn Error>> { pub fn main() -> Result<(), Box<dyn Error>> {
let mut usb_node = None; let mut usb_node = None;
let prod = AuraDevice::X1abe; match HidRaw::new("1abe") {
match HidRaw::new(prod.into()) {
Ok(node) => { Ok(node) => {
let id = node.prod_id().to_owned();
usb_node = Some(node); usb_node = Some(node);
println!( println!("Looked for keyboard controller 0x{}: Found", id);
"Looked for keyboard controller 0x{}: Found",
<&str>::from(prod)
);
} }
Err(err) => println!( Err(err) => println!("Looked for keyboard controller: {err}"),
"Looked for keyboard controller 0x{}: {err}",
<&str>::from(prod)
),
} }
if usb_node.is_none() { if usb_node.is_none() {