HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/usb/__pycache__/legacy.cpython-36.pyc
3

�~�V 1�@s�ddljZddljZddljZddljZddlm	Z	dZ
ejZdZdZ
dZdZdZd	ZdZd
ZdZdZdZdZdZd
ZdZd
ZdZdZd
ZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.d	Z/dZ0dZ1dZ2dZ3dZ4dZ5dZ6d	Z7dZ8dZ9dZ:d
Z;dZ<d
Z=dZ>dZ?dZ@dZAdZBdZCdZDGdd�deE�ZFGdd�deE�ZGGd d!�d!eE�ZHGd"d#�d#ejI�ZJGd$d%�d%eE�ZKGd&d'�d'eE�ZLd(d)�ZMdS)*�N)�groupbyzWander Lairson Costa���
��	������!�)��#�"��i �� ����`�@c@seZdZdZdd�ZdS)�EndpointzEndpoint descriptor object.cCs*|j|_|j|_|j|_tj|j�|_	dS)N)
ZbEndpointAddressZaddressZ	bIntervalZintervalZwMaxPacketSize�
maxPacketSize�utilZ
endpoint_type�bmAttributes�type)�selfZep�r �/usr/lib/python3.6/legacy.py�__init__dszEndpoint.__init__N)�__name__�
__module__�__qualname__�__doc__r"r r r r!rbsrc@seZdZdZdd�ZdS)�	InterfacezInterface descriptor object.cCsD|j|_|j|_|j|_|j|_|j|_|j	|_
dd�|D�|_dS)NcSsg|]}t|��qSr )r)�.0�er r r!�
<listcomp>ssz&Interface.__init__.<locals>.<listcomp>)ZbAlternateSetting�alternateSettingZbInterfaceNumber�interfaceNumberZ
iInterfaceZbInterfaceClassZinterfaceClassZbInterfaceSubClassZinterfaceSubClassZbInterfaceProtocolZinterfaceProtocolZ	endpoints)rZintfr r r!r"lszInterface.__init__N)r#r$r%r&r"r r r r!r'jsr'c@seZdZdZdd�ZdS)�
Configurationz Configuration descriptor object.cCsx|j|_|jd>|_|jd?d@|_|jd?d@|_|j|_|j|_	dd�t
tdd�|D�dd�d	�d
d��D�|_dS)NrrrcSsg|]\}}t|��qSr )�list)r(�k�gr r r!r*sz*Configuration.__init__.<locals>.<listcomp>cSsg|]}t|��qSr )r')r(�ir r r!r*�scSs|jS)N)r,)r1r r r!�<lambda>�sz(Configuration.__init__.<locals>.<lambda>)�keycSs|jS)N)r+)r1r r r!r2�s)
ZiConfigurationZ	bMaxPowerZmaxPowerrZremoteWakeupZselfPoweredZwTotalLengthZtotalLengthZbConfigurationValue�valuer�sortedZ
interfaces)rZcfgr r r!r"ws
zConfiguration.__init__N)r#r$r%r&r"r r r r!r-usr-c@s�eZdZdd�Zdd�Zd'dd�Zd(dd	�Zd)d
d�Zd*dd
�Zd+dd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zd,d d!�Zd.d#d$�Zd%d&�ZdS)/�DeviceHandlecCs||_d|_dS)N)�dev� _DeviceHandle__claimed_interface)rr7r r r!r"�szDeviceHandle.__init__cCstj|j�d|_dS)N)rZdispose_resourcesr7)rr r r!�_finalize_object�szDeviceHandle._finalize_object�dcCs|jj|||�S)a�Perform a bulk write request to the endpoint specified.

            Arguments:
                endpoint: endpoint number.
                buffer: sequence data buffer to write.
                        This parameter can be any sequence type.
                timeout: operation timeout in miliseconds. (default: 100)
                         Returns the number of bytes written.
        )r7�write)r�endpoint�buffer�timeoutr r r!�	bulkWrite�s
zDeviceHandle.bulkWritecCs|jj|||�S)a+Performs a bulk read request to the endpoint specified.

            Arguments:
                endpoint: endpoint number.
                size: number of bytes to read.
                timeout: operation timeout in miliseconds. (default: 100)
            Return a tuple with the data read.
        )r7�read)rr<�sizer>r r r!�bulkRead�s	zDeviceHandle.bulkReadcCs|jj|||�S)a�Perform a interrupt write request to the endpoint specified.

            Arguments:
                endpoint: endpoint number.
                buffer: sequence data buffer to write.
                        This parameter can be any sequence type.
                timeout: operation timeout in miliseconds. (default: 100)
                         Returns the number of bytes written.
        )r7r;)rr<r=r>r r r!�interruptWrite�s
zDeviceHandle.interruptWritecCs|jj|||�S)a0Performs a interrupt read request to the endpoint specified.

            Arguments:
                endpoint: endpoint number.
                size: number of bytes to read.
                timeout: operation timeout in miliseconds. (default: 100)
            Return a tuple with the data read.
        )r7r@)rr<rAr>r r r!�
interruptRead�s	zDeviceHandle.interruptReadrcCs|jj||||||d�S)a�Perform a control request to the default control pipe on a device.

        Arguments:
            requestType: specifies the direction of data flow, the type
                         of request, and the recipient.
            request: specifies the request.
            buffer: if the transfer is a write transfer, buffer is a sequence
                    with the transfer data, otherwise, buffer is the number of
                    bytes to read.
            value: specific information to pass to the device. (default: 0)
                   index: specific information to pass to the device. (default: 0)
            timeout: operation timeout in miliseconds. (default: 100)
        Return the number of bytes written.
        )ZwValueZwIndexZdata_or_wLengthr>)r7Z
ctrl_transfer)rZrequestTypeZrequestr=r4�indexr>r r r!�
controlMsg�szDeviceHandle.controlMsgcCs|jj|�dS)zuClears any halt status on the specified endpoint.

        Arguments:
            endpoint: endpoint number.
        N)r7Z
clear_halt)rr<r r r!�	clearHalt�szDeviceHandle.clearHaltcCs(t|t�r|j}tj|j|�||_dS)z�Claims the interface with the Operating System.

        Arguments:
            interface: interface number or an Interface object.
        N)�
isinstancer'r,rZclaim_interfacer7r8)r�	interfacer r r!�claimInterface�s
zDeviceHandle.claimInterfacecCstj|j|j�d|_dS)z<Release an interface previously claimed with claimInterface.rN���)rZrelease_interfacer7r8)rr r r!�releaseInterface�szDeviceHandle.releaseInterfacecCs|jj�dS)z[Reset the specified device by sending a RESET
            down the port it is connected to.N)r7�reset)rr r r!rM�szDeviceHandle.resetcCs|j|�dS)zpReset all states for the specified endpoint.

        Arguments:
            endpoint: endpoint number.
        N)rG)rr<r r r!�
resetEndpoint�szDeviceHandle.resetEndpointcCs t|t�r|j}|jj|�dS)z�Set the active configuration of a device.

        Arguments:
            configuration: a configuration value or a Configuration object.
        N)rHr-r4r7Zset_configuration)rZ
configurationr r r!�setConfiguration�s
zDeviceHandle.setConfigurationcCs$t|t�r|j}|jj|j|�dS)z�Sets the active alternate setting of the current interface.

        Arguments:
            alternate: an alternate setting number or an Interface object.
        N)rHr'r+r7Zset_interface_altsettingr8)rZ	alternater r r!�setAltInterfaces
zDeviceHandle.setAltInterfaceNcCstj|j||�jd�S)aORetrieve the string descriptor specified by index
            and langid from a device.

        Arguments:
            index: index of descriptor in the device.
            length: number of bytes of the string (ignored)
            langid: Language ID. If it is omittedi, will be
                    used the first language.
        �ascii)rZ
get_stringr7�encode)rrE�lengthZlangidr r r!�	getStrings
zDeviceHandle.getStringrcCstj|j|||�S)aRetrieves a descriptor from the device identified by the type
        and index of the descriptor.

        Arguments:
            desc_type: descriptor type.
            desc_index: index of the descriptor.
            len: descriptor length.
            endpoint: ignored.
        )�controlZget_descriptorr7)rZ	desc_typeZ
desc_indexrSr<r r r!�
getDescriptors
zDeviceHandle.getDescriptorcCs t|t�r|j}|jj|�dS)z�Detach a kernel driver from the interface (if one is attached,
            we have permission and the operation is supported by the OS)

        Arguments:
            interface: interface number or an Interface object.
        N)rHr'r,r7Zdetach_kernel_driver)rrIr r r!�detachKernelDriver)s
zDeviceHandle.detachKernelDriver)r:)r:)r:)r:)rrr:)NrK)rK)r#r$r%r"r9r?rBrCrDrFrGrJrLrMrNrOrPrTrVrWr r r r!r6�s"






r6c@s eZdZdZdd�Zdd�ZdS)�DevicezDevice descriptor objectcCs|j|_|j|_|j|_t|jd?d@�t|jd?d@�dt|jd?d@�t|jd@�|_d|_	d|_
|j|_|j|_|j
|_
|j|_|j|_|j|_t|jd?d@�t|jd?d@�dt|jd?d@�t|jd@�|_dd�|D�|_||_dS)	Nrrr�.r�cSsg|]}t|��qSr )r-)r(�cr r r!r*Msz#Device.__init__.<locals>.<listcomp>)ZbDeviceClassZdeviceClassZbDeviceSubClassZdeviceSubClassZbDeviceProtocolZdeviceProtocol�strZ	bcdDeviceZ
deviceVersionZdevnum�filenameZ
iManufacturerZiProductZ
iSerialNumberZ	idProductZidVendorZbMaxPacketSize0rZbcdUSBZ
usbVersionZconfigurationsr7)rr7r r r!r"7s"88zDevice.__init__cCs
t|j�S)zGOpen the device for use.

        Return a DeviceHandle object
        )r6r7)rr r r!�openPszDevice.openN)r#r$r%r&r"r^r r r r!rX5srXc@seZdZdZdd�ZdS)�BuszBus object.cCs d|_d|_dd�|D�|_dS)NrZrcSsg|]}t|��qSr )rX)r(�dr r r!r*\sz Bus.__init__.<locals>.<listcomp>)�dirname�location�devices)rrcr r r!r"YszBus.__init__N)r#r$r%r&r"r r r r!r_Wsr_cCs,dd�tttjdd�dd�d�dd��D�S)	z#Return a tuple with the usb busses.css|]\}}t|�VqdS)N)r_)r(r/r0r r r!�	<genexpr>`szbusses.<locals>.<genexpr>T)Zfind_allcSs|jS)N)�bus)r`r r r!r2aszbusses.<locals>.<lambda>)r3cSs|jS)N)re)r`r r r!r2bs)rr5�core�findr r r r!�busses^srh)NZusb.corerfZusb.utilrZusb._objfinalizerZ
_objfinalizerZusb.controlrU�	itertoolsr�
__author__ZUSBErrorZCLASS_AUDIOZ
CLASS_COMMZ
CLASS_DATAZ	CLASS_HIDZ	CLASS_HUBZCLASS_MASS_STORAGEZCLASS_PER_INTERFACEZ
CLASS_PRINTERZCLASS_VENDOR_SPECZ	DT_CONFIGZDT_CONFIG_SIZEZ	DT_DEVICEZDT_DEVICE_SIZEZDT_ENDPOINTZDT_ENDPOINT_AUDIO_SIZEZDT_ENDPOINT_SIZEZDT_HIDZDT_HUBZDT_HUB_NONVAR_SIZEZDT_INTERFACEZDT_INTERFACE_SIZEZDT_PHYSICALZ	DT_REPORTZ	DT_STRINGZENDPOINT_ADDRESS_MASKZENDPOINT_DIR_MASKZENDPOINT_INZENDPOINT_OUTZENDPOINT_TYPE_BULKZENDPOINT_TYPE_CONTROLZENDPOINT_TYPE_INTERRUPTZENDPOINT_TYPE_ISOCHRONOUSZENDPOINT_TYPE_MASKZERROR_BEGINZ
MAXALTSETTINGZ	MAXCONFIGZMAXENDPOINTSZ
MAXINTERFACESZRECIP_DEVICEZRECIP_ENDPOINTZRECIP_INTERFACEZRECIP_OTHERZREQ_CLEAR_FEATUREZREQ_GET_CONFIGURATIONZREQ_GET_DESCRIPTORZREQ_GET_INTERFACEZREQ_GET_STATUSZREQ_SET_ADDRESSZREQ_SET_CONFIGURATIONZREQ_SET_DESCRIPTORZREQ_SET_FEATUREZREQ_SET_INTERFACEZREQ_SYNCH_FRAMEZ
TYPE_CLASSZ
TYPE_RESERVEDZ
TYPE_STANDARDZTYPE_VENDOR�objectrr'r-ZAutoFinalizedObjectr6rXr_rhr r r r!�<module>s�



/"