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_usb.cpython-312.opt-1.pyc
�

�]�i����ddlmZddl�ddlZddlmZddlZddlZejj�ZGd�dej�Z
y)�)�base)�*�N)�commandsc�|�eZdZdZd�Zd�Zed��Zd�Zd�Z	d�Z
edd	�
�d��Ze
d�dd��Zy
)�	USBPlugina�
	Sets autosuspend timeout of USB devices to the value specified by the
	[option]`autosuspend` option in seconds. If the [option]`devices`
	option is specified, the [option]`autosuspend` option applies to only
	the USB devices specified, otherwise it applies to all USB devices.

	The value `0` means that autosuspend is disabled.

	.Turn off USB autosuspend for USB devices `1-1` and `1-2`
	====
	----
	[usb]
	devices=1-1,1-2
	autosuspend=0
	----
	====
	c��d|_t�|_t�|_|jjd�j
dd�D]'}|jj|j��)t�|_
y)NT�usb�DEVTYPE�
usb_device)�_devices_supported�set�
_free_devices�_assigned_devices�_hardware_inventory�get_devices�match_property�add�sys_namer�_cmd��self�devices  �=/usr/lib/python3.12/site-packages/tuned/plugins/plugin_usb.py�
_init_deviceszUSBPlugin._init_devicessk�� �$���u�$���5�$���(�(�4�4�U�;�J�J�9�Vb�c�f������&�/�/�*�d��j�$�)�c�`�|D�cgc]}|jjd|��� c}Scc}w)Nr
)r�
get_device)r�devices�xs   r�_get_device_objectszUSBPlugin._get_device_objects's-��AH�	I��A�$�
"�
"�
-�
-�e�Q�
7��	I�I��	Is�#+c�
�ddiS)N�autosuspend�)rs r�_get_config_optionszUSBPlugin._get_config_options*s���4�
�rc� �d|_d|_y)NTF)�_has_static_tuning�_has_dynamic_tuning�r�instances  r�_instance_initzUSBPlugin._instance_init0s�� $�(��!&�(�rc��y)Nr$r)s  r�_instance_cleanupzUSBPlugin._instance_cleanup4s��rc��d|zS)Nz)/sys/bus/usb/devices/%s/power/autosuspendr$rs  r�_autosuspend_sysfilezUSBPlugin._autosuspend_sysfile7s
��	4�v�	=�=rr#T)�
per_devicec���|j|�}|�y|rdnd}|sB|j|�}|jj|||rtj
gnd��|S)N�1�0F��no_error)�_option_boolr/r�
write_to_file�errno�ENOENT)	r�valuerr*�sim�remove�enable�val�sys_files	         r�_set_autosuspendzUSBPlugin._set_autosuspend:sc�����U�#�&��^�
���3�#�	��'�'��/�8��9�9���8�S�!'����~�U��4�	�*rc�z�|j|�}|jj||��j�S)Nr4)r/r�	read_file�strip)rrr*�ignore_missingr?s     r�_get_autosuspendzUSBPlugin._get_autosuspendGs5��
�
&�
&�v�
.�(�	
���	�	�X��	�	?�	E�	E�	G�GrN)F)�__name__�
__module__�__qualname__�__doc__rr!�classmethodr%r+r-r/�command_setr@�command_getrEr$rrrr
sk���$�J�����
'��>��m��-�

�.�

��m��H��Hrr)�r�
decorators�
tuned.logs�tuned�tuned.utils.commandsr�globr8�logs�get�log�Pluginrr$rr�<module>rWs;�����)����j�j�n�n���@H����@Hr