Current File : //usr/lib/python2.7/site-packages/serial/tools/list_ports_posix.pyo
�
�MNc@s_ddlZddlZddlZddlZyddlZWnek
r\d�Zn
Xd�Zejj�Z	d�Z
d�Ze	d dkr�d�Zd	�Z
d
�Zd�Zd�ZnPe	d
kr�d�Zn8e	dkr�d�Zn e	d dks'e	d dks'e	d dkr3d�Zn�e	d dkrOd�Zn�e	d dkrkd�Zn�e	d dkr�d�Zn�e	d d kr�d!�Znte	d d"kr�d#�ZnXe	d d$kr�d%�Zn<ejjd&ejejejf�ed'ejf��ed(kr[x5ee��D]!\ZZZd)eeefGHq3WndS(*i����NcCsLy2tjdj|��\}}|j�j�SWntd��nXdS(Nt slsusb failed(tostpopen4tjointreadtstriptIOError(targvtsitso((sA/usr/lib/python2.7/site-packages/serial/tools/list_ports_posix.pytpopen	s
cCs:y tj|dtj�j�SWntd��nXdS(Ntstderrslsusb failed(t
subprocesstcheck_outputtSTDOUTRR(R((sA/usr/lib/python2.7/site-packages/serial/tools/list_ports_posix.pyR
s cCsIy0t|�}|j�j�}|j�|SWntk
rDdSXdS(s=help function to read a single line from a file. returns noneN(topentreadlineRtcloseRtNone(tfilenametftline((sA/usr/lib/python2.7/site-packages/serial/tools/list_ports_posix.pyt	read_line s

cCs)tj||�}|r%|jd�SdS(s4search for regexp in text, return 1st group on matchiN(tretsearchtgroup(tregexpttexttm((sA/usr/lib/python2.7/site-packages/serial/tools/list_ports_posix.pytre_group*sitlinuxcCs~tjjtjj|��jd�\}}t|d�}|rSd|f}nd}dt|d�t|d�|fS(sDgiven a path to a usb device in sysfs, return a string describing itt-s/serials SNR=%stsUSB VID:PID=%s:%s%ss	/idVendors
/idProduct(RtpathtbasenametrealpathtsplitR(t
sysfs_pathtbustdevtsnrtsnr_txt((sA/usr/lib/python2.7/site-packages/serial/tools/list_ports_posix.pytusb_sysfs_hw_string4s-

c	Cs�tjjtjj|��jd�\}}y�tdddd||fg�}td|�}td|�}td|�p�d	}td
|�}td|�}d|p�||p�||fSWntk
r�tSXdS(
NRtlsusbs-vs-ss%s:%ssiManufacturer\s+\w+ (.+)siProduct\s+\w+ (.+)siSerial\s+\w+ (.+)R sidVendor\s+0x\w+ (.+)sidProduct\s+0x\w+ (.+)s%s %s %s(	RR!R"R#R$R
RRtbase(	R%R&R'tdesct
iManufacturertiProducttiSerialtidVendort	idProduct((sA/usr/lib/python2.7/site-packages/serial/tools/list_ports_posix.pytusb_lsusb_stringBs-"!
cCs�tjj|�}d||f}tjj|�rhtjjtjjtjj|���}t|�Sd|f}tjj|�r�t|�S|S(s�        Get a human readable description.
        For USB-Serial devices try to run lsusb to get a human readable description.
        For USB-CDC devices read the description from sysfs.
        s"/sys/class/tty/%s/device/driver/%ss"/sys/class/tty/%s/device/interface(RR!R"texiststdirnameR#R3R(tdeviceR,tsys_dev_pathtsys_usb((sA/usr/lib/python2.7/site-packages/serial/tools/list_ports_posix.pytdescribeRs*


cCs�tjj|�}tjjd|f�r�d|f}tjj|�rTt|�Sd||f}tjj|�r�tjjtjjtjj|���}t|�S|jd�r�d|f}tjj|�r�t|d�Sq�ndS(s*Try to get a HW identification using sysfss/sys/class/tty/%s/devices/sys/class/tty/%s/device/ids"/sys/class/tty/%s/device/driver/%stttyACMs/..sn/a(	RR!R"R4RR5R#R*t
startswith(R6R,tsys_id_pathR7R8((sA/usr/lib/python2.7/site-packages/serial/tools/list_ports_posix.pythwinfods

*

cCsUtjd�tjd�tjd�}g|D]!}|t|�t|�f^q0S(Ns
/dev/ttyS*s/dev/ttyUSB*s/dev/ttyACM*(tglobR9R=(tdevicestd((sA/usr/lib/python2.7/site-packages/serial/tools/list_ports_posix.pytcomportsxs)tcygwincCs/tjd�}g|D]}|||f^qS(Ns	/dev/com*(R>(R?R@((sA/usr/lib/python2.7/site-packages/serial/tools/list_ports_posix.pyRA}stopenbsd3cCs/tjd�}g|D]}|||f^qS(Ns
/dev/ttyp*(R>(R?R@((sA/usr/lib/python2.7/site-packages/serial/tools/list_ports_posix.pyRA�sitbsditfreebsdtopenbsdcCs/tjd�}g|D]}|||f^qS(Ns
/dev/cuad*(R>(R?R@((sA/usr/lib/python2.7/site-packages/serial/tools/list_ports_posix.pyRA�sitdarwincCs/tjd�}g|D]}|||f^qS(s8scan for available ports. return a list of device names.s
/dev/tty.*(R>(R?R@((sA/usr/lib/python2.7/site-packages/serial/tools/list_ports_posix.pyRA�stnetbsdcCs/tjd�}g|D]}|||f^qS(s8scan for available ports. return a list of device names.s	/dev/dty*(R>(R?R@((sA/usr/lib/python2.7/site-packages/serial/tools/list_ports_posix.pyRA�sitirixcCs/tjd�}g|D]}|||f^qS(s8scan for available ports. return a list of device names.s
/dev/ttyf*(R>(R?R@((sA/usr/lib/python2.7/site-packages/serial/tools/list_ports_posix.pyRA�sithpcCs/tjd�}g|D]}|||f^qS(s8scan for available ports. return a list of device names.s/dev/tty*p0(R>(R?R@((sA/usr/lib/python2.7/site-packages/serial/tools/list_ports_posix.pyRA�stsunoscCs/tjd�}g|D]}|||f^qS(s8scan for available ports. return a list of device names.s
/dev/tty*c(R>(R?R@((sA/usr/lib/python2.7/site-packages/serial/tools/list_ports_posix.pyRA�staixcCs/tjd�}g|D]}|||f^qS(s8scan for available ports. return a list of device names.s	/dev/tty*(R>(R?R@((sA/usr/lib/python2.7/site-packages/serial/tools/list_ports_posix.pyRA�ss0don't know how to enumerate ttys on this system.
! I you know how the serial ports are named send this information to
! the author of this module:

sys.platform = %r
os.name = %r
pySerial version = %s

also add the naming scheme of the serial ports and with a bit luck you can get
this module running...
s;Sorry: no implementation for your platform ('%s') availablet__main__s%s: %s [%s](R>tsysRRRtImportErrorR
tplatformtlowertplatRRR*R3R9R=RARtwritetnametserialtVERSIONt__name__tsortedtportR-thwid(((sA/usr/lib/python2.7/site-packages/serial/tools/list_ports_posix.pyt<module>sV