HEX
Server: Apache
System: Linux nc-ph-4101.simplemoneygoals.com 5.14.0-503.21.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Jan 12 09:45:05 EST 2025 x86_64
User: dailygoldindex (1004)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //lib/python3.9/site-packages/tuned/plugins/__pycache__/plugin_audio.cpython-39.opt-1.pyc
a

,�g��@snddlmZddlTddlZddlmZddlZddlZddl	Z	ddl
Z
ej��Z
e�ZGdd�dej�ZdS)�)�hotplug)�*�N)�commandsc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zed
d��Z	dd
�Z
dd�Zeddd�dd��Z
ed�ddd��Zeddd�dd��Zed�ddd��ZdS) �AudioPlugina�
	Sets audio cards power saving options. The plug-in sets the auto suspend
	timeout for audio codecs to the value specified by the [option]`timeout`
	option.

	Currently, the `snd_hda_intel` and `snd_ac97_codec` codecs are
	supported and the [option]`timeout` value is in seconds. To disable
	auto suspend for these codecs, set the [option]`timeout` value
	to `0`. To enforce the controller reset, set the option
	[option]`reset_controller` to `true`. Note that power management
	is supported per module. Hence, the kernel module names are used as
	device names.

	.Set the timeout value to 10s and enforce the controller reset
	====
	----
	[audio]
	timeout=10
	reset_controller=true
	----
	====
	cCsPd|_t�|_t�|_|j�d��d�D]"}|�|�}|dvr(|j�|�q(dS)NTZsoundzcard*)Z
snd_hda_intelZsnd_ac97_codec)	Z_devices_supported�setZ_assigned_devicesZ
_free_devicesZ_hardware_inventoryZget_devicesZmatch_sys_name�_device_module_name�add)�self�deviceZmodule_name�r�>/usr/lib/python3.9/site-packages/tuned/plugins/plugin_audio.py�
_init_devices&s
zAudioPlugin._init_devicescCsd|_d|_dS)NTF)Z_has_static_tuningZ_has_dynamic_tuning�r
�instancerrr
�_instance_init0szAudioPlugin._instance_initcCsdS�Nrrrrr
�_instance_cleanup4szAudioPlugin._instance_cleanupcCsz
|jjWSYdS0dSr)�parentZdriver�r
rrrr
r7s
zAudioPlugin._device_module_namecCs
ddd�S)NrT)�timeout�reset_controllerr)�clsrrr
�_get_config_options=s�zAudioPlugin._get_config_optionscCsd|S)Nz$/sys/module/%s/parameters/power_saverrrrr
�
_timeout_pathDszAudioPlugin._timeout_pathcCsd|S)Nz//sys/module/%s/parameters/power_save_controllerrrrrr
�_reset_controller_pathGsz"AudioPlugin._reset_controller_pathrT)Z
per_devicecCsrzt|�}Wn"ty.t�d|�YdS0|dkrj|�|�}|sftj|d||r^tjgndd�|SdSdS)Nz!timeout value '%s' is not integerrz%dF�Zno_error)	�int�
ValueError�log�errorr�cmd�
write_to_file�errno�ENOENT)r
�valuerr�sim�remover�sys_filerrr
�_set_timeoutJs
�zAudioPlugin._set_timeoutFcCs,|�|�}tj||d�}t|�dkr(|SdS)Nrr)rr!�	read_file�len�r
rrZignore_missingr(r%rrr
�_get_timeoutZs

zAudioPlugin._get_timeoutrcCsHt�|�}|�|�}tj�|�rD|s@tj|||r8tjgndd�|SdS)NFr)	r!�get_boolr�os�path�existsr"r#r$)r
r%rrr&r'�vr(rrr
�_set_reset_controllerbs

�z!AudioPlugin._set_reset_controllercCs:|�|�}tj�|�r6t�|�}t|�dkr6t�|�SdS)Nr)rr/r0r1r!r*r+r.r,rrr
�_get_reset_controllerms


z!AudioPlugin._get_reset_controllerN)F)F)�__name__�
__module__�__qualname__�__doc__rrrr�classmethodrrrZcommand_setr)Zcommand_getr-r3r4rrrr
rs"






r)�rZ
decoratorsZ
tuned.logsZtunedZtuned.utils.commandsrr/r#�struct�globZlogs�getrr!ZPluginrrrrr
�<module>s