mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Compare commits
5 Commits
8551908452
...
a4957a6eeb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4957a6eeb | ||
|
|
dda750cf33 | ||
|
|
0b5e04393a | ||
|
|
c9c9a022a4 | ||
|
|
aa063c20fd |
@@ -4,6 +4,9 @@
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Added support for TUF keyboard powerstate control
|
- Added support for TUF keyboard powerstate control
|
||||||
|
- Improved AniMe Matrix support thanks to @Seom1177 !
|
||||||
|
- Fixed a bug with one-shot battery change, thanks @bitr8 !
|
||||||
|
|
||||||
|
|
||||||
## [6.2.0]
|
## [6.2.0]
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,12 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
const CONFIG_FILE: &str = "asusd.ron";
|
const CONFIG_FILE: &str = "asusd.ron";
|
||||||
|
|
||||||
|
/// Default value for base_charge_control_end_threshold when not present in config.
|
||||||
|
/// Returns 0 so restore_charge_limit() skips restoration for upgraded configs.
|
||||||
|
fn default_base_charge_limit() -> u8 {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Default, Clone, Deserialize, Serialize, PartialEq)]
|
#[derive(Default, Clone, Deserialize, Serialize, PartialEq)]
|
||||||
pub struct Tuning {
|
pub struct Tuning {
|
||||||
pub enabled: bool,
|
pub enabled: bool,
|
||||||
@@ -19,8 +25,8 @@ type Tunings = HashMap<PlatformProfile, Tuning>;
|
|||||||
pub struct Config {
|
pub struct Config {
|
||||||
// The current charge limit applied
|
// The current charge limit applied
|
||||||
pub charge_control_end_threshold: u8,
|
pub charge_control_end_threshold: u8,
|
||||||
/// Save charge limit for restoring
|
/// Save charge limit for restoring after one-shot full charge
|
||||||
#[serde(skip)]
|
#[serde(default = "default_base_charge_limit")]
|
||||||
pub base_charge_control_end_threshold: u8,
|
pub base_charge_control_end_threshold: u8,
|
||||||
pub disable_nvidia_powerd_on_battery: bool,
|
pub disable_nvidia_powerd_on_battery: bool,
|
||||||
/// An optional command/script to run when power is changed to AC
|
/// An optional command/script to run when power is changed to AC
|
||||||
@@ -86,6 +92,9 @@ impl Default for Config {
|
|||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
charge_control_end_threshold: 100,
|
charge_control_end_threshold: 100,
|
||||||
|
// NOTE: This is intentionally 100 (not 0 like the serde default).
|
||||||
|
// New installs get 100 (no limit). Upgraded configs missing this
|
||||||
|
// field get 0 via serde, which skips restore_charge_limit().
|
||||||
base_charge_control_end_threshold: 100,
|
base_charge_control_end_threshold: 100,
|
||||||
disable_nvidia_powerd_on_battery: true,
|
disable_nvidia_powerd_on_battery: true,
|
||||||
ac_command: Default::default(),
|
ac_command: Default::default(),
|
||||||
|
|||||||
@@ -12,12 +12,13 @@ use crate::usb::{PROD_ID1, PROD_ID1_STR, PROD_ID2, PROD_ID2_STR};
|
|||||||
|
|
||||||
#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, Deserialize, Serialize)]
|
#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, Deserialize, Serialize)]
|
||||||
pub enum SlashType {
|
pub enum SlashType {
|
||||||
GA403,
|
GA403_2024,
|
||||||
GA403W,
|
GA403_2025,
|
||||||
GA605,
|
GA605_2024,
|
||||||
GU605,
|
GA605_2025,
|
||||||
GU605C,
|
GU605_2024,
|
||||||
G614F,
|
GU605_2025,
|
||||||
|
G614_2025,
|
||||||
#[default]
|
#[default]
|
||||||
Unsupported,
|
Unsupported,
|
||||||
}
|
}
|
||||||
@@ -25,24 +26,26 @@ pub enum SlashType {
|
|||||||
impl SlashType {
|
impl SlashType {
|
||||||
pub const fn prod_id(&self) -> u16 {
|
pub const fn prod_id(&self) -> u16 {
|
||||||
match self {
|
match self {
|
||||||
SlashType::GA403W => PROD_ID2,
|
SlashType::GA403_2025 => PROD_ID2,
|
||||||
SlashType::GA403 => PROD_ID1,
|
SlashType::GA403_2024 => PROD_ID1,
|
||||||
SlashType::GA605 => PROD_ID2,
|
SlashType::GA605_2025 => PROD_ID2,
|
||||||
SlashType::GU605 => PROD_ID1,
|
SlashType::GA605_2024 => PROD_ID2,
|
||||||
SlashType::GU605C => PROD_ID2,
|
SlashType::GU605_2025 => PROD_ID2,
|
||||||
SlashType::G614F => PROD_ID2,
|
SlashType::GU605_2024 => PROD_ID1,
|
||||||
|
SlashType::G614_2025 => PROD_ID2,
|
||||||
SlashType::Unsupported => 0,
|
SlashType::Unsupported => 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const fn prod_id_str(&self) -> &str {
|
pub const fn prod_id_str(&self) -> &str {
|
||||||
match self {
|
match self {
|
||||||
SlashType::GA403W => PROD_ID2_STR,
|
SlashType::GA403_2025 => PROD_ID2_STR,
|
||||||
SlashType::GA403 => PROD_ID1_STR,
|
SlashType::GA403_2024 => PROD_ID1_STR,
|
||||||
SlashType::GA605 => PROD_ID2_STR,
|
SlashType::GA605_2025 => PROD_ID2_STR,
|
||||||
SlashType::GU605 => PROD_ID1_STR,
|
SlashType::GA605_2024 => PROD_ID2_STR,
|
||||||
SlashType::GU605C => PROD_ID2_STR,
|
SlashType::GU605_2025 => PROD_ID2_STR,
|
||||||
SlashType::G614F => PROD_ID2_STR,
|
SlashType::GU605_2024 => PROD_ID1_STR,
|
||||||
|
SlashType::G614_2025 => PROD_ID2_STR,
|
||||||
SlashType::Unsupported => "",
|
SlashType::Unsupported => "",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -50,17 +53,24 @@ impl SlashType {
|
|||||||
pub fn from_dmi() -> Self {
|
pub fn from_dmi() -> Self {
|
||||||
let board_name = DMIID::new().unwrap_or_default().board_name.to_uppercase();
|
let board_name = DMIID::new().unwrap_or_default().board_name.to_uppercase();
|
||||||
if board_name.contains("G614F") {
|
if board_name.contains("G614F") {
|
||||||
SlashType::G614F
|
SlashType::G614_2025
|
||||||
} else if board_name.contains("GA403W") {
|
} else if [
|
||||||
SlashType::GA403W
|
"GA403W", "GA403UH", "GA403UM", "GA403UP",
|
||||||
|
]
|
||||||
|
.iter()
|
||||||
|
.any(|s| board_name.contains(s))
|
||||||
|
{
|
||||||
|
SlashType::GA403_2025
|
||||||
} else if board_name.contains("GA403") {
|
} else if board_name.contains("GA403") {
|
||||||
SlashType::GA403
|
SlashType::GA403_2024
|
||||||
|
} else if board_name.contains("GA605K") {
|
||||||
|
SlashType::GA605_2025
|
||||||
} else if board_name.contains("GA605") {
|
} else if board_name.contains("GA605") {
|
||||||
SlashType::GA605
|
SlashType::GA605_2024
|
||||||
} else if board_name.contains("GU605C") {
|
} else if board_name.contains("GU605C") {
|
||||||
SlashType::GU605C
|
SlashType::GU605_2025
|
||||||
} else if board_name.contains("GU605") {
|
} else if board_name.contains("GU605") {
|
||||||
SlashType::GU605
|
SlashType::GU605_2024
|
||||||
} else {
|
} else {
|
||||||
SlashType::Unsupported
|
SlashType::Unsupported
|
||||||
}
|
}
|
||||||
@@ -72,12 +82,13 @@ impl FromStr for SlashType {
|
|||||||
|
|
||||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||||
Ok(match s.to_uppercase().as_str() {
|
Ok(match s.to_uppercase().as_str() {
|
||||||
"GA403W" => Self::GA403W,
|
"GA403_2025" => Self::GA403_2025,
|
||||||
"GA403" => Self::GA403,
|
"GA403_2024" => Self::GA403_2024,
|
||||||
"GA605" => Self::GA605,
|
"GA605_2025" => Self::GA605_2025,
|
||||||
"GU605C" => Self::GU605C,
|
"GA605_2024" => Self::GA605_2024,
|
||||||
"GU605" => Self::GU605,
|
"GU605_2025" => Self::GU605_2025,
|
||||||
"G614FR" => Self::G614F,
|
"GU605_2024" => Self::GU605_2024,
|
||||||
|
"G614_2025" => Self::G614_2025,
|
||||||
_ => Self::Unsupported,
|
_ => Self::Unsupported,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,17 +39,24 @@ pub fn get_slash_type() -> SlashType {
|
|||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
let board_name = dmi.board_name.to_uppercase();
|
let board_name = dmi.board_name.to_uppercase();
|
||||||
if board_name.contains("G614F") {
|
if board_name.contains("G614F") {
|
||||||
SlashType::G614F
|
SlashType::G614_2025
|
||||||
} else if board_name.contains("GA403W") {
|
} else if [
|
||||||
SlashType::GA403W
|
"GA403W", "GA403UH", "GA403UM", "GA403UP",
|
||||||
|
]
|
||||||
|
.iter()
|
||||||
|
.any(|s| board_name.contains(s))
|
||||||
|
{
|
||||||
|
SlashType::GA403_2025
|
||||||
} else if board_name.contains("GA403") {
|
} else if board_name.contains("GA403") {
|
||||||
SlashType::GA403
|
SlashType::GA403_2024
|
||||||
|
} else if board_name.contains("GA605K") {
|
||||||
|
SlashType::GA605_2025
|
||||||
} else if board_name.contains("GA605") {
|
} else if board_name.contains("GA605") {
|
||||||
SlashType::GA605
|
SlashType::GA605_2024
|
||||||
} else if board_name.contains("GU605C") {
|
} else if board_name.contains("GU605C") {
|
||||||
SlashType::GU605C
|
SlashType::GU605_2025
|
||||||
} else if board_name.contains("GU605") {
|
} else if board_name.contains("GU605") {
|
||||||
SlashType::GU605
|
SlashType::GU605_2024
|
||||||
} else {
|
} else {
|
||||||
SlashType::Unsupported
|
SlashType::Unsupported
|
||||||
}
|
}
|
||||||
@@ -57,12 +64,13 @@ pub fn get_slash_type() -> SlashType {
|
|||||||
|
|
||||||
pub const fn report_id(slash_type: SlashType) -> u8 {
|
pub const fn report_id(slash_type: SlashType) -> u8 {
|
||||||
match slash_type {
|
match slash_type {
|
||||||
SlashType::GA403W => REPORT_ID_19B6,
|
SlashType::GA403_2025 => REPORT_ID_19B6,
|
||||||
SlashType::GA403 => REPORT_ID_193B,
|
SlashType::GA403_2024 => REPORT_ID_193B,
|
||||||
SlashType::GA605 => REPORT_ID_19B6,
|
SlashType::GA605_2025 => REPORT_ID_19B6,
|
||||||
SlashType::G614F => REPORT_ID_19B6,
|
SlashType::GA605_2024 => REPORT_ID_19B6,
|
||||||
SlashType::GU605 => REPORT_ID_193B,
|
SlashType::GU605_2025 => REPORT_ID_19B6,
|
||||||
SlashType::GU605C => REPORT_ID_19B6,
|
SlashType::GU605_2024 => REPORT_ID_193B,
|
||||||
|
SlashType::G614_2025 => REPORT_ID_19B6,
|
||||||
SlashType::Unsupported => REPORT_ID_19B6,
|
SlashType::Unsupported => REPORT_ID_19B6,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user