Aura: add support for Rear Glow power modes

This commit is contained in:
Luke D. Jones
2023-06-18 19:48:08 +12:00
parent 68ee62fef1
commit 04543eeca0
7 changed files with 123 additions and 28 deletions

View File

@@ -20,9 +20,9 @@ pub enum AuraPowerConfig {
impl AuraPowerConfig {
/// Invalid for TUF laptops
pub fn to_bytes(control: &Self) -> [u8; 3] {
pub fn to_bytes(control: &Self) -> [u8; 4] {
match control {
AuraPowerConfig::AuraDevTuf(_) => [0, 0, 0],
AuraPowerConfig::AuraDevTuf(_) => [0, 0, 0, 0],
AuraPowerConfig::AuraDevRog1(c) => {
let c: Vec<AuraDevRog1> = c.iter().copied().collect();
AuraDevRog1::to_bytes(&c)
@@ -156,6 +156,10 @@ impl AuraConfig {
AuraDevRog2::AwakeBar,
AuraDevRog2::SleepBar,
AuraDevRog2::ShutdownBar,
AuraDevRog2::BootRearGlow,
AuraDevRog2::AwakeRearGlow,
AuraDevRog2::SleepRearGlow,
AuraDevRog2::ShutdownRearGlow,
]))
} else if prod_id == AuraDevice::Tuf {
AuraPowerConfig::AuraDevTuf(HashSet::from([

View File

@@ -200,7 +200,7 @@ impl CtrlKbdLed {
}
} else if let LEDNode::Rog(hid_raw) = &self.led_node {
let bytes = AuraPowerConfig::to_bytes(&self.config.enabled);
let message = [0x5d, 0xbd, 0x01, bytes[0], bytes[1], bytes[2]];
let message = [0x5d, 0xbd, 0x01, bytes[0], bytes[1], bytes[2], bytes[3]];
hid_raw.write_bytes(&message)?;
hid_raw.write_bytes(&LED_SET)?;

View File

@@ -78,6 +78,10 @@ impl CtrlKbdLedZbus {
/// BootBar,
/// SleepBar,
/// ShutdownBar,
/// BootRearBar,
/// AwakeRearBar,
/// SleepRearBar,
/// ShutdownRearBar,
/// }
/// ```
async fn set_leds_power(