{QNc@sddlZddlZddlZddlZdadadZdZejddfkrodZ n d Z ej d krddl Z d e fd YZ e anej d kr&ddlZddlZddlZd e fdYZ e adZtjee_nedejdZdZdZdddfZdddfZddddfZde fdYZdZed krendS(!iNsscCs8t|}|dkr*dtd|St|SdS(s)generate a readable description for a keyi sCtrl+%ct@N(tordtrepr(t charactert ascii_code((s9/usr/lib/python2.7/site-packages/serial/tools/miniterm.pytkey_descriptions  cCsdi ttddd6ttd6ttd6tdd6td d 6td d 6td d6tdd6tdd6tdd6tdd6ttd6ttd6S(Nsw --- pySerial (%(version)s) - miniterm - help --- --- %(exit)-8s Exit program --- %(menu)-8s Menu escape key, followed by: --- Menu keys: --- %(itself)-7s Send the menu character itself to remote --- %(exchar)-7s Send the exit character itself to remote --- %(info)-7s Show info --- %(upload)-7s Upload file (prompt will be shown) --- Toggles: --- %(rts)-7s RTS %(echo)-7s local echo --- %(dtr)-7s DTR %(break)-7s BREAK --- %(lfm)-7s line feed %(repr)-7s Cycle repr mode --- --- Port settings (%(menu)s followed by the following): --- p change port --- 7 8 set data bits --- n e o s m change parity (None, Even, Odd, Space, Mark) --- 1 2 3 set stop bits (1, 2, 1.5) --- b change baud rate --- x X disable/enable software flow control --- r R disable/enable hardware flow control tVERSIONsunknown versiontversiontexittmenustrtssRstdtrs tlfmstbreakstechos tinfostuploadtitselftexchar(tgetattrtserialRt EXITCHARCTERt MENUCHARACTER(((s9/usr/lib/python2.7/site-packages/serial/tools/miniterm.pyt get_help_texts           iicCs |jdS(Ntlatin1(tdecode(tb((s9/usr/lib/python2.7/site-packages/serial/tools/miniterm.pyREscCs|S(N((R((s9/usr/lib/python2.7/site-packages/serial/tools/miniterm.pyRHstnttConsolecBs,eZdZdZdZdZRS(cCsdS(N((tself((s9/usr/lib/python2.7/site-packages/serial/tools/miniterm.pyt__init__QscCsdS(N((R((s9/usr/lib/python2.7/site-packages/serial/tools/miniterm.pytsetupTscCsdS(N((R((s9/usr/lib/python2.7/site-packages/serial/tools/miniterm.pytcleanupWscCsVxOtrQtj}|dks-|dkr:tjq|dkrJdS|SqWdS(Ntss s (tTruetmsvcrttgetch(Rtz((s9/usr/lib/python2.7/site-packages/serial/tools/miniterm.pytgetkeyZs    (t__name__t __module__RRR R&(((s9/usr/lib/python2.7/site-packages/serial/tools/miniterm.pyRPs   tposixcBs,eZdZdZdZdZRS(cCstjj|_dS(N(tsyststdintfilenotfd(R((s9/usr/lib/python2.7/site-packages/serial/tools/miniterm.pyRiscCstj|j|_tj|j}|dtj@tj@tj@|dtk rqtj||d|d|d|dd|_nX||_||_||_t|j|_t |_ t |_ t |_ dS(Ntparitytrtsctstxonxoffttimeouti(Rtserial_for_urltAttributeErrortSerialRt repr_modetconvert_outgoingtNEWLINE_CONVERISON_MAPtnewlineR"t dtr_statet rts_statetFalset break_state( RtporttbaudrateRDRERFRRLRK((s9/usr/lib/python2.7/site-packages/serial/tools/miniterm.pyRs1 1     cCsBt|_tjd|j|_|jjt|jjdS(sStart reader threadttargetN(R"t _reader_alivet threadingtThreadtreadertreceiver_threadt setDaemontstart(R((s9/usr/lib/python2.7/site-packages/serial/tools/miniterm.pyt _start_readers cCst|_|jjdS(s6Stop reader thread only, wait for clean exit of threadN(RQRVRZtjoin(R((s9/usr/lib/python2.7/site-packages/serial/tools/miniterm.pyt _stop_readers cCsLt|_|jtjd|j|_|jjt|jjdS(NRU( R"taliveR]RWRXtwriterttransmitter_threadR[R\(R((s9/usr/lib/python2.7/site-packages/serial/tools/miniterm.pyR\s   cCs t|_dS(N(RQR`(R((s9/usr/lib/python2.7/site-packages/serial/tools/miniterm.pytstopscCs'|jj|s#|jjndS(N(RbR^RZ(Rt transmit_only((s9/usr/lib/python2.7/site-packages/serial/tools/miniterm.pyR^s cCstjjd|jj|jj|jj|jj|jjftjjd|j r\dp_d|j rndpqd|j rdpdfyxtjjd|jj rdpd|jj rdpd|jjrdpd|jjrdpdfWntjk rnXtjjd|jjr8dp;dtjjd|jjr^dpadtjjdt|jt|jfdS( Ns --- Settings: %s %s,%s,%s,%s s&--- RTS: %-8s DTR: %-8s BREAK: %-8s tactivetinactives---- CTS: %-8s DSR: %-8s RI: %-8s CD: %-8s s--- software flow control: %s s--- hardware flow control: %s s$--- data escaping: %s linefeed: %s (R*tstderrtwriteRtportstrRTtbytesizeRDtstopbitsRPRORRtgetCTStgetDSRtgetRItgetCDtSerialExceptionRFREt REPR_MODESRKtLF_MODESRL(R((s9/usr/lib/python2.7/site-packages/serial/tools/miniterm.pytdump_port_settingss.       $&&  cCsyx|jr|jrt|jjd}|jdkr|dkrm|jtkrmtj j dqtj j |nF|jdkrW|jt kr|dkr|dkrtj j dqT|dkrTqTq|dkr |jt kr tj j dq|dkr7|jtkr7tj j dqtj j t |dd!no|jdkrtj j t |dd!n@|jdkrx.|D]#}tj j d |jd qWntj jqWWn"tjk r}t|_nXd S( sloop and copy serial->consoleiis s s iiis%s RBN(R`RVRRR:RKRLt CONVERT_CRR*tstdoutRht CONVERT_CRLFt CONVERT_LFRtencodetflushRpRQ(RtdataR;te((s9/usr/lib/python2.7/site-packages/serial/tools/miniterm.pyRYs6     $ c Cs> t}y x |jr" ytj}Wn#tk rJtjdg}nXt|}|rl|tksu|t kr|jj ||j rct j j |qcn|dkrt jj dt jjtjt jjjd}|ryt|d}t jj d|xftr|jjd}|sCPn|jj ||jj d|jjt jj dqWt jj d|Wqtk r}t jj d ||fqXntjn|d krt jj tnh|d krM|j |_|jj|jt jj d |jrBd pEdn|dkr|j |_|jj|jt jj d|jrd pdn|dkr|j |_|jj|jt jj d|jrd pdnr|dkr0|j |_ t jj d|j r%d p(dn3|dkrI|jn|dkr|j d7_ |j dkrd|_ nt jj dt!|j fn|dkr|j"d7_"|j"dkrd|_"nt#|j"|_$t jj dt%|j"fn\|dkrt jj dt jjtjyt jjj&}Wntk rld5}nXtj|rc||jj(krc|j)|jj*} yytj+|dt} Wn&t,k rtj-} || _(nX| j.| | j| j|j| j|j| j|jWn4t/k rk}t jj d |f| j0n4X|jj0| |_t jj d!|jj(f|j1qcn|d"krct jj d#t jjtj|jj2} y%t3t jjj&|j_2Wn6t4k rK}t jj d$|f| |j_2n X|jtjn|d%krtj5|j_6|jn|d&krtj7|j_6|jn|d'krtj8|j_9|jn|d(krtj:|j_9|jn`|d)kr+tj;|j_9|jn8|d*krStj<|j_9|jn|d+kr{tj=|j_9|jn|d,krtj>|j_?|jn|d-krtj@|j_?|jn|d.krtjA|j_?|jnp|d/kr|d0k|j_B|jnE|d1krI|d2k|j_C|jnt jj d3tD|t}q |tkrt}q |t kr|jEPq |d4kr|jj |j$|j r t j j |t j jq q |jj ||j r t j j |t j jq q WWnt|_nXd5S(6s Loop and copy console->serial until EXITCHARCTER character is found. When MENUCHARACTER is found, interpret the next key locally. iss --- File to upload: s trs--- Sending file %s --- t.s --- File %s sent --- s"--- ERROR opening file %s: %s --- shH?ss--- RTS %s --- ReRfss--- DTR %s --- ss--- BREAK %s --- ss--- local echo %s --- s siis--- escape data: %s --- s is--- line feed %s --- tpPs --- Enter port name: t do_not_opens#--- ERROR opening new port: %s --- s--- Port changed to: %s --- tbBs --- Baudrate: s#--- ERROR setting baudrate: %s --- t8t7teEtoOtmMtsStnNt1t2t3txXtXtrRtRs!--- unknown menu character %s -- s N(FRQR`R=R&tKeyboardInterruptRtto_bytesRRRRhRR*RuRgRyR R+treadlinetrstriptopenR"tIOErrorRRRPtsetRTSROtsetDTRRRtsetBreakRsRKRqRLRMRNRrtstriptNoneRSR_tgetSettingsDictRHRIRJtapplySettingsDictt ExceptiontcloseR]RTtintt ValueErrort EIGHTBITSRjt SEVENBITSt PARITY_EVENRDt PARITY_ODDt PARITY_MARKt PARITY_SPACEt PARITY_NONEt STOPBITS_ONERkt STOPBITS_TWOtSTOPBITS_ONE_POINT_FIVERFRERRc( Rt menu_activeRR;tfilenametfiletlineR{RStsettingst new_serialtbackup((s9/usr/lib/python2.7/site-packages/serial/tools/miniterm.pyRasF         !    &  &  &  &                          %                                   ( R'R(RQRvRR]R_R\RcR^RsRYRa(((s9/usr/lib/python2.7/site-packages/serial/tools/miniterm.pyRCs       (c Csddl}|jdddd}|jdddd d d d d|jd dddddddd dd d|jdddddd dd d|jddddddd dd t|jddd ddd d!d t|jd"dd#ddd d$d t|jd%dd&ddd d'd t|jd(dd)ddd d*d t|jd+d,dd-dd.d d/d d0|jd1dd2ddddd d3d d|jd4dd5ddddd d6d d|jd7d8dd9ddd d:d t|jd;dd<ddddd d=d d>|jd?dd@ddddd dAd dB|j\}}|jj|_|jdCkr|jdDn|j r|j r|jdEn|j |j kr|jdFnt |j at |j a|j}|j}|r|jdk r-|jdGn|jd0}|ryt|d0}Wn&tk r~|jdH|d0nX|jd0n|r|jdIqn|dkrd0}nt}|j rt}n|j rt}nyCt|||jd |jd#|jd|jdJ|d-|j}Wn=tjk ri}tj j!dK||ftj"dLnX|j#stj j!dM|jj$|jj|jj%|jj|jj&ftj j!dNt'tt'tt'tt'dOfn|j(dk rO|j#s-tj j!dP|j(r"dQp%dRn|jj)|j(|j(|_(n|j*dk r|j#stj j!dS|j*rdQpdRn|jj+|j*|j*|_*n|j,y|j-t.Wnt/k rnX|j#stj j!dTn|j-dS(UNitusages!%prog [options] [port [baudrate]]t descriptions9Miniterm - A simple terminal program for the serial port.s-ps--porttdestRSthelpsKport, a number or a device name. (deprecated option, use parameter instead)tdefaults-bs--baudRTtactiontstorettypeRsset baud rate, default %defaulti%s--parityRDs-set parity, one of [N, E, O, S, M], default=NtNs-es--echoRt store_truesenable local echo (default off)s--rtsctsREs)enable RTS/CTS flow control (default off)s --xonxoffRFs*enable software flow control (default off)s--crtcrsdo not send CR+LF, send CR onlys--lftlfsdo not send CR+LF, send LF onlys-Ds--debugRKtcountsdebug received data (escape non-printable chars) --debug can be given multiple times: 0: just print what is received 1: escape non-printable characters, do newlines as unusual 2: escape non-printable characters, newlines too 3: hex dump everythingis--rtsRPs2set initial RTS line state (possible values: 0, 1)s--dtrROs2set initial DTR line state (possible values: 0, 1)s-qs--quiettquietssuppress non error messagess --exit-chart exit_charsDASCII code of special character that is used to exit the applicationis --menu-chart menu_charsGASCII code of special character that is used to control miniterm (menu)itNEOSMsinvalid paritys)only one of --cr or --lf can be specifieds.--exit-char can not be the same as --menu-chars;no arguments are allowed, options only when --port is givens"baud rate must be a number, not %rstoo many argumentsRLscould not open port %r: %s is$--- Miniterm on %s: %d,%s,%s,%s --- s8--- Quit: %s | Menu: %s | Help: %s followed by %s --- ss--- forcing DTR %s ReRfs--- forcing RTS %s s --- exit --- (0toptparset OptionParsert add_optionRRQt parse_argsRDtupperterrorRRRRtchrRRRSRTtpopRRRvRtRwRCRERFRRKRRpR*RgRhRRRiRjRkRRORRPRR\R^R"R( RtparsertoptionstargsRSRTRLtminitermR{((s9/usr/lib/python2.7/site-packages/serial/tools/miniterm.pytmains0                                   & &   t__main__(R*R9RRWRRRRt version_infoRtnameR#tobjectRR=R.R>RtexitfunctNotImplementedErrortplatformRvRtRwRMRrRqRCRR'(((s9/usr/lib/python2.7/site-packages/serial/tools/miniterm.pyt s<0 (    $    )