a
]i @ sh d dl mZmZ d dlmZ d dlZdZdZdZdZ dZ
d Zd
ZdZ
dZG d
d dZG dd dZdS ) )ConfigParserError)TunedExceptionNzpower-saverZbalancedZperformancemainprofilesZbatterydefaultbattery_detectionsysfs_acpi_monitorc @ s( e Zd ZdZdd Zdd Zdd ZdS )
ProfileMapzB
Mapping of PPD profiles to TuneD profiles or vice versa.
c C s || _ || _d S N)_ac_map_dc_map)selfZac_mapZdc_map r 4/usr/lib/python3.9/site-packages/tuned/ppd/config.py__init__ s zProfileMap.__init__c C s |r
| j n| j}|| S )z
Returns a TuneD profile corresponding to the given
PPD profile and power supply status (or vice versa).
)r
r )r Zprofile
on_batteryprofile_mapr r r get s zProfileMap.getc C s |r
| j n| j}| S )z>
Returns the supported PPD or TuneD profiles.
)r
r keys)r r r r r r r ! s zProfileMap.keysN)__name__
__module____qualname____doc__r r r r r r r r
s r
c @ s\ e Zd ZdZdd Zedd Zedd Zedd Zed
d Z edd
Z
dd ZdS ) PPDConfigz1
Configuration for the tuned-ppd daemon.
c C s || _ | | d S r )_tuned_interfaceload_from_file)r config_fileZtuned_interfacer r r r - s zPPDConfig.__init__c C s | j S )z7
Whether battery detection is enabled.
)_battery_detectionr r r r r 1 s zPPDConfig.battery_detectionc C s | j S )zC
Default PPD profile to set during initialization.
)_default_profiler r r r default_profile8 s zPPDConfig.default_profilec C s | j S )z<
Mapping of PPD profiles to TuneD profiles.
)
_ppd_to_tunedr r r r ppd_to_tuned? s zPPDConfig.ppd_to_tunedc C s | j S )z<
Mapping of TuneD profiles to PPD profiles.
)
_tuned_to_ppdr r r r tuned_to_ppdF s zPPDConfig.tuned_to_ppdc C s | j S )z
Whether to react to changes of ACPI platform profile
done via function keys (e.g., Fn-L) on newer Thinkpad
machines. Experimental feature.
)_sysfs_acpi_monitorr r r r r M s zPPDConfig.sysfs_acpi_monitorc C s2 t }tj|std| z|| W n tyJ td| Y n0 t|vr`td| t|t }t |vrtd| t
|vrtd| t|vrtd| t|vst
|t vrt
| _n|t t
| _| j|vrtd| j |jttt|v d| _| jrt|vrtd | | jr6|t|t B n|}t| t| B t| j }|rxtd
d| t| t| }|rtdd| tt| t|kstt| t|krtd
| t||| _tdd | D dd | D | _|jttdd| _dS )zA
Loads the configuration from the provided file.
z&Configuration file '%s' does not existz)Error parsing the configuration file '%s'z7Missing profiles section in the configuration file '%s'z:Missing power-saver profile in the configuration file '%s'z7Missing balanced profile in the configuration file '%s'z:Missing performance profile in the configuration file '%s'z3Default profile '%s' missing in the profile mapping)fallbackz6Missing battery section in the configuration file '%s'z2Unknown TuneD profiles in the configuration file: z, z-Unknown PPD profiles in the battery section: z8Duplicate profile mapping in the configuration file '%s'c S s i | ]\}}||qS r r ).0kvr r r