mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-08 15:40:34 -04:00
power: Expose TDP limit range as platform config
This commit is contained in:
parent
36e88484a4
commit
7c3f2baa05
5 changed files with 46 additions and 7 deletions
|
@ -26,8 +26,17 @@ pub(crate) struct PlatformConfig {
|
|||
pub update_dock: Option<ScriptConfig>,
|
||||
pub storage: Option<StorageConfig>,
|
||||
pub fan_control: Option<ServiceConfig>,
|
||||
pub tdp_limit: Option<RangeConfig<u32>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, Debug)]
|
||||
pub(crate) struct RangeConfig<T: Clone> {
|
||||
pub min: T,
|
||||
pub max: T,
|
||||
}
|
||||
|
||||
impl<T> Copy for RangeConfig<T> where T: Copy {}
|
||||
|
||||
#[derive(Clone, Default, Deserialize, Debug)]
|
||||
pub(crate) struct ScriptConfig {
|
||||
pub script: PathBuf,
|
||||
|
@ -67,6 +76,13 @@ pub(crate) struct FormatDeviceConfig {
|
|||
pub no_validate_flag: Option<String>,
|
||||
}
|
||||
|
||||
impl<T: Clone> RangeConfig<T> {
|
||||
#[allow(unused)]
|
||||
pub(crate) fn new(min: T, max: T) -> RangeConfig<T> {
|
||||
RangeConfig { min, max }
|
||||
}
|
||||
}
|
||||
|
||||
impl PlatformConfig {
|
||||
#[cfg(not(test))]
|
||||
async fn load() -> Result<Option<PlatformConfig>> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue