HEX
Server: LiteSpeed
System: Linux shams.tasjeel.ae 5.14.0-611.5.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 11 08:09:09 EST 2025 x86_64
User: infowars (1469)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //usr/lib/python3.9/site-packages/usb/__pycache__/legacy.cpython-39.opt-1.pyc
a

j��Y,1�@s�ddlmZddlmZddlmZddlmZddlm	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|_t�|j�|_	dS�N)
ZbEndpointAddress�addressZ	bInterval�intervalZwMaxPacketSize�
maxPacketSize�utilZ
endpoint_type�bmAttributes�type)�selfZep�r#�./usr/lib/python3.9/site-packages/usb/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>s�z&Interface.__init__.<locals>.<listcomp>)ZbAlternateSetting�alternateSettingZbInterfaceNumber�interfaceNumberZ
iInterfaceZbInterfaceClassZinterfaceClassZbInterfaceSubClassZinterfaceSubClassZbInterfaceProtocolZinterfaceProtocolZ	endpoints)r"Zintfr#r#r$r%lszInterface.__init__Nr&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.�r/cSs|jSr)r1�r7r#r#r$�<lambda>�r/z(Configuration.__init__.<locals>.<lambda>��keycSs|jSr)r0r8r#r#r$r9�r/)
ZiConfigurationZ	bMaxPowerZmaxPowerr ZremoteWakeupZselfPoweredZwTotalLengthZtotalLengthZbConfigurationValue�valuer�sortedZ
interfaces)r"Zcfgr#r#r$r%ws���zConfiguration.__init__Nr&r#r#r#r$r2usr2c@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|_dSr)�dev� _DeviceHandle__claimed_interface�r"r?r#r#r$r%�szDeviceHandle.__init__cCst�|j�d|_dSr)rZdispose_resourcesr?�r"r#r#r$�_finalize_object�szDeviceHandle._finalize_object�dcCs|j�|||�S)awPerform 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 milliseconds. (default: 100)
            Returns the number of bytes written.
        �r?�write�r"�endpoint�buffer�timeoutr#r#r$�	bulkWrite�s
zDeviceHandle.bulkWritecCs|j�|||�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 milliseconds. (default: 100)
            Returns a tuple with the data read.
        �r?�read�r"rH�sizerJr#r#r$�bulkRead�s	zDeviceHandle.bulkReadcCs|j�|||�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 milliseconds. (default: 100)
            Returns the number of bytes written.
        rErGr#r#r$�interruptWrite�s
zDeviceHandle.interruptWritecCs|j�|||�S)a2Performs a interrupt read request to the endpoint specified.

            Arguments:
                endpoint: endpoint number.
                size: number of bytes to read.
                timeout: operation timeout in milliseconds. (default: 100)
            Returns a tuple with the data read.
        rLrNr#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 milliseconds. (default: 100)
        Returns the number of bytes written.
        )ZwValueZwIndexZdata_or_wLengthrJ)r?Z
ctrl_transfer)r"ZrequestTypeZrequestrIr<�indexrJr#r#r$�
controlMsg�s�zDeviceHandle.controlMsgcCs|j�|�dS)zuClears any halt status on the specified endpoint.

        Arguments:
            endpoint: endpoint number.
        N)r?Z
clear_halt�r"rHr#r#r$�	clearHalt�szDeviceHandle.clearHaltcCs(t|t�r|j}t�|j|�||_dS)z�Claims the interface with the Operating System.

        Arguments:
            interface: interface number or an Interface object.
        N)�
isinstancer+r1rZclaim_interfacer?r@�r"Z	interfacer#r#r$�claimInterface�s
zDeviceHandle.claimInterfacecCst�|j|j�d|_dS)z<Release an interface previously claimed with claimInterface.���N)rZrelease_interfacer?r@rBr#r#r$�releaseInterface�szDeviceHandle.releaseInterfacecCs|j��dS)z[Reset the specified device by sending a RESET
            down the port it is connected to.N)r?�resetrBr#r#r$r\�szDeviceHandle.resetcCs|�|�dS)zpReset all states for the specified endpoint.

        Arguments:
            endpoint: endpoint number.
        N)rVrUr#r#r$�
resetEndpoint�szDeviceHandle.resetEndpointcCs t|t�r|j}|j�|�dS)z�Set the active configuration of a device.

        Arguments:
            configuration: a configuration value or a Configuration object.
        N)rWr2r<r?Zset_configuration)r"Z
configurationr#r#r$�setConfiguration�s
zDeviceHandle.setConfigurationcCs$t|t�r|j}|j�|j|�dS)z�Sets the active alternate setting of the current interface.

        Arguments:
            alternate: an alternate setting number or an Interface object.
        N)rWr+r0r?Zset_interface_altsettingr@)r"Z	alternater#r#r$�setAltInterfaces
zDeviceHandle.setAltInterfaceNcCst�|j||��d�S)aNRetrieve 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 omitted, the first
                    language will be used.
        �ascii)rZ
get_stringr?�encode)r"rS�lengthZlangidr#r#r$�	getStrings
zDeviceHandle.getStringrZcCst�|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_descriptorr?)r"Z	desc_typeZ
desc_indexrbrHr#r#r$�
getDescriptors
zDeviceHandle.getDescriptorcCs t|t�r|j}|j�|�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)rWr+r1r?Zdetach_kernel_driverrXr#r#r$�detachKernelDriver)s
zDeviceHandle.detachKernelDriver)rD)rD)rD)rD)rrrD)N)rZ)r'r(r)r%rCrKrPrQrRrTrVrYr[r\r]r^r_rcrerfr#r#r#r$r>�s"






r>c@s eZdZdZdd�Zdd�ZdS)�DevicezDevice descriptor objectcCs|j|_|j|_|j|_t|jd?d@�t|jd?d@�dt|jd?d@�t|jd@�|_|j	|_
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#)r2)r,�cr#r#r$r.Mr/z#Device.__init__.<locals>.<listcomp>)ZbDeviceClassZdeviceClassZbDeviceSubClassZdeviceSubClassZbDeviceProtocolZdeviceProtocol�strZ	bcdDeviceZ
deviceVersionrZdevnum�filenameZ
iManufacturerZiProductZ
iSerialNumberZ	idProductZidVendorZbMaxPacketSize0rZbcdUSBZ
usbVersionZconfigurationsr?rAr#r#r$r%7s>��������zDevice.__init__cCs
t|j�S)zHOpen the device for use.

        Returns a DeviceHandle object
        )r>r?rBr#r#r$�openPszDevice.openN)r'r(r)r*r%rmr#r#r#r$rg5srgc@seZdZdZdd�ZdS)�BuszBus object.cCs*d|_dd�|D�|_|jdjj|_dS)NricSsg|]}t|��qSr#)rg)r,�dr#r#r$r.[r/z Bus.__init__.<locals>.<listcomp>r)�dirname�devicesr?�bus�location)r"rqr#r#r$r%YszBus.__init__Nr&r#r#r#r$rnWsrncCs,dd�tttjdd�dd�d�dd��D�S)	z$Returns a tuple with the usb busses.css|]\}}t|�VqdSr)rnr4r#r#r$�	<genexpr>`r/zbusses.<locals>.<genexpr>T)Zfind_allcSs|jSr�rr�ror#r#r$r9ar/zbusses.<locals>.<lambda>r:cSs|jSrrurvr#r#r$r9br/)rr=�core�findr#r#r#r$�busses^s�ry)NZusb.corerwZusb.utilrZusb._objfinalizerZ
_objfinalizerZusb.controlrd�	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+r2ZAutoFinalizedObjectr>rgrnryr#r#r#r$�<module>s�/"