%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/share/hplip/base/__pycache__/
Upload File :
Create Path :
Current File : //usr/share/hplip/base/__pycache__/smart_install.cpython-312.pyc

�

=	f3.���ddlZddlZddlZddlZddl�ddlmZmZddlm	Z	m
Z
ddl�ddl�dZ
d�Zd�Zd	�Zd
�Zdd�Zd�Zdd
�Zy)�N�)�*)�utils�tui)�password�
validationz+http://hplip.sourceforge.net/hplip_web.confc�B�d}ddddd�}tjdtj�tjdtj�tjdtj�tjdtj�d�}tjdd	�}|r�tj
|�d
|�d�ddd�
�\}}|dk(r�|j
�D]�}|D]�}||vs�|dz
}||j|�r'||j|�jd�||<ntjd|z�d|k(r||j�dk7rdifccSd|k(r||dk(rdifccSn|t|�k(s��d	|fSd	|fS)Nr�)�idVendor�iProduct�bNumInterfaces�bInterfaceClassz"\s*idVendor\s*([0-9a-fx]{1,})\s*.*z"\s*iProduct\s*[0-9a-fx]{1,}\s*(.*)z!\s*bNumInterfaces\s*(\d{1,})\s*.*z"\s*bInterfaceClass\s*(\d{1,})\s*.*�lsusbTz -d z -vF)�passwordObj�pswd_msg�
log_outputrz:TBD... Shouldn't have entered into this condition. key[%s]r�0x03f0r)
�re�compile�Ir�which�run�
splitlines�match�group�log�warn�lower�len)	�vid_pid�
result_cnt�param_result�param_search�	lsusb_cmd�sts�out�l�ss	         �&/usr/share/hplip/base/smart_install.py�get_usb_detailsr*-s����J�!�b�B�Z\�]�L� "�
�
�+T�VX�VZ�VZ� [�!#���,U�WY�W[�W[�!\�')�z�z�2Z�\^�\`�\`�'a�(*�
�
�3\�^`�^b�^b�(c�g�L�
���G�D�)�I���)�)�9�g�>�d�]_�lq�r���C��!�8��^�^�%�
��%�
�A��A�v�"�a��
�'��?�0�0��3�.:�1�o�.C�.C�A�.F�.L�.L�Q�.O�L��O��H�H�%a�bc�%c�d�%�!�+��Q��0E�0E�0G�8�0S�#(�"�9�,�'�1�_��a��B�1F�#(�"�9�,��
���\�!2�2������'
�&����c
��g}tjdd�}|stjd�|S	tj|�\}}|dk7rtjd|z�|S|j�D]�}t
jdtj�}|j|�r�|j|�jd�}t|�\}}|s�itjd|d	�d
|d�d|d
�d��|ddk(s��|d
dk(s��d|d	j�vs��|j|d	���tjd|z���	|rtj"|�}|S#t $rY�$wxYw)NrTz Failed to find the lsusb commandrzFailed to run the %s commandz .*([0-9a-f]{4}:([0-9a-f]{4}))\s*rz	Product['rz'],Interfaces[r
z],InterfaceClass[r�]�1�8�laserjetz-Failed to find vid and pid for USB device[%s])rrr�errorrrrrrrrr*�debugr�appendr�KeyError�
uniqueList)	�smartinstall_dev_listr$r%r&�d�usb_dev_patr �bsts�
usb_paramss	         r)� get_smartinstall_enabled_devicesr;Us��������G�D�)�I���	�	�4�5�$�$�
��)�)�I�&���C��1�9��I�I�4�Y�>�?�(�(����!�	L�A��*�*�%L�b�d�d�S�K�� � ��#�%�+�+�A�.�4�4�Q�7��#2�7�#;� ��j����	�	�Z�Xb�Mc�eo�qA�fB�CM�N_�C`�a�b��.�/�3�6�:�FW�;X�\_�;_�dn�r|�~H�sI�sO�sO�sQ�eQ�)�0�0��J�1G�H����H��J�K�	L�(� %� 0� 0�1F� G�� � ��
�
��
�s*�6E<�*B)E<�E<�E<�3/E<�<	F�Fc��t�}|ryy)NTF)r;)�devicess r)�check_SmartInstallr>}s��.�0�G���r+c�t�d\}}tj�stjd�||fStjt
�\}}|dk(rFt
|�}|jddd�}|rd}||fStjdt
z�||fStjdt
z�||fS)	N)r
r
�Internet connection not found.r�
SMART_INSTALL�	referencer
zSmartInstallDisable-Tool.run�Failed to download %s.)r�check_network_connectionrr1�download_from_network�HPLIP_INFO_SITE�
ConfigBase�get)�url�	file_namer%�
HPLIP_file�
hplip_si_confs     r)�get_SmartInstall_tool_inforM�s����N�C���)�)�+��	�	�2�3��	�>�� �5�5�o�F���Z��!�8�&�z�2�M��#�#�O�K��C�C��:�	��	�>��	�	�	�2�?�B�C��	�>��
�I�I�.��>�?��	�>�r+c�.�tjt|d�j��}tjd|z�|r ||k7rtttdt�fStj�}|j||�\}}||||fS)N�rzFile checksum=%sr)
r�get_checksum�open�readrr2�ERROR_FILE_CHECKSUM�queryString�ERROR_CHECKSUM_ERROR�plugin_filer�GPG_Verification�validate)�mode�smart_install_run�smart_install_asc�req_checksum�
calc_checksum�gpg_obj�
digsig_sts�	error_strs        r)rXrX�s����&�&�t�,=�s�'C�'H�'H�'J�K�M��I�I� �=�0�1���
�5�"�K�0D�a��$U�U�U��)�)�+�G�#�,�,�->�@Q�R��J�	��(�*;�Y�F�Fr+c	���tj�s,tjd�tddtt�fStjt�\}}|dk(rYt|�}|jddd�}|s9tjdtz�tddttdt�fStj�\}}|r1tjd|z�tddttd|�fStj|dz�\}}|r7tjd|dzz�tddttd|dz�fSt|||�\}}}}	||||	fS)Nr@r
rrArIrCz.asc)rrDrr1�ERROR_NO_NETWORKrTrErFrGrH�ERROR_FAILED_TO_DOWNLOAD_FILErX)
rYrr%rKrL�sourcerZr[r_r`s
          r)�downloadre�sa���)�)�+��	�	�2�3���b�+�6F�*G�G�G� �5�5�o�F���Z��!�8�&�z�2�M�"�&�&��u�R�@�F���	�	�2�?�B�C�4�b�2�{�Kh�jk�m|�?}�}�}�!&�!<�!<�V�!D���
���I�I�.�v�5�6�0�"�r�;�Gd�fg�io�;p�p�p�!&�!<�!<�V�F�]�!K���
���I�I�.��v�
�>�?�0�"�r�;�Gd�fg�io�rx�ix�;y�y�y�FN�t�Uf�hy�Fz�C�
�%�'8�)��,�.?��J�Jr+c��t�}|s*tjd�tt	t�fSt
}t	t
�}t
�\}}	tj|�}
	|tk(r�|dk(r	ddl
m}|d|
�d|�d���n)tj�s1tjd	tz�t
t	t
�fS|r|r|j!|
d
t"�n'	|dk(rddlm}n|d
k(rddlm}d|
d
t"�}tjd�|j+�t-�r|j/d|z��n\|j1d��nItjd|
z�t3j4dddgd�\}
}|
r|dk7rt
}t	t
�}n�t7||�\}}}}d}|}|t8k(rd}nN|t:t<fvr5t3j>d�\}
}|
r|stAjBd�nd}nt	|�}|r�tjDd|z�\}}|s
t-�rCtjd�tjd|z�t
}t	t
�}ntjGd�t8}d
}||fS#t$rtjd|
�d|�d��Y�+wxYw#t$rtjd�Y���wxYw#tH$r0tjd�tAjBd�Y||fSwxYw)NzNo Smart Install Device found�qt3r)�FailureMessageUIzSmart Install is enabled in zT device(s).

Auto Smart Install disable is not supported in QT3.
Please refer link 'z' to disable manuallyzS device(s).
Auto Smart Install disable is not supported in QT3.
Please refer link 'z+%s requires GUI support . Is Qt4 installed?r
�qt4)�QueuesDiagnose�qt5z0Unable to load Qt4/Qt5 support. Is it installed?zStarting GUI loop...zLFailed to disable smart install.
Please refer link '%s' for more informationz$Smart install disabled successfully.z*Smart Install is enabled in %s device(s). zADo you want to download and disable smart install?(y=yes*, n=no):�y�nFTz:Digital Sign verification failed, Do you want to continue?zsh %sz!Failed to disable smart install .z*Please refer link '%s' to disable manuallyz	User exit)%r;rr2�ERROR_NO_SI_DEVICErT�ERROR_FAILED_TO_DISABLE_SIrMr�list_to_string�GUI_MODE�ui.setupformrh�ImportErrorr1�canEnterGUIMode4�__mod__�init�QUEUES_SMART_INSTALL_ENABLED�ui4.queuesconfrj�ui5.queuesconf�exec_r>�showMessage�showSuccessMessager�enter_choicere�
ERROR_SUCCESS�ERROR_UNABLE_TO_RECV_KEYS�ERROR_DIGITAL_SIGN_NOT_FOUND�enter_yes_no�sys�exitr�info�KeyboardInterrupt)rY�
ui_toolkit�dialog�appr�dev_list�
return_val�return_error_strrIrJ�
printer_namesrhrj�response�valuer%rZr[r`�
disable_sir&s                     r)�disabler��s��/�1�H���	�	�1�2�!�;�/A�#B�B�B�+�J�"�#=�>��/�1�N�C���)�)�(�3�M�P��8���U�"�K�=�%�xE�FI�&J�K��-�-�/��I�I�K�g�U�V�5�{�C]�7^�^�^��c��K�K�
�r�3O�P�f�%��.�E�'�5�0�E�"0��m�R�Hd�!e���	�	�0�1�����%�'��&�&�'x�z}�'}�~��-�-�.T�U�

�I�I�B�=�P�Q�!�.�.�/r�tw�y|�s}�@C�D�O�H�e��u��|�7�
�#.�/I�#J� �HP�PT�Va�Gb�D��&�(9�9�"�
� �
��-�'�!%�J��6�8T�U�U�&)�&6�&6�7s�&t�O�H�e�#�5������%)�
�'2�3�'7�$��$�y�y��1B�)B�C�H�C���0�2��	�	�"E�F��	�	�"P�QT�"T�U�%?�
�+6�7Q�+R�(����!G�H�%2�
�+-�(��'�'�'��[#�B��I�I�o|�}@�A�B�B��$'�V��	�	�"T�U�V��n���	�	�+��������'�'�'�	�sb�/L�>K�AL�L�7K-�F0L�%K*�'L�)K*�*L�-L�L�L�L�3M�
M)r
)riNNN)r��os.path�osr�gr
rr�baserr�
base.codes�base.stringsrFr*r;r>rMrXrer��r+r)�<module>r�sS��0��	�	���%���?���P%!�P��$
G�"K�:^(r+

Zerion Mini Shell 1.0