MOON
Server: Apache
System: Linux s5.yayogua.com.py 6.12.0-124.55.3.el10_1.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:54:02 EDT 2026 x86_64
User: sanbercountryclu (1012)
PHP: 8.2.33
Disabled: NONE
Upload Files
File: //lib/python3.12/site-packages/tuned/plugins/__pycache__/plugin_audio.cpython-312.pyc
�

�]�i����ddlmZddl�ddlZddlmZddlZddlZddl	Z	ddl
Z
ejj�Z
e�ZGd�dej�Zy)�)�hotplug)�*�N)�commandsc��eZdZdZd�Zd�Zd�Zd�Zed��Z	d�Z
d�Zed	d
��d��Z
ed	�dd
��Zedd
��d��Zed�dd��Zy)�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
	----
	====
	c��d|_t�|_t�|_|jjd�j
d�D]3}|j|�}|dvs�|jj|��5y)NT�soundzcard*)�
snd_hda_intel�snd_ac97_codec)	�_devices_supported�set�_assigned_devices�
_free_devices�_hardware_inventory�get_devices�match_sys_name�_device_module_name�add)�self�device�module_names   �?/usr/lib/python3.12/site-packages/tuned/plugins/plugin_audio.py�
_init_deviceszAudioPlugin._init_devices&sr�� �$���5�$���u�$���(�(�4�4�W�=�L�L�W�U�f��)�)�&�1�;��8�8������;�'�V�c� �d|_d|_y)NTF)�_has_static_tuning�_has_dynamic_tuning�r�instances  r�_instance_initzAudioPlugin._instance_init0s�� $�(��!&�(�rc��y�N�rs  r�_instance_cleanupzAudioPlugin._instance_cleanup4s��rc�>�	|jjS#YyxYwr#)�parent�driver�rrs  rrzAudioPlugin._device_module_name7s!���
�-�-�
�
����
�s��c��ddd�S)NrT)�timeout�reset_controllerr$)�clss r�_get_config_optionszAudioPlugin._get_config_options=s����
�rc��d|zS)Nz$/sys/module/%s/parameters/power_saver$r)s  r�
_timeout_pathzAudioPlugin._timeout_pathDs
��	/�&�	8�8rc��d|zS)Nz//sys/module/%s/parameters/power_save_controllerr$r)s  r�_reset_controller_pathz"AudioPlugin._reset_controller_pathGs
��	:�V�	C�Crr+T)�
per_devicec��	t|�}|dk\rC|j	|�}|s.t
j
|d|z|rtjgnd��|Sy#t$rtjd|z�YywxYw)Nz!timeout value '%s' is not integerrz%dF��no_error)	�int�
ValueError�log�errorr0�cmd�
write_to_file�errno�ENOENT)r�valuerr �sim�remover+�sys_files        r�_set_timeoutzAudioPlugin._set_timeoutJs����
��Z�7�
��\�� � ��(�8�

����h��w��"(�����e��5�
�>�
��
���9�9�
0�5�
8�9�
��s�A�!A:�9A:c�t�|j|�}tj||��}t|�dkDr|Sy)Nr5r)r0r;�	read_file�len�rrr �ignore_missingrBr?s      r�_get_timeoutzAudioPlugin._get_timeoutZs7��
�
�
��
'�(�

�-�-��>�-�
:�%���Z�!�^�
�<�	
rr,c���tj|�}|j|�}tjj|�r/|s+tj
|||rtjgnd��|Sy)NFr5)	r;�get_boolr2�os�path�existsr<r=r>)rr?rr r@rA�vrBs        r�_set_reset_controllerz!AudioPlugin._set_reset_controllerbs_��	�l�l�5��!�
�
(�
(��
0�(��W�W�^�^�H��

����h��"(�����e��5�
�8�	
rc���|j|�}tjj|�r8tj|�}t
|�dkDrtj|�Sy)Nr)r2rLrMrNr;rErFrKrGs      r�_get_reset_controllerz!AudioPlugin._get_reset_controllermsM��
�
(�
(��
0�(��W�W�^�^�H���=�=��"�5�	�%�j�1�n��<�<����	
rN)F)�__name__�
__module__�__qualname__�__doc__rr!r%r�classmethodr.r0r2�command_setrC�command_getrIrPrRr$rrrrs����.(�'�������9�D��i�d�+�
�,�
��i������ �t�4��5��� �!��"�rr)�r�
decorators�
tuned.logs�tuned�tuned.utils.commandsrrLr=�struct�glob�logs�getr9r;�Pluginrr$rr�<module>rdsF�����)�	��
���j�j�n�n����j��f�'�.�.�fr