hid_error method

Pointer<WChar> hid_error(
  1. Pointer<hid_device> dev
)

@brief Get a string describing the last error which occurred.

This function is intended for logging/debugging purposes.

This function guarantees to never return NULL. If there was no error in the last function call - the returned string clearly indicates that.

Any HIDAPI function that can explicitly indicate an execution failure (e.g. by an error code, or by returning NULL) - may set the error string, to be returned by this function.

Strings returned from hid_error() must not be freed by the user, i.e. owned by HIDAPI library. Device-specific error string may remain allocated at most until hid_close() is called. Global error string may remain allocated at most until hid_exit() is called.

@ingroup API @param dev A device handle returned from hid_open(), or NULL to get the last non-device-specific error (e.g. for errors in hid_open() or hid_enumerate()).

@returns A string describing the last error (if any).

Implementation

ffi.Pointer<ffi.WChar> hid_error(
  ffi.Pointer<hid_device> dev,
) {
  return _hid_error(
    dev,
  );
}