mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Fix: non-rgb keyboard backlight control
This commit is contained in:
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
# [3.2.2] - 2021-03-23
|
||||||
|
### Changed
|
||||||
|
- Fix brightness control, again, for non-RGB keyboards
|
||||||
|
|
||||||
# [3.2.1] - 2021-03-21
|
# [3.2.1] - 2021-03-21
|
||||||
### Changed
|
### Changed
|
||||||
- Fix brightness control
|
- Fix brightness control
|
||||||
|
|||||||
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -196,7 +196,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "daemon"
|
name = "daemon"
|
||||||
version = "3.2.1"
|
version = "3.2.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"intel-pstate",
|
"intel-pstate",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "daemon"
|
name = "daemon"
|
||||||
version = "3.2.1"
|
version = "3.2.2"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = ["Luke <luke@ljones.dev>"]
|
authors = ["Luke <luke@ljones.dev>"]
|
||||||
|
|||||||
@@ -37,14 +37,10 @@ impl GetSupported for CtrlKbdBacklight {
|
|||||||
let multizone_led_mode = false;
|
let multizone_led_mode = false;
|
||||||
let per_key_led_mode = false;
|
let per_key_led_mode = false;
|
||||||
let laptop = LaptopLedData::get_data();
|
let laptop = LaptopLedData::get_data();
|
||||||
let stock_led_modes = if let Some(data) = laptop {
|
let stock_led_modes = if laptop.standard.is_empty() {
|
||||||
if data.standard.is_empty() {
|
|
||||||
None
|
|
||||||
} else {
|
|
||||||
Some(data.standard)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
None
|
None
|
||||||
|
} else {
|
||||||
|
Some(laptop.standard)
|
||||||
};
|
};
|
||||||
|
|
||||||
LedSupportedFunctions {
|
LedSupportedFunctions {
|
||||||
|
|||||||
@@ -135,23 +135,20 @@ fn start_daemon() -> Result<(), Box<dyn Error>> {
|
|||||||
DbusFanAndCpu::new(tmp).add_to_server(&mut object_server);
|
DbusFanAndCpu::new(tmp).add_to_server(&mut object_server);
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(laptop) = LaptopLedData::get_data() {
|
let laptop = LaptopLedData::get_data();
|
||||||
if !laptop.standard.is_empty() {
|
let aura_config = AuraConfig::load(&laptop);
|
||||||
let aura_config = AuraConfig::load(&laptop);
|
if let Ok(ctrl) = CtrlKbdBacklight::new(
|
||||||
|
laptop,
|
||||||
if let Ok(ctrl) = CtrlKbdBacklight::new(
|
aura_config,
|
||||||
laptop,
|
)
|
||||||
aura_config,
|
.map_err(|err| {
|
||||||
)
|
error!("Keyboard control: {}", err);
|
||||||
.map_err(|err| {
|
err
|
||||||
error!("Keyboard control: {}", err);
|
}) {
|
||||||
err
|
let tmp = Arc::new(Mutex::new(ctrl));
|
||||||
}) {
|
DbusKbdBacklight::new(tmp.clone()).add_to_server(&mut object_server);
|
||||||
let tmp = Arc::new(Mutex::new(ctrl));
|
tasks.push(tmp);
|
||||||
DbusKbdBacklight::new(tmp.clone()).add_to_server(&mut object_server);
|
}
|
||||||
tasks.push(tmp);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
|
|
||||||
// TODO: implement messaging between threads to check fails
|
// TODO: implement messaging between threads to check fails
|
||||||
// These tasks generally read a sys path or file to check for a
|
// These tasks generally read a sys path or file to check for a
|
||||||
|
|||||||
@@ -49,15 +49,24 @@ pub struct LaptopLedData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl LaptopLedData {
|
impl LaptopLedData {
|
||||||
pub fn get_data() -> Option<Self> {
|
pub fn get_data() -> Self {
|
||||||
let dmi = sysfs_class::DmiId::default();
|
let dmi = sysfs_class::DmiId::default();
|
||||||
let board_name = dmi.board_name().expect("Could not get board_name");
|
let board_name = dmi.board_name().expect("Could not get board_name");
|
||||||
let prod_family = dmi.product_family().expect("Could not get product_family");
|
let prod_family = dmi.product_family().expect("Could not get product_family");
|
||||||
|
|
||||||
if let Some(modes) = LedSupportFile::load_from_config() {
|
if let Some(modes) = LedSupportFile::load_from_config() {
|
||||||
return modes.matcher(&prod_family, &board_name);
|
if let Some(data) = modes.matcher(&prod_family, &board_name) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
info!("Using generic LED control for keyboard brightness only");
|
||||||
|
LaptopLedData {
|
||||||
|
prod_family,
|
||||||
|
board_names: vec![board_name],
|
||||||
|
standard: vec![],
|
||||||
|
multizone: false,
|
||||||
|
per_key: false,
|
||||||
}
|
}
|
||||||
None
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user