tools/usb_gadget/hid_gadget.py
def ClassControlRead(self, recipient, request, value, index, length):
    """Handle class-specific control requests.

    See Device Class Definition for Human Interface Devices (HID) Version 1.11
    section 7.2.

    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 recipient != usb_constants.Recipient.INTERFACE:
      return None
    if index != self._interface_number:
      return None

    if request == hid_constants.Request.GET_REPORT:
      report_type, report_id = value >> 8, value & 0xFF
      print('GetReport(type={}, id={}, length={})'.format(
          report_type, report_id, length))
      return self.GetReport(report_type, report_id, length)
Handle class-specific control requests.

    See Device Class Definition for Human Interface Devices (HID) Version 1.11
    section 7.2.

    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 class-specific control requests.
See Device Class Definition for Human Interface Devices (HID) Version 1.11
section 7.2.
Handle class - specific control requests . See Device Class Definition for Human Interface Devices ( HID ) Version 1 . 11 section 7 . 2 .
def ClassControlRead(self, recipient, request, value, index, length):
    if recipient != usb_constants.Recipient.INTERFACE:
      return None
    if index != self._interface_number:
      return None
    if request == hid_constants.Request.GET_REPORT:
      report_type, report_id = value >> 8, value & 0xFF
      print('GetReport(type={}, id={}, length={})'.format(
          report_type, report_id, length))
      return self.GetReport(report_type, report_id, length)
def ClassControlRead ( self , recipient , request , value , index , length ) : if recipient != usb_constants . Recipient . INTERFACE : return None if index != self . _interface_number : return None if request == hid_constants . Request . GET_REPORT : report_type , report_id = value >> 8 , value & 0xFF print ( 'GetReport(type={}, id={}, length={})' . format ( report_type , report_id , length ) ) return self . GetReport ( report_type , report_id , length )
Handle class-specific control requests.
Handle class - specific control requests .
"""Handle class-specific control requests.

    See Device Class Definition for Human Interface Devices (HID) Version 1.11
    section 7.2.

    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 .