sdlHidGetReportDescriptor function

int sdlHidGetReportDescriptor(
  1. Pointer<SdlHidDevice> dev,
  2. Pointer<Uint8> buf,
  3. int bufSize
)

Get a report descriptor from a HID device.

User has to provide a preallocated buffer where descriptor will be copied to. The recommended size for a preallocated buffer is 4096 bytes.

\param dev a device handle returned from SDL_hid_open(). \param buf the buffer to copy descriptor into. \param buf_size the size of the buffer in bytes. \returns the number of bytes actually copied or -1 on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

extern SDL_DECLSPEC int SDLCALL SDL_hid_get_report_descriptor(SDL_hid_device *dev, unsigned char *buf, size_t buf_size)

Implementation

int sdlHidGetReportDescriptor(
    Pointer<SdlHidDevice> dev, Pointer<Uint8> buf, int bufSize) {
  final sdlHidGetReportDescriptorLookupFunction = libSdl3.lookupFunction<
      Int32 Function(
          Pointer<SdlHidDevice> dev, Pointer<Uint8> buf, Uint32 bufSize),
      int Function(Pointer<SdlHidDevice> dev, Pointer<Uint8> buf,
          int bufSize)>('SDL_hid_get_report_descriptor');
  return sdlHidGetReportDescriptorLookupFunction(dev, buf, bufSize);
}