tools/usb_gadget/gadget.py
def VendorControlRead(self, recipient, request, value, index, length):
    """Handle vendor-specific control transfers.

    This function should be overridden by a subclass if implementing a device
    that responds to vendor-specific requests.

    Args:
      recipient: Request recipient (device, interface, endpoint, etc.)
      request: bRequest field of the setup packet.
      value: wValue field of the setup packet.
      index: wIndex field of the setup packet.
      length: Maximum amount of data the host expects the device to return.

    Returns:
      A buffer to return to the USB host with len <= length on success or
      None to stall the pipe.
    """
    if (self._ms_vendor_code_v1 is not None and
        request == self._ms_vendor_code_v1 and
        (recipient == usb_constants.Recipient.DEVICE or
         recipient == usb_constants.Recipient.INTERFACE)):
      return self.GetMicrosoftOSDescriptorV1(recipient, value, index, length)
    if (self._ms_vendor_code_v2 is not None and
        request == self._ms_vendor_code_v2 and
        recipient == usb_constants.Recipient.DEVICE and
        value == 0x0000 and
        index == 0x0007):
      return self.GetMicrosoftOSDescriptorV2(length)

    return None
Handle vendor-specific control transfers.

    This function should be overridden by a subclass if implementing a device
    that responds to vendor-specific requests.

    Args:
      recipient: Request recipient (device, interface, endpoint, etc.)
      request: bRequest field of the setup packet.
      value: wValue field of the setup packet.
      index: wIndex field of the setup packet.
      length: Maximum amount of data the host expects the device to return.

    Returns:
      A buffer to return to the USB host with len <= length on success or
      None to stall the pipe.
    
Handle vendor-specific control transfers.
This function should be overridden by a subclass if implementing a device
that responds to vendor-specific requests.
Handle vendor - specific control transfers . This function should be overridden by a subclass if implementing a device that responds to vendor - specific requests .
def VendorControlRead(self, recipient, request, value, index, length):
    if (self._ms_vendor_code_v1 is not None and
        request == self._ms_vendor_code_v1 and
        (recipient == usb_constants.Recipient.DEVICE or
         recipient == usb_constants.Recipient.INTERFACE)):
      return self.GetMicrosoftOSDescriptorV1(recipient, value, index, length)
    if (self._ms_vendor_code_v2 is not None and
        request == self._ms_vendor_code_v2 and
        recipient == usb_constants.Recipient.DEVICE and
        value == 0x0000 and
        index == 0x0007):
      return self.GetMicrosoftOSDescriptorV2(length)
    return None
def VendorControlRead ( self , recipient , request , value , index , length ) : if ( self . _ms_vendor_code_v1 is not None and request == self . _ms_vendor_code_v1 and ( recipient == usb_constants . Recipient . DEVICE or recipient == usb_constants . Recipient . INTERFACE ) ) : return self . GetMicrosoftOSDescriptorV1 ( recipient , value , index , length ) if ( self . _ms_vendor_code_v2 is not None and request == self . _ms_vendor_code_v2 and recipient == usb_constants . Recipient . DEVICE and value == 0x0000 and index == 0x0007 ) : return self . GetMicrosoftOSDescriptorV2 ( length ) return None
Handle vendor-specific control transfers.
Handle vendor - specific control transfers .
"""Handle vendor-specific control transfers.

    This function should be overridden by a subclass if implementing a device
    that responds to vendor-specific requests.

    Args:
      recipient: Request recipient (device, interface, endpoint, etc.)
      request: bRequest field of the setup packet.
      value: wValue field of the setup packet.
      index: wIndex field of the setup packet.
      length: Maximum amount of data the host expects the device to return.

    Returns:
      A buffer to return to the USB host with len <= length on success or
      None to stall the pipe.
    """
A buffer to return to the USB host with len <= length on success or
None to stall the pipe.
A buffer to return to the USB host with len < = length on success or None to stall the pipe .
self
recipient
Request recipient (device, interface, endpoint, etc.)
Request recipient ( device interface endpoint etc . )
request
bRequest field of the setup packet.
bRequest field of the setup packet .
value
wValue field of the setup packet.
wValue field of the setup packet .
index
wIndex field of the setup packet.
wIndex field of the setup packet .
length
Maximum amount of data the host expects the device to return.
Maximum amount of data the host expects the device to return .