send_feature_report method

int send_feature_report(
  1. Pointer<hid_device> dev,
  2. Pointer<Uint8> data,
  3. int length
)

@brief Send a Feature report to the device.

Feature reports are sent over the Control endpoint as a Set_Report transfer. The first byte of @p data[] must contain the Report ID. For devices which only support a single report, this must be set to 0x0. The remaining bytes contain the report data. Since the Report ID is mandatory, calls to hid_send_feature_report() will always contain one more byte than the report contains. For example, if a hid report is 16 bytes long, 17 bytes must be passed to hid_send_feature_report(): the Report ID (or 0x0, for devices which do not use numbered reports), followed by the report data (16 bytes). In this example, the length passed in would be 17.

This function sets the return value of hid_error().

@ingroup API @param dev A device handle returned from hid_open(). @param data The data to send, including the report number as the first byte. @param length The length in bytes of the data to send, including the report number.

@returns This function returns the actual number of bytes written and -1 on error.

Implementation

int send_feature_report(
  ffi.Pointer<hid_device> dev,
  ffi.Pointer<ffi.Uint8> data,
  int length,
) {
  return _send_feature_report(
    dev,
    data,
    length,
  );
}