Better handling of supergfx version check, aura config updates

This commit is contained in:
Luke D. Jones
2023-04-25 13:56:00 +12:00
parent 45a354880a
commit 8db783d9b4
8 changed files with 146 additions and 158 deletions

View File

@@ -111,7 +111,7 @@ impl From<&AuraPowerConfig> for AuraPowerDev {
}
}
#[derive(Deserialize, Serialize, Debug)]
#[derive(Deserialize, Serialize, Debug, Clone)]
// #[serde(default)]
pub struct AuraConfig {
pub brightness: LedBrightness,
@@ -124,7 +124,8 @@ pub struct AuraConfig {
impl StdConfig for AuraConfig {
fn new() -> Self {
Self::create_default(AuraDevice::X19b6, &LaptopLedData::get_data())
// Self::create_default(AuraDevice::X19b6, &LaptopLedData::get_data())
panic!("AuraConfig::new() should not be used, use AuraConfig::create_default() instead");
}
fn config_dir() -> std::path::PathBuf {

View File

@@ -114,7 +114,15 @@ impl CtrlKbdLed {
LEDNode::None
};
let config = AuraConfig::create_default(led_prod, &supported_modes).load();
let config_init = AuraConfig::create_default(led_prod, &supported_modes);
let mut config = config_init.clone().load();
// Do updates of supported modes if required
for mode in &config_init.builtins {
if !config.builtins.contains_key(mode.0) {
config.builtins.insert(*mode.0, mode.1.clone());
}
}
let ctrl = CtrlKbdLed {
led_prod,
led_node, // on TUF this is the same as rgb_led / kd_brightness