tools/usb_gadget/gadget.py
def SetConfiguration(self, index):
    """Handle a SET_CONFIGURATION request from the host.

    See Universal Serial Bus Specification Revision 2.0 section 9.4.7.

    Args:
      index: Configuration index selected.

    Returns:
      True on success, None on error to stall the pipe.
    """
    print('SetConfiguration({})'.format(index))

    for endpoint_addrs in self._active_endpoints.values():
      for endpoint_addr in endpoint_addrs:
        self._chip.StopEndpoint(endpoint_addr)
      endpoint_addrs.clear()
    self._endpoint_interface_map.clear();

    if index == 0:
      # SET_CONFIGRATION(0) puts the device into the Address state which
      # Windows does before suspending the port.
      return True
    elif index != 1:
      return None

    config_desc = self.GetConfigurationDescriptor()
    for interface_desc in config_desc.GetInterfaces():
      if interface_desc.bAlternateSetting != 0:
        continue
      endpoint_addrs = self._active_endpoints.setdefault(
          interface_desc.bInterfaceNumber, set())
      for endpoint_desc in interface_desc.GetEndpoints():
        self._chip.StartEndpoint(endpoint_desc)
        endpoint_addrs.add(endpoint_desc.bEndpointAddress)
        self._endpoint_interface_map[endpoint_desc.bEndpointAddress] = \
            interface_desc.bInterfaceNumber
    return True
Handle a SET_CONFIGURATION request from the host.

    See Universal Serial Bus Specification Revision 2.0 section 9.4.7.

    Args:
      index: Configuration index selected.

    Returns:
      True on success, None on error to stall the pipe.
    
Handle a SET_CONFIGURATION request from the host.
Handle a SET_CONFIGURATION request from the host .
def SetConfiguration(self, index):
    print('SetConfiguration({})'.format(index))
    for endpoint_addrs in self._active_endpoints.values():
      for endpoint_addr in endpoint_addrs:
        self._chip.StopEndpoint(endpoint_addr)
      endpoint_addrs.clear()
    self._endpoint_interface_map.clear();
    if index == 0:
      return True
    elif index != 1:
      return None
    config_desc = self.GetConfigurationDescriptor()
    for interface_desc in config_desc.GetInterfaces():
      if interface_desc.bAlternateSetting != 0:
        continue
      endpoint_addrs = self._active_endpoints.setdefault(
          interface_desc.bInterfaceNumber, set())
      for endpoint_desc in interface_desc.GetEndpoints():
        self._chip.StartEndpoint(endpoint_desc)
        endpoint_addrs.add(endpoint_desc.bEndpointAddress)
        self._endpoint_interface_map[endpoint_desc.bEndpointAddress] = \
            interface_desc.bInterfaceNumber
    return True
def SetConfiguration ( self , index ) : print ( 'SetConfiguration({})' . format ( index ) ) for endpoint_addrs in self . _active_endpoints . values ( ) : for endpoint_addr in endpoint_addrs : self . _chip . StopEndpoint ( endpoint_addr ) endpoint_addrs . clear ( ) self . _endpoint_interface_map . clear ( ) ; if index == 0 : return True elif index != 1 : return None config_desc = self . GetConfigurationDescriptor ( ) for interface_desc in config_desc . GetInterfaces ( ) : if interface_desc . bAlternateSetting != 0 : continue endpoint_addrs = self . _active_endpoints . setdefault ( interface_desc . bInterfaceNumber , set ( ) ) for endpoint_desc in interface_desc . GetEndpoints ( ) : self . _chip . StartEndpoint ( endpoint_desc ) endpoint_addrs . add ( endpoint_desc . bEndpointAddress ) self . _endpoint_interface_map [ endpoint_desc . bEndpointAddress ] = interface_desc . bInterfaceNumber return True
Handle a SET_CONFIGURATION request from the host.
Handle a SET_CONFIGURATION request from the host .
"""Handle a SET_CONFIGURATION request from the host.

    See Universal Serial Bus Specification Revision 2.0 section 9.4.7.

    Args:
      index: Configuration index selected.

    Returns:
      True on success, None on error to stall the pipe.
    """ # SET_CONFIGRATION(0) puts the device into the Address state which # Windows does before suspending the port.
True on success, None on error to stall the pipe.
True on success None on error to stall the pipe .
self
index
Configuration index selected.
Configuration index selected .