
    wi(2                        S SK Jr  S SKJr  S SKJr  S SKJr  S SKJ	r	  Sr
\R                  rSrSrSrSrSrS	rS rS
rSrSrSrSrSrSrSrSrS
rSrSrS
rSr Sr!Sr"Sr#Sr$Sr%Sr&Sr'S r(Sr)S r*Sr+Sr,Sr-Sr.Sr/S	r0Sr1Sr2Sr3S r4Sr5Sr6Sr7Sr8S	r9Sr:Sr;S r<Sr=Sr>S
r?Sr@SrASrBSrCSrDSrES rFSrG " S S\H5      rI " S S \H5      rJ " S! S"\H5      rK " S# S$\R                  5      rM " S% S&\H5      rN " S' S(\H5      rOS) rPg)*    N)groupbyzWander Lairson Costa      
      	                     !   )      #   "         i               `   @   c                       \ rS rSrSrS rSrg)Endpointg   zEndpoint descriptor object.c                     UR                   U l        UR                  U l        UR                  U l        [        R                  " UR                  5      U l	        g N)
bEndpointAddressaddress	bIntervalintervalwMaxPacketSizemaxPacketSizeutilendpoint_typebmAttributestype)selfeps     D/home/james-whalen/.local/lib/python3.13/site-packages/usb/legacy.py__init__Endpoint.__init__i   s>    **..&&r7	    )r"   r$   r&   r*   N__name__
__module____qualname____firstlineno____doc__r.   __static_attributes__ r0   r-   r   r   g   s
    &8r0   r   c                       \ rS rSrSrS rSrg)	Interfaceo   zInterface descriptor object.c                    UR                   U l        UR                  U l        UR                  U l        UR
                  U l        UR                  U l        UR                  U l
        U Vs/ s H  n[        U5      PM     snU l        g s  snf r    )bAlternateSettingalternateSettingbInterfaceNumberinterfaceNumber
iInterfacebInterfaceClassinterfaceClassbInterfaceSubClassinterfaceSubClassbInterfaceProtocolinterfaceProtocolr   	endpoints)r+   intfes      r-   r.   Interface.__init__q   sp     $ 6 6#44//"22!%!8!8!%!8!8/34t!(1+t44s   +B	)r>   rH   rA   rC   r@   rG   rE   Nr1   r8   r0   r-   r:   r:   o   s
    '5r0   r:   c                       \ rS rSrSrS rSrg)Configurationz   z Configuration descriptor object.c           
         UR                   U l         UR                  S-  U l        UR                  S-	  S-  U l        UR                  S-	  S-  U l        UR                  U l        UR                  U l	        [        [        U Vs/ s H  n[        U5      PM     snS S9S 5       VVs/ s H  u  p4[        U5      PM     snnU l        g s  snf s  snnf )Nr   r   r   c                     U R                   $ r    )r@   is    r-   <lambda>(Configuration.__init__.<locals>.<lambda>   s
    a6G6Gr0   keyc                     U R                   $ r    )r>   rQ   s    r-   rS   rT      s
    a.@.@r0   )iConfiguration	bMaxPowermaxPowerr)   remoteWakeupselfPoweredwTotalLengthtotalLengthbConfigurationValuevaluer   sortedr:   list
interfaces)r+   cfgrR   kgs        r-   r.   Configuration.__init__|   s    !00* --2a7,,1Q6++,,
07$*?B(Cs!1s(C,G%& %A1B1BDG 1B )Ds   C
)C)rX   rc   rZ   r[   r\   r^   r`   Nr1   r8   r0   r-   rM   rM   z   s
    +r0   rM   c                       \ rS rSrS rS rSS jrSS jrSS jrSS jr	SS jr
S	 rS
 rS rS rS rS rS rSS jrSS jrS rSrg)DeviceHandle   c                     Xl         S U l        g r    )dev _DeviceHandle__claimed_interface)r+   rl   s     r-   r.   DeviceHandle.__init__   s    #' r0   c                     [        U S5      (       a:  U R                  (       a(  [        R                  " U R                  5        S U l        g g g )Nrl   )hasattrrl   r'   dispose_resourcesr+   s    r-   _finalize_objectDeviceHandle._finalize_object   s6    4DHH""488,DH %-r0   c                 :    U R                   R                  XU5      $ )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 milliseconds. (default: 100)
Returns the number of bytes written.
rl   writer+   endpointbuffertimeouts       r-   	bulkWriteDeviceHandle.bulkWrite        xx~~h88r0   c                 :    U R                   R                  XU5      $ )zPerforms 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.
rl   readr+   ry   sizer{   s       r-   bulkReadDeviceHandle.bulkRead        xx}}XW55r0   c                 :    U R                   R                  XU5      $ )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.
rv   rx   s       r-   interruptWriteDeviceHandle.interruptWrite   r~   r0   c                 :    U R                   R                  XU5      $ )zPerforms 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.
r   r   s       r-   interruptReadDeviceHandle.interruptRead   r   r0   c           	      >    U R                   R                  UUUUUUS9$ )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.
)wValuewIndexdata_or_wLengthr{   )rl   ctrl_transfer)r+   requestTyperequestrz   r`   indexr{   s          r-   
controlMsgDeviceHandle.controlMsg   s2     xx%%""&,% & ' 	'r0   c                 :    U R                   R                  U5        g)z]Clears any halt status on the specified endpoint.

Arguments:
    endpoint: endpoint number.
N)rl   
clear_haltr+   ry   s     r-   	clearHaltDeviceHandle.clearHalt   s     	H%r0   c                     [        U[        5      (       a  UR                  n[        R                  " U R
                  U5        Xl        g)ztClaims the interface with the Operating System.

Arguments:
    interface: interface number or an Interface object.
N)
isinstancer:   r@   r'   claim_interfacerl   rm   r+   	interfaces     r-   claimInterfaceDeviceHandle.claimInterface   s6     i++!11ITXXy1#, r0   c                 h    [         R                  " U R                  U R                  5        SU l        g)z<Release an interface previously claimed with claimInterface.N)r'   release_interfacerl   rm   rr   s    r-   releaseInterfaceDeviceHandle.releaseInterface   s$    txx)A)AB#% r0   c                 8    U R                   R                  5         g)zOReset the specified device by sending a RESET
down the port it is connected to.N)rl   resetrr   s    r-   r   DeviceHandle.reset   s     	r0   c                 &    U R                  U5        g)zXReset all states for the specified endpoint.

Arguments:
    endpoint: endpoint number.
N)r   r   s     r-   resetEndpointDeviceHandle.resetEndpoint   s     	x r0   c                 |    [        U[        5      (       a  UR                  nU R                  R	                  U5        g)zzSet the active configuration of a device.

Arguments:
    configuration: a configuration value or a Configuration object.
N)r   rM   r`   rl   set_configuration)r+   configurations     r-   setConfigurationDeviceHandle.setConfiguration  s.     m]33(..=""=1r0   c                     [        U[        5      (       a  UR                  nU R                  R	                  U R
                  U5        g)zSets the active alternate setting of the current interface.

Arguments:
    alternate: an alternate setting number or an Interface object.
N)r   r:   r>   rl   set_interface_altsettingrm   )r+   	alternates     r-   setAltInterfaceDeviceHandle.setAltInterface  s6     i++ 119))$*B*BINr0   Nc                 b    [         R                  " U R                  X5      R                  S5      $ )a  Retrieve 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)r'   
get_stringrl   encode)r+   r   lengthlangids       r-   	getStringDeviceHandle.getString  s$     txx7>>wGGr0   c                 F    [         R                  " U R                  X1U5      $ )zRetrieves 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.
)controlget_descriptorrl   )r+   	desc_type
desc_indexr   ry   s        r-   getDescriptorDeviceHandle.getDescriptor#  s     %%dhh:NNr0   c                 |    [        U[        5      (       a  UR                  nU R                  R	                  U5        g)zDetach 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)r   r:   r@   rl   detach_kernel_driverr   s     r-   detachKernelDriverDeviceHandle.detachKernelDriver/  s.     i++!11I%%i0r0   )__claimed_interfacerl   )d   )r   r   r   r    )r   )r2   r3   r4   r5   r.   rs   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r7   r8   r0   r-   ri   ri      sZ    (

9	6
9	6'.&
-&

!	2	O
H
O
1r0   ri   c                   $    \ rS rSrSrS rS rSrg)Devicei;  zDevice descriptor objectc                    UR                   U l        UR                  U l        UR                  U l        [        UR                  S-	  S-  5      [        UR                  S-	  S-  5      -   S-   [        UR                  S-	  S-  5      -   [        UR                  S-  5      -   U l        UR                  U l
        SU l        UR                  U l        UR                  U l        UR                  U l        UR                  U l        UR                   U l        UR"                  U l        [        UR&                  S-	  S-  5      [        UR&                  S-	  S-  5      -   S-   [        UR&                  S-	  S-  5      -   [        UR&                  S-  5      -   U l        U Vs/ s H  n[+        U5      PM     snU l        Xl        g s  snf )Nr   r   r	   .r    )bDeviceClassdeviceClassbDeviceSubClassdeviceSubClassbDeviceProtocoldeviceProtocolstr	bcdDevicedeviceVersionr"   devnumfilenameiManufactureriProductiSerialNumber	idProductidVendorbMaxPacketSize0r&   bcdUSB
usbVersionrM   configurationsrl   )r+   rl   cs      r-   r.   Device.__init__=  s   ++!11!11 #--2"5!<=!!3s :;<   !!3s :;<   34	5
 kk .. .. 00szzR/367cjjAo456 cjjAo456 SZZ#-.	/
 :==A}Q/= >s   Gc                 ,    [        U R                  5      $ )z8Open the device for use.

Returns a DeviceHandle object
)ri   rl   rr   s    r-   openDevice.openV  s    
 DHH%%r0   )r   rl   r   r   r   r   r   r   r   r   r   r   r   r&   r   N)r2   r3   r4   r5   r6   r.   r   r7   r8   r0   r-   r   r   ;  s    #2&r0   r   c                       \ rS rSrSrS rSrg)Busi]  zBus object.c                     SU l         U Vs/ s H  n[        U5      PM     snU l        U R                  S   R                  R                  U l        g s  snf )Nr   r   )dirnamer   devicesrl   buslocation)r+   r   ds      r-   r.   Bus.__init___  sC    +237aq	73Q++// 4s   A)r   r   r   Nr1   r8   r0   r-   r   r   ]  s
    0r0   r   c            	      `    S [        [        [        R                  " SS9S S9S 5       5       $ )z$Returns a tuple with the usb busses.c              3   <   #    U  H  u  p[        U5      v   M     g 7fr    )r   ).0re   rf   s      r-   	<genexpr>busses.<locals>.<genexpr>f  s         tqCFF  s   T)find_allc                     U R                   $ r    r   r   s    r-   rS   busses.<locals>.<lambda>g  s    155r0   rU   c                     U R                   $ r    r   r   s    r-   rS   r   h  s    aeer0   )r   ra   corefindr8   r0   r-   bussesr  d  s.    w499d+A   r0   )Qusb.corer   usb.utilr'   usb._objfinalizer_objfinalizerusb.controlr   	itertoolsr   
__author__USBErrorCLASS_AUDIO
CLASS_COMM
CLASS_DATA	CLASS_HID	CLASS_HUBCLASS_MASS_STORAGECLASS_PER_INTERFACECLASS_PRINTERCLASS_WIRELESS_CONTROLLERCLASS_VENDOR_SPEC	DT_CONFIGDT_CONFIG_SIZE	DT_DEVICEDT_DEVICE_SIZEDT_ENDPOINTDT_ENDPOINT_AUDIO_SIZEDT_ENDPOINT_SIZEDT_HIDDT_HUBDT_HUB_NONVAR_SIZEDT_INTERFACEDT_INTERFACE_SIZEDT_PHYSICAL	DT_REPORT	DT_STRINGENDPOINT_ADDRESS_MASKENDPOINT_DIR_MASKENDPOINT_INENDPOINT_OUTENDPOINT_TYPE_BULKENDPOINT_TYPE_CONTROLENDPOINT_TYPE_INTERRUPTENDPOINT_TYPE_ISOCHRONOUSENDPOINT_TYPE_MASKERROR_BEGINMAXALTSETTING	MAXCONFIGMAXENDPOINTSMAXINTERFACES%PROTOCOL_BLUETOOTH_PRIMARY_CONTROLLERRECIP_DEVICERECIP_ENDPOINTRECIP_INTERFACERECIP_OTHERREQ_CLEAR_FEATUREREQ_GET_CONFIGURATIONREQ_GET_DESCRIPTORREQ_GET_INTERFACEREQ_GET_STATUSREQ_SET_ADDRESSREQ_SET_CONFIGURATIONREQ_SET_DESCRIPTORREQ_SET_FEATUREREQ_SET_INTERFACEREQ_SYNCH_FRAMESUBCLASS_RF_CONTROLLER
TYPE_CLASSTYPE_RESERVEDTYPE_STANDARDTYPE_VENDORobjectr   r:   rM   AutoFinalizedObjectri   r   r   r  r8   r0   r-   <module>rH     s  >   )  #
==

		    		  		  		       	() %        
8v 8	5 	5F $m1=44 m1^ &V  &D0& 0r0   