ó J¡Vc@sÒddlZddlZddlZddlZddlZddlZddlmZddlTddl Tddl Tddl m Z m Z mZmZddlmZddlTddlZy-ddlmZddlTddljZWn+ek rejdƒejdƒnXejd d ko<ejdd krHeZnd Z dZ!d Z"d Z#d Z$dZ%dZ&dZ'dZ(d Z)dZ*dZ+d Z,dZ-d Z.de/fd„ƒYZ0de1fd„ƒYZ2dS(iÿÿÿÿN(tBytesIO(t*(tdevicetutilstpmltcodes(tcupsi(tcdlls;Marvell fax support requires python-ctypes module. Exiting!iiiii i i i i itMarvellFaxDevicecBs°eZd d d eed„Zddddd„Zd„Zd„Zd„Z e e eƒZ d„Z d„Z e e e ƒZd„Zd „Zd d d ed d d d „ZRS( cCs£tj||||||ƒd|_d|_y:tjdƒ}tj|dƒ}tj j |ƒs}tj j ||ƒ}n|}tj j |ƒ} tj j | ƒ\} } | d} tjd| ƒddlm} | jƒ}|jƒ| jkrUtjd| ƒtjdƒd }|jj||ttjd ƒ|d ƒtjd ƒntj| ƒ|_Wn4t k rž}tjd |j!ƒtjd ƒnXdS(Ns hp-sendfaxs /hp-sendfaxs/fax/plugins/fax_marvell.sosLoad the library %s iÿÿÿÿ(t pluginhandlers9Loading %s failed. Try after installing plugin libraries sSRun "hp-plugin" to installa plugin libraries if you are not automatically prompted itUSERsPlugin is not installedis Loading fax_marvell failed (%s) ("t FaxDevicet__init__tNonetsend_fax_threadtupload_log_threadRtwhichtostreadlinktpathtisabstjointrealpathtsplittlogtdebugt installerR t PluginHandlet getStatustPLUGIN_INSTALLEDterrortinfotservicet SendEventtEVENT_FAX_FAILED_MISSING_PLUGINtgetenvtsystexitRt LoadLibrarytlibfax_marvelltErrortmsg(tselft device_urit printer_nametcallbacktfax_typet disable_dbust sendfax_pathtsendfax_a_pathtsendfax_f_pathtsendfax_abs_paththeadttailtlib_nameR t pluginObjtjob_idte((s^/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/fax/marvellfax.pyR Ls8      (ic Cs£td}|ddddddddƒ}|jj|||||t|ƒƒ}t|ƒ} ytj| jƒdƒWntj| dƒnX|j| ƒ|S(Niii ( tc_intR't create_packettbyreft memoryviewRtlog_datattobytestwriteMarvellFax( R*tmsg_typetparam1tparam2tstatustdata_lent int_array_8ti_buftresulttbuf((s^/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/fax/marvellfax.pytsend_packet_for_message{s !'  cCsYtƒ}x|jd|ddƒr'q W|jƒ}tjd|ƒtj|dƒ|S(Ni ttimeouti s.response_for_message (%d): response packet is (RtreadMarvellFaxtgetvalueRRR>(R*RAtret_buf((s^/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/fax/marvellfax.pytread_response_for_messageŽs  c Csštjd|ƒtƒ}td}|ddddddddƒ}td}|ƒ}td}|ƒ}tjƒ} d| d| d| d| d | d | d f}tjd ƒtj|ƒ|jjt ddddt |ƒƒ} |jj |j t |ƒ|t |ƒƒ} t|ƒ} t|ƒ} xbtdd ƒD]Q} y*|jt | jƒ| ƒjdƒƒWq>|jt | | ƒƒq>Xq>Wx\tddƒD]K} y*|jt | jƒ| ƒjdƒƒWq£|j| | ƒq£Xq£W|jƒ}tjdƒtj|dƒ|j|ƒtƒ}x|jd |ddƒrOq4W|jƒ}|jƒ|jj|ƒ}tjd|ƒtjdƒ|S(NsK************************* setPhoneNum (%s) START **************************iii4is%4d%02d%02d%02d%02d%02diiiiisDate and Time string is ==>i sutf-8s9setPhoneNum: send SET_FAX_SETTINGS message and data ===> iTRKi ssetPhoneNum: response is %dsD************************* setPhoneNum END **************************(RRRR:tc_charttimet localtimeR'R;tSET_FAX_SETTINGSR<tcreate_fax_settings_packett station_nametstrR=trangetwriteR?tencodeRMR>R@RLtcloseMarvellFaxtextract_response(R*tnumtset_buft int_arrayRGt char_arraytc_buft date_arraytdate_bufttRHtmsg_buft msg_c_buftiRNtresponse((s^/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/fax/marvellfax.pyt setPhoneNumœsN  !     4  '*  **       c Cs˜td}|ddddddddƒ}|ddddddddƒ}tjdƒ|jjtddddt|ƒƒ}t|ƒ}|j|ƒt ƒ}x|j d|ddƒrÀq¥W|j ƒ}|j ƒ|jj |ƒ}tjd|ƒ|jj||ƒ}t ƒ}xItddƒD]8} || r(y|jt|| ƒƒWq`q`Xq(q(W|j ƒ}tjd |ƒtjd ƒt|ƒS( Niis=******************** getPhoneNum START **********************iRKi screate_packet: response is %disgetPhoneNum: ph_num_buf=%s s;******************** getPhoneNum END **********************(R:RRR'R;tGET_FAX_SETTINGSR<R=R@RRLRMRZR[textract_phone_numberRWRXRV( R*RFRGtph_bufRHRIRNRgt ph_num_bufRf((s^/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/fax/marvellfax.pyt getPhoneNumÑs4 !! '          c Cs¹tjd|ƒtd}|ddddddddƒ}tƒ}td}|ƒ}td}|ƒ}tjƒ} d| d| d| d| d | d | d f}tjd ƒtj|ƒ|jjt ddddt |ƒƒ} y(|jj ||j |t |ƒƒ} Wn$t tfk r:tjd ƒnXt|ƒ} t|ƒ} x\tddƒD]K} y*|jt| jƒ| ƒjdƒƒWqc|j| | ƒqcXqcWx\tddƒD]K} y*|jt| jƒ| ƒjdƒƒWqÂ|j| | ƒqÂXqÂW|jƒ}tjdƒtj|dƒ|j|ƒtƒ}x|jd|ddƒrnqSW|jƒ}|jƒ|jj|ƒ}tjd|ƒtjdƒ|S(NsM************************* setStationName(%s) START **************************iii4is%4d%02d%02d%02d%02d%02diiiiisDate and Time string is ==>s Unicode Errori sutf-8s7setStationName: SET_FAX_SETTINGS message and data ===> iTRKi ssetStationName: response is %dsG************************* setStationName END **************************(RRR:RRPRQRRR'R;RSR<RTt phone_numtUnicodeEncodeErrortUnicodeDecodeErrorRR=RWRXRVR?RYRMR>R@RLRZR[(R*tnameR^RGR]R_R`RaRbRcRHRdReRfRNRg((s^/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/fax/marvellfax.pytsetStationNameùsT !      4  '(  **       c Cs1td}|ddddddddƒ}tdƒ}tjdƒ|jjtddddt|ƒƒ}t|ƒ}|j |ƒt ƒ}x|j d|ddƒr«qW|j ƒ}|j ƒ|jj|ƒ}tjd|ƒ|jj||ƒ}tjd |j|fƒtjd ƒ|jjd ƒS( Niii€sI************************* getStationName START **************************iRKi sgetStationName: response is %ds.getStationName: station_name=%s ; result is %dsG************************* getStationName END **************************sutf-8(R:tcreate_string_bufferRRR'R;RiR<R=R@RRLRMRZR[textract_station_nametvaluetdecode(R*R^RGtst_bufRHRIRNRg((s^/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/fax/marvellfax.pytgetStationName1s$ !  '      c CsÒtd}|ddddddddƒ}tjdƒtdƒ}tƒ}tƒ}td}|ƒ}tjƒ}d|d|d|d|d |d |d f}tjd ƒtj|ƒ|jj t ddddt |ƒƒ} t |ƒ} xTt dd ƒD]C} y"|j| jƒ| | d!ƒWq|j| | ƒqXqW|j|jƒ|jƒ}|j|ƒx|jd|dd ƒr”qyW|jƒ}|jƒ|jj|ƒ} tjd| ƒ| S(NiisI************************* setDateAndTime START **************************i4is%4d%02d%02d%02d%02d%02diiiiisDate and Time string is ==>ii RKssetDateAndTime: response is %d(R:RRRsRRPRQRRR'R;RSR<R=RWRXR?trawRMR@RLRZR[( R*R^RGR`R]RNRaRbRcRHRdRfRg((s^/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/fax/marvellfax.pytsetDateAndTimeXs: !       4  ' "    c Csétjdƒtd}|ddddddddƒ}tdƒ}|jjtddddt|ƒƒ}t|ƒ}|j|ƒt ƒ}x|j d|ddƒr«qW|j ƒ}|j ƒ|jj |ƒ}tjd|ƒ|S(NsM************************* getFaxDeviceState: START **************************iii RKis!getFaxDeviceState: response is %d(RRR:R'R;tREQUEST_FAX_STATUSR<R=R@RRLRMRZR[(R*R^RGRBRHRIRNRg((s^/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/fax/marvellfax.pytgetFaxDeviceStateˆs  ! '     tc CsU|jƒsMt||j||||||||| ƒ |_|jjƒtStSdS(N(tisSendFaxActivetMarvellFaxSendThreadR RtstarttTruetFalse( R*tphone_num_listt fax_file_listt cover_messagetcover_ret cover_functpreserve_formattingR,t update_queuet event_queue((s^/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/fax/marvellfax.pyt sendFaxes¡s    N(t__name__t __module__R t FAX_TYPE_NONER‚R RJRORhRmtpropertyRnRrRxRURzR|R‹(((s^/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/fax/marvellfax.pyRJs" ,  5 # 8  0  RcBs/eZdddedddd„Zd„ZRS(R}c Cs2tj|||||||||| | | ƒ dS(N(t FaxSendThreadR ( R*tdevR RƒR„R…R†R‡RˆR,R‰RŠ((s^/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/fax/marvellfax.pyR ¸s cM Csœd}d}d}d}d}d}d}d}d } d } d } d } d } d} d}|jƒ}d}d}|}g|_x||kr—|jƒr²tjdƒ|}ntjd|ƒ||krûtjdƒ|jtddfƒ| }q„||kr3tjdƒ|jt ddfƒ| }q„||krktjdƒ|jt ddfƒ| }q„||kr£tjdƒ|jt ddfƒ| }q„||krhtjdd_ƒ|}zŽy|j j ƒWn-tk r }tjd|jƒ|}nJXy"|j j|_|j j|_Wn$tk rRtjdƒ|}nXWd|j jƒXq„||kr—tjdd`ƒ|j|ƒ}q„||krÆtjddaƒ|j|ƒ}q„||krtjddbƒ| }y^t|ƒ}|jtd|dfƒ|d}|djd ƒ}tjd!||fƒWn'tk rp|}tjd"ƒq„nX|j|_q„|| kr°tjd#dcƒ|j|ƒ}q„|| krßtjd$ddƒ|j| ƒ}q„|| krtjd%deƒtjd&ƒ| }q„|| kr tjd'dfƒ|}|jƒ}d}d}d(}d)}d}d}d*}d}d}d}d } d }!d }"d }#d }$d}%t}&t }'|}(xÞ |(|kr|jƒr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LWn't%k rí tjd6ƒt;}'q¥ nX|Ldkr tjdJƒt;}'Pn|jƒr4 t;}'tjdKƒPn|Kt>7}Kye|j j-t?dddt@|Lƒƒ}:|:r… tjdL|:ƒt;}'n tjdMƒ|j j9|LƒWn%tk rÊ tjdNƒt;}'PnX|Jt>}Jq¥ W|AjAdƒ|Aj=dƒq» Wq¶|(|#krâ tjdOdnƒ|$}(|j j-t?dd|'dƒ}:|:r[ tjdP|:ƒt;}'qtjdMƒ|j j/t2ƒ};|j j0j1|;ƒ}<|<r¯ tjdQ|<ƒt;}'n tjdRƒ|'rtjdSƒtBjCdTƒqq¶|(|$kr¶tjdUdoƒ|}(|j j-tDdd|'dƒ}:|:rCtjdV|:ƒt;}'natjdWƒ|j j/tDƒ};|j j0j1|;ƒ}<|<r—tjdX|<ƒt;}'n tjdYƒ|'t krÆtjdZƒ|}(ny|+jƒWntEk rçnXtFjGdTƒ|j jƒq¶q¶Wq„|| kr„tjd[dpƒ|jHr‹tjd\|j$ƒy!t)jI|j$ƒtjd]ƒWq‹tJk r‡tjd^ƒq‹Xn|}q„q„WdS(qNii iiii(i2i<iFiPiZidinixi‚s***** Job is Cancelled.s *************** STATE=(%d, 0, 0)sAborted by user.R}sSuccess.sError, aborting.sDevice busy, aborting.s%s State: Get sender infoRsUnable to open device (%s).s*Getting station-name and phone_num failed!s!%s State: Pre-render non-G3 filess%s State: Get total page counts%s State: Next recipientRqtfaxtasciisrecipient is %s num is %ssLast recipient.s%s State: Render cover pages%s State: Handle single files%s State: Merge multiple filess)Not merging the files for Marvell supports%s State: Send faxiii#sFax send aborted.sDevice is in error state=%ds&********* FAX_SEND_STATE=(%d, %d, %d)sFax send error.sFax device busy.sFax send success.s%s State: Open devices***** file name is : %s...sfile(s) are sent to the devices%s State: Check idletrbsUnable to read fax file.thplip_g3sInvalid file header. Bad magic.sTMagic=%s Version=%d Total Pages=%d hDPI=%d vDPI=%d Size=%d Resolution=%d Encoding=%dsState: device status is zero s!State: device status is non-zero s%s State: Request starts#### file_len = %ds#### tx_data_len = %ds(Sending start fax request failed with %ds#Successfully sent start fax requests start-fax request failed with %dsstart-fax request is successfuls%s State: Send data requests(Sending send-data request failed with %ds"Successfully sent send-fax requests%s State: Set paramsiDs%s State: Send pagess%Page=%d PPR=%d RPP=%d BPP=%d Thumb=%dsNo data!sJob is cancelled. Aborting...s-Sending fax-data-block request failed with %ds(Successfully sent fax-data-block requestsChannel write error.s'%s State: Send end-of-file-data requests,Sending fax-data-block packet failed with %dssend-fax request failed with %dssend-fax request is successfuls Exiting...is%s State: End the jobs)Sending end-fax-job packet failed with %ds%Successfully sent end-fax-job requests"end-fax-job request failed with %ds!end-fax-job request is successfuls1An error occurred! setting fax_send_state to DONEs%s State: CleanupsRemoving merged file: %stRemoveds Not founds********************s********************s********************s********************s********************s********************s********************s********************s********************s********************s********************s********************s********************s********************s********************s********************s********************s********************(Ktnext_recipient_genR trendered_file_listtcheck_for_cancelRRRt write_queuet STATUS_IDLEtSTATUS_COMPLETEDt STATUS_ERRORt STATUS_BUSYR‘topenR(R)RUt sender_nameRnt sender_faxtcloset pre_rendert count_pagestnexttSTATUS_SENDING_TO_RECIPIENTRYt StopIterationtrecipient_file_listt cover_paget single_filet next_file_genR‚tSUCCESSR|t device_statetDEVICE_STATE_NOT_FOUNDtftIOErrortreadtFILE_HEADER_SIZEtdecode_fax_headerRtstattST_SIZEtPAGE_HEADER_SIZERJt START_FAX_JOBROR'R[t SEND_FAX_JOBRsRtcreate_job_settings_packetRXRyRMR@RWtFAILUREtdecode_page_headertseektFAX_DATA_BLOCK_SIZEtFAX_DATA_BLOCKtlenttruncateR$R%t END_FAX_JOBt NameErrorRQtsleeptremove_temp_filetremovetOSError(MR*t STATE_DONEt STATE_ABORTEDt STATE_SUCCESSt STATE_BUSYtSTATE_READ_SENDER_INFOtSTATE_PRERENDERtSTATE_COUNT_PAGEStSTATE_NEXT_RECIPIENTtSTATE_COVER_PAGEtSTATE_SINGLE_FILEtSTATE_MERGE_FILEStSTATE_SEND_FAXt STATE_CLEANUPt STATE_ERRORtnext_recipienttrec_nametrec_numtstateR9t recipientt next_filetFAX_SEND_STATE_DONEtFAX_SEND_STATE_SUCCESStFAX_SEND_STATE_ABORTtFAX_SEND_STATE_ERRORtFAX_SEND_STATE_BUSYtFAX_SEND_STATE_DEVICE_OPENtFAX_SEND_STATE_NEXT_FILEtFAX_SEND_STATE_CHECK_IDLEt FAX_SEND_STATE_START_JOB_REQUESTtFAX_SEND_STATE_SEND_JOB_REQUESTtFAX_SEND_STATE_SET_PARAMStFAX_SEND_STATE_SEND_FAX_HEADERtFAX_SEND_STATE_SEND_FILE_DATAtFAX_SEND_STATE_END_FILE_DATAtFAX_SEND_STATE_END_JOB_REQUESTt"FAX_SEND_STATE_GET_LOG_INFORMATIONt monitor_statet current_statetfax_send_statet fax_statetfax_filetfftheadertmagictversiont total_pagesthort_dpitvert_dpit page_sizet resolutiontencodingt reserved1t reserved2t dev_statetfile_lent tx_data_lent ret_valueRNt dev_responseR`R]tno_datatret_valtpaget bytes_to_readtptpage_numtpprtrppt b_to_readtthumbnail_bytest thumbnailtbytes_to_writet total_readtdata((s^/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/fax/marvellfax.pytrunÁs”                                                                  -                           !         $                        N(RŒRR R‚R R(((s^/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/fax/marvellfax.pyR·s (3R$Rtos.pathtstructRQt threadingtioRR´tbase.gt base.codestbaseRRRRtprntRR’thpmudexttctypesRt ctypes.utiltutiltcut ImportErrorRRR%t version_infotbufferR=R·RÁR¸tGET_FAX_LOG_ENTRYRiRStCLEAR_FAX_STATUSR{R¾R¬RºR½tTTI_NONEtTTI_PREPENDED_TO_IMAGEtTTI_OVERLAYED_ON_IMAGER RRR(((s^/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/fax/marvellfax.pytsP         "     & ÿn