3 À<×eŽ ã@sXddlmZddlTddlZddlZddlZddlmZej j ƒZ Gdd„dej ƒZ dS)é)Úbase)Ú*éN)ÚACPI_DIRcsveZdZdZ‡fdd„Zedd„ƒZdd„Zdd „Zed d „ƒZ ed d „ƒZ e dƒdd„ƒZ e dƒddd„ƒZ‡ZS)Ú ACPIPlugina> `acpi`:: Configures the ACPI driver. + The only currently supported option is [option]`platform_profile`, which sets the ACPI platform profile sysfs attribute, a generic power/performance preference API for other drivers. Multiple profiles can be specified, separated by `|`. The first available profile is selected. + -- .Selecting a platform profile ==== ---- [acpi] platform_profile=balanced|low-power ---- Using this option, *TuneD* will try to set the platform profile to `balanced`. If that fails, it will try to set it to `low-power`. ==== -- cstt|ƒj||ŽdS)N)ÚsuperrÚ__init__)ÚselfÚargsÚkwargs)Ú __class__©ú!/usr/lib/python3.6/plugin_acpi.pyr$szACPIPlugin.__init__cCsddiS)NÚplatform_profiler )Úclsr r rÚ_get_config_options'szACPIPlugin._get_config_optionscCsd|_d|_dS)NTF)Z_has_static_tuningZ_has_dynamic_tuning)r Úinstancer r rÚ_instance_init+szACPIPlugin._instance_initcCsdS)Nr )r rr r rÚ_instance_cleanup/szACPIPlugin._instance_cleanupcCstjjtdƒS)NZplatform_profile_choices)ÚosÚpathÚjoinr)rr r rÚ_platform_profile_choices_path2sz)ACPIPlugin._platform_profile_choices_pathcCstjjtdƒS)Nr)rrrr)rr r rÚ_platform_profile_path6sz!ACPIPlugin._platform_profile_pathrcCs´tjj|jƒƒstjdƒdSdd„|jdƒDƒ}t|jj |j ƒƒjƒƒ}xZ|D]R}||kr”|s�tj d|ƒ|jj |jƒ||rˆt jgndd�|Stjd|ƒqPWtjd ƒdS) Nz5ACPI platform_profile is not supported on this systemcSsg|] }|jƒ‘qSr )Ústrip)Ú.0Úprofiler r rú ?sz4ACPIPlugin._set_platform_profile..ú|z Setting platform_profile to '%s'F)Zno_errorz+Requested platform_profile '%s' unavailablezDFailed to set platform_profile. Is the value in the profile correct?)rrÚisfilerÚlogÚdebugÚsplitÚsetÚ_cmdÚ read_filerÚinfoZ write_to_fileÚerrnoÚENOENTÚwarnÚerror)r ZprofilesZsimÚremoveZavail_profilesrr r rÚ_set_platform_profile:s   z ACPIPlugin._set_platform_profileFcCs2tjj|jƒƒstjdƒdS|jj|jƒƒjƒS)Nz5ACPI platform_profile is not supported on this system) rrrrr r!r$r%r)r Zignore_missingr r rÚ_get_platform_profileLs z ACPIPlugin._get_platform_profile)F)Ú__name__Ú __module__Ú __qualname__Ú__doc__rÚ classmethodrrrrrZ command_setr,Z command_getr-Ú __classcell__r r )r rr s    r)ÚrZ decoratorsrr'Z tuned.logsZtunedZ tuned.constsrZlogsÚgetr ZPluginrr r r rÚs