Reformat with trailing comma

This commit is contained in:
Luke Jones
2025-02-14 16:06:20 +13:00
parent 0bdf0474c9
commit 2c006699f2
113 changed files with 791 additions and 792 deletions

View File

@@ -5,7 +5,7 @@ use log::{debug, info, warn};
use rog_aura::aura_detection::LedSupportData;
use rog_aura::keyboard::LaptopAuraPower;
use rog_aura::{
AuraDeviceType, AuraEffect, AuraModeNum, AuraZone, Direction, LedBrightness, Speed, GRADIENT
AuraDeviceType, AuraEffect, AuraModeNum, AuraZone, Direction, LedBrightness, Speed, GRADIENT,
};
use serde::{Deserialize, Serialize};
@@ -29,7 +29,7 @@ pub struct AuraConfig {
pub multizone_on: bool,
pub enabled: LaptopAuraPower,
#[serde(skip)]
pub per_key_mode_active: bool
pub per_key_mode_active: bool,
}
impl StdConfig for AuraConfig {
@@ -74,7 +74,7 @@ impl AuraConfig {
multizone: None,
multizone_on: false,
enabled,
per_key_mode_active: false
per_key_mode_active: false,
};
for n in &config.support_data.basic_modes {
@@ -92,7 +92,7 @@ impl AuraConfig {
colour1: *GRADIENT.get(i).unwrap_or(&GRADIENT[0]),
colour2: *GRADIENT.get(GRADIENT.len() - i).unwrap_or(&GRADIENT[6]),
speed: Speed::Med,
direction: Direction::Left
direction: Direction::Left,
});
}
if let Some(m) = config.multizone.as_mut() {
@@ -156,7 +156,7 @@ impl AuraConfig {
colour1: *GRADIENT.get(i).unwrap_or(&GRADIENT[0]),
colour2: *GRADIENT.get(GRADIENT.len() - i).unwrap_or(&GRADIENT[6]),
speed: Speed::Med,
direction: Direction::Left
direction: Direction::Left,
});
}
if default.is_empty() {
@@ -232,7 +232,7 @@ impl AuraConfig {
mod tests {
use rog_aura::keyboard::AuraPowerState;
use rog_aura::{
AuraEffect, AuraModeNum, AuraZone, Colour, Direction, LedBrightness, PowerZones, Speed
AuraEffect, AuraModeNum, AuraZone, Colour, Direction, LedBrightness, PowerZones, Speed,
};
use super::AuraConfig;
@@ -246,7 +246,7 @@ mod tests {
colour1: Colour {
r: 0xff,
g: 0x00,
b: 0xff
b: 0xff,
},
zone: AuraZone::Key1,
..Default::default()
@@ -259,7 +259,7 @@ mod tests {
colour1: Colour {
r: 0x00,
g: 0xff,
b: 0xff
b: 0xff,
},
zone: AuraZone::Key2,
..Default::default()
@@ -270,7 +270,7 @@ mod tests {
colour1: Colour {
r: 0xff,
g: 0xff,
b: 0x00
b: 0x00,
},
zone: AuraZone::Key3,
..Default::default()
@@ -281,7 +281,7 @@ mod tests {
colour1: Colour {
r: 0x00,
g: 0xff,
b: 0x00
b: 0x00,
},
zone: AuraZone::Key4,
..Default::default()

View File

@@ -19,7 +19,7 @@ pub mod trait_impls;
pub struct Aura {
pub hid: Option<Arc<Mutex<HidRaw>>>,
pub backlight: Option<Arc<Mutex<KeyboardBacklight>>>,
pub config: Arc<Mutex<AuraConfig>>
pub config: Arc<Mutex<AuraConfig>>,
}
impl Aura {
@@ -91,13 +91,13 @@ impl Aura {
pub async fn write_effect_and_apply(
&self,
dev_type: AuraDeviceType,
mode: &AuraEffect
mode: &AuraEffect,
) -> Result<(), RogError> {
if matches!(dev_type, AuraDeviceType::LaptopKeyboardTuf) {
if let Some(platform) = &self.backlight {
let buf = [
1, mode.mode as u8, mode.colour1.r, mode.colour1.g, mode.colour1.b,
mode.speed as u8
mode.speed as u8,
];
platform.lock().await.set_kbd_rgb_mode(&buf)?;
}
@@ -121,7 +121,7 @@ impl Aura {
return Ok(());
}
Err(RogError::MissingFunction(
"No LED backlight control available".to_string()
"No LED backlight control available".to_string(),
))
}
@@ -145,7 +145,7 @@ impl Aura {
0x01,
p.new_to_byte() as u8,
0x0,
0x0
0x0,
];
hid_raw.write_bytes(&msg)?;
return Ok(());
@@ -154,7 +154,7 @@ impl Aura {
let bytes = config.enabled.to_bytes(config.led_type);
let msg = [
0x5d, 0xbd, 0x01, bytes[0], bytes[1], bytes[2], bytes[3]
0x5d, 0xbd, 0x01, bytes[0], bytes[1], bytes[2], bytes[3],
];
hid_raw.write_bytes(&msg)?;
}
@@ -167,7 +167,7 @@ impl Aura {
pub async fn write_effect_block(
&self,
config: &mut AuraConfig,
effect: &AuraLaptopUsbPackets
effect: &AuraLaptopUsbPackets,
) -> Result<(), RogError> {
if config.brightness == LedBrightness::Off {
config.brightness = LedBrightness::Med;
@@ -201,7 +201,7 @@ impl Aura {
let g = row[10];
let b = row[11];
tuf.lock().await.set_kbd_rgb_mode(&[
0, 0, r, g, b, 0
0, 0, r, g, b, 0,
])?;
}
}
@@ -215,7 +215,7 @@ impl Aura {
let mut config = self.config.lock().await;
if config.ally_fix.is_none() {
let msg = [
0x5d, 0xbd, 0x01, 0xff, 0xff, 0xff, 0xff
0x5d, 0xbd, 0x01, 0xff, 0xff, 0xff, 0xff,
];
hid_raw.lock().await.write_bytes(&msg)?;
info!("Reset Ally power settings to base");

View File

@@ -28,7 +28,7 @@ impl AuraZbus {
mut self,
connection: &Connection,
// _signal_ctx: SignalEmitter<'static>,
path: OwnedObjectPath
path: OwnedObjectPath,
) -> Result<(), RogError> {
// let task = zbus.clone();
// let signal_ctx = signal_ctx.clone();
@@ -144,7 +144,7 @@ impl AuraZbus {
let mode = config.current_mode;
match config.builtins.get(&mode) {
Some(effect) => Ok(effect.clone()),
None => Err(ZbErr::Failed("Could not get the current effect".into()))
None => Err(ZbErr::Failed("Could not get the current effect".into())),
}
} else {
Err(ZbErr::Failed("Aura control couldn't lock self".to_string()))
@@ -297,7 +297,7 @@ impl CtrlTask for AuraZbus {
move |_power_plugged| {
// power change
async move {}
}
},
)
.await;