£Á°èZ¨Ä…–K§‚«“ô4“ÒÙ´dîfUÙÃÅ WKbyÊ¦•êŽ…È®FÒ¿ÊÎóCozá¬S@6{Í:›œêZÌ:Š•_%:¢¾¾~;‘Ã~èŠ©ÊÇí`ÔÑ©úë™µ'5I¿fš×WO%ø9¾«¾DK|€ùÍD”Ýs]nHÕ¶ê×Ó¼ãžªéUWŸÈË%DÒÕ¬ï‘]/Åcx  ‰ï2ß]ä6G[]S£ÔÏ¯rs{úëóµmÒï#UQxo·õÞCe]"±/aÙ&Eã4ú9Jé_ÞåëdãöKë)AÞ                  ¯¹ægƒÛowÐø^d™ý½ßB7áyMä9ÜÖUã
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<html>
3
<e                 @   sX   d dl mZ d dlT ddlZddlmZ ddlZddlZej	j
 ZG dd dejZdS )   )base)*    N)commandsc               @   sj   e Zd ZdZdd Zdd Zedd Zdd	 Zd
d Z	dd Z
eddddd ZeddddZdS )	USBPlugina  
	`usb`::
	
	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.
	+
	.To turn off USB autosuspend for USB devices `1-1` and `1-2`
	====
	----
	[usb]
	devices=1-1,1-2
	autosuspend=0
	----
	====
	c             C   sN   d| _ t | _t | _x*| jjdjddD ]}| jj|j q,W t	 | _
d S )NTusbZDEVTYPEZ
usb_device)Z_devices_supportedsetZ_free_devicesZ_assigned_devices_hardware_inventoryZget_devicesZmatch_propertyaddZsys_namer   _cmd)selfdevice r    /usr/lib/python3.6/plugin_usb.py_init_devices   s    zUSBPlugin._init_devicesc                s    fdd|D S )Nc                s   g | ]} j jd |qS )r   )r	   Z
get_device).0x)r   r   r   
<listcomp>*   s    z1USBPlugin._get_device_objects.<locals>.<listcomp>r   )r   Zdevicesr   )r   r   _get_device_objects)   s    zUSBPlugin._get_device_objectsc             C   s   dd iS )Nautosuspendr   )r   r   r   r   _get_config_options,   s    zUSBPlugin._get_config_optionsc             C   s   d|_ d|_d S )NTF)Z_has_static_tuningZ_has_dynamic_tuning)r   instancer   r   r   _instance_init2   s    zUSBPlugin._instance_initc             C   s   d S )Nr   )r   r   r   r   r   _instance_cleanup6   s    zUSBPlugin._instance_cleanupc             C   s   d| S )Nz)/sys/bus/usb/devices/%s/power/autosuspendr   )r   r   r   r   r   _autosuspend_sysfile9   s    zUSBPlugin._autosuspend_sysfiler   T)Z
per_devicec             C   sR   | j |}|d krd S |rdnd}|sN| j|}| jj|||rFtjgndd |S )N10F)no_error)Z_option_boolr   r   Zwrite_to_fileerrnoENOENT)r   valuer   Zsimremoveenablevalsys_filer   r   r   _set_autosuspend<   s    


zUSBPlugin._set_autosuspendFc             C   s   | j |}| jj||dj S )N)r   )r   r   Z	read_filestrip)r   r   Zignore_missingr$   r   r   r   _get_autosuspendI   s    
zUSBPlugin._get_autosuspendN)F)__name__
__module____qualname____doc__r   r   classmethodr   r   r   r   Zcommand_setr%   Zcommand_getr'   r   r   r   r   r   
   s   
r   ) r   Z
decoratorsZ
tuned.logsZtunedZtuned.utils.commandsr   Zglobr   ZlogsgetlogZPluginr   r   r   r   r   <module>   s   
