
    wi"                         S r Sr/ SQrSSKJr  SSKJr  \R                  rS rSr	S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g)a  usb.control - USB standard control requests

This module exports:

get_status - get recipeint status
clear_feature - clear a recipient feature
set_feature - set a recipient feature
get_descriptor - get a device descriptor
set_descriptor - set a device descriptor
get_configuration - get a device configuration
set_configuration - set a device configuration
get_interface - get a device interface
set_interface - set a device interface
zWander Lairson Costa)
get_statusclear_featureset_featureget_descriptorset_descriptorget_configurationset_configurationget_interfaceset_interfaceENDPOINT_HALTFUNCTION_SUSPENDDEVICE_REMOTE_WAKEUP	U1_ENABLE	U2_ENABLE
LTM_ENABLE    Nc                    U c  [         R                  nSnO[        U [        R                  5      (       a  [         R
                  nU R                  nOG[        U [        R                  5      (       a  [         R                  nU R                  nO[        S5      e[         R                  " U[         R                  U5      nXC4$ )Nr   zInvalid recipient.)utilCTRL_RECIPIENT_DEVICE
isinstancecore	InterfaceCTRL_RECIPIENT_INTERFACEbInterfaceNumberEndpointCTRL_RECIPIENT_ENDPOINTbEndpointAddress
ValueErrorbuild_request_typeCTRL_TYPE_STANDARD)	recipient	directionrwIndexbmRequestTypes        E/home/james-whalen/.local/lib/python3.13/site-packages/usb/control.py_parse_recipientr&   E   s    &&	It~~	.	.))++	It}}	-	-((++-..++% 33M
 ""       0   1   2   c                 z    [        U[        R                  5      u  p#U R                  USUSS9nUS   US   S-  -  $ )aI  Return the status for the specified recipient.

dev is the Device object to which the request will be
sent to.

The recipient can be None (on which the status will be queried
from the device), an Interface or Endpoint descriptors.

The status value is returned as an integer with the lower
word being the two bytes status value.
r      r$   bRequestr#   data_or_wLengthr(      )r&   r   CTRL_INctrl_transfer)devr    r$   r#   rets        r%   r   r   `   sP     -YEM


M'+%+./  1C q6SVq[!!r'   c                     U[         :X  a  U R                  U5        g[        U[        R                  5      u  p4U R                  USUUS9  g)a  Clear/disable a specific feature.

dev is the Device object to which the request will be
sent to.

feature is the feature you want to disable.

The recipient can be None (on which the status will be queried
from the device), an Interface or Endpoint descriptors.
r(   r$   r/   r#   wValueN)r   
clear_haltr&   r   CTRL_OUTr3   r4   featurer    r$   r#   s        r%   r   r   s   sI     -y! 0DMM J-%)#)#* 	 	,r'   c                 `    [        U[        R                  5      u  p4U R                  USUUS9  g)a  Set/enable a specific feature.

dev is the Device object to which the request will be
sent to.

feature is the feature you want to enable.

The recipient can be None (on which the status will be queried
from the device), an Interface or Endpoint descriptors.
   r7   N)r&   r   r:   r3   r;   s        r%   r   r      s5     -YFMm!%%&  (r'   c                     X2S-  -  n[         R                  " [         R                  [         R                  [         R                  5      nU R                  USUUUS9n[        U5      S:  a  [        S5      eU$ )aG  Return the specified descriptor.

dev is the Device object to which the request will be
sent to.

desc_size is the descriptor size.

desc_type and desc_index are the descriptor type and index,
respectively. wIndex index is used for string descriptors
and represents the Language ID. For other types of descriptors,
it is zero.
r1      r$   r/   r8   r#   r0   r-   zInvalid descriptor)r   r   r2   r   r   r3   lenUSBError)r4   	desc_size	desc_type
desc_indexr#   r8   r$   descs           r%   r   r      s}     >*F++//224M
 )'  )D 4y1}+,,Kr'   c                     X2S-  -  n[         R                  " [         R                  [         R                  [         R                  5      nU R                  USUUUS9  g)ar  Update an existing descriptor or add a new one.

dev is the Device object to which the request will be
sent to.

The desc parameter is the descriptor to be sent to the device.
desc_type and desc_index are the descriptor type and index,
respectively. wIndex index is used for string descriptors
and represents the Language ID. For other types of descriptors,
it is zero.
r1      rA   N)r   r   r:   r   r   r3   )r4   rG   rE   rF   r#   r8   r$   s          r%   r   r      s]     >*F++//224M
 %   r'   c                     [         R                  " [         R                  [         R                  [         R                  5      nU R                  USSS9S   $ )a  Get the current active configuration of the device.

dev is the Device object to which the request will be
sent to.

This function differs from the Device.get_active_configuration
method because the later may use cached data, while this
function always does a device request.
r1   r(   )r/   r0   r   )r   r   r2   r   r   r3   )r4   r$   s     r%   r   r      sZ     ++ LL 33 668M
 "#  % &'( (r'   c                 &    U R                  U5        g)zfSet the current device configuration.

dev is the Device object to which the request will be
sent to.
N)r   )r4   bConfigurationNumbers     r%   r   r      s     ./r'   c                     [         R                  " [         R                  [         R                  [         R                  5      nU R                  USUSS9S   $ )ztGet the current alternate setting of the interface.

dev is the Device object to which the request will be
sent to.

   r(   r.   r   )r   r   r2   r   r   r3   )r4   r   r$   s      r%   r	   r	      s]     ++ LL 33 99;M
  -)"#	  % &'	( (r'   c                 &    U R                  X5        g)zlSet the alternate setting of the interface.

dev is the Device object to which the request will be
sent to.
N)set_interface_altsetting)r4   r   bAlternateSettings      r%   r
   r
      s       !1Er'   )N)r   )__doc__
__author____all__usb.utilr   usb.corer   rC   r&   r   r   r   r   r   r   r   r   r   r   r   r   r   r	   r
    r'   r%   <module>rX      s   > $
   ==#(   		
"&,(("@ 4((0("Fr'   