ó ÞÀMNc@s_ddlZddlZddlZddlZyddlZWnek r\d„Zn Xd„ZejjƒZ d„Z d„Z e 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„Zne 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/dist-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/dist-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/dist-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/dist-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/dist-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/dist-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/dist-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,t sys_id_pathR7R8((sA/usr/lib/python2.7/dist-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/dist-packages/serial/tools/list_ports_posix.pytcomportsxs)tcygwincCs/tjdƒ}g|D]}|||f^qS(Ns /dev/com*(R>(R?R@((sA/usr/lib/python2.7/dist-packages/serial/tools/list_ports_posix.pyRA}stopenbsd3cCs/tjdƒ}g|D]}|||f^qS(Ns /dev/ttyp*(R>(R?R@((sA/usr/lib/python2.7/dist-packages/serial/tools/list_ports_posix.pyRA‚sitbsditfreebsdtopenbsdcCs/tjdƒ}g|D]}|||f^qS(Ns /dev/cuad*(R>(R?R@((sA/usr/lib/python2.7/dist-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/dist-packages/serial/tools/list_ports_posix.pyRAstnetbsdcCs/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/dist-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/dist-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/dist-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/dist-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/dist-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 t ImportErrorR tplatformtlowertplatRRR*R3R9R=RAR twritetnametserialtVERSIONt__name__tsortedtportR-thwid(((sA/usr/lib/python2.7/dist-packages/serial/tools/list_ports_posix.pytsV