hid_open method

Pointer<hid_device> hid_open(
  1. int vendor_id,
  2. int product_id,
  3. Pointer<WChar> serial_number
)

@brief Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number.

If @p serial_number is NULL, the first device with the specified VID and PID is opened.

@ingroup API @param vendor_id The Vendor ID (VID) of the device to open. @param product_id The Product ID (PID) of the device to open. @param serial_number The Serial Number of the device to open (Optionally NULL).

@returns This function returns a pointer to a #hid_device object on success or NULL on failure. Call hid_error(NULL) to get the failure reason.

@note The returned object must be freed by calling hid_close(), when not needed anymore.

Implementation

ffi.Pointer<hid_device> hid_open(
  int vendor_id,
  int product_id,
  ffi.Pointer<ffi.WChar> serial_number,
) {
  return _hid_open(
    vendor_id,
    product_id,
    serial_number,
  );
}