o
    헛dJ                     @   sD   d dl Z d dlZd dlZd dlZedZedZdZdd ZdS )    Nz^\s*\d+\s*\[Modem\s*\]z^card [0-9].*[mM]odemzsl-modem-daemonc           	   
   C   sz  z-t d}|D ]}t|rtg  W  d    W S qW d    n1 s'w   Y  W n tyE } ztd| W Y d }~nd }~ww zTtj	 }z|d= W n	 t
yZ   Y nw d|d< z)tjddg|tjtjdd	}| \}}|jd
krtd|j|f  W W d S W n ty   td Y W d S w W n ty   td Y d S w | D ]}t|rtg  S qd S )Nz/proc/asound/cardsz%could not open /proc/asound/cards: %sLANGUAGECLC_ALLaplayz-lT)envstdoutstderruniversal_newlinesr   zaplay -l failed with %i: %szaplay command not foundz4could not open aplay -l. Skipping sl-modem detection)openmodem_rematchpkgIOErrorloggingdebugosenvironcopyKeyError
subprocessPopenPIPEcommunicate
returncodeerrorFileNotFoundErrorOSError
splitlinesmodem_as_subdevice_re)		apt_cachefdlineer   r   	aplay_out	aplay_errrow r&   3/usr/share/ubuntu-drivers-common/detect/sl-modem.pydetect   sb   









r(   )	r   rer   r   compiler   r   r   r(   r&   r&   r&   r'   <module>   s   

