Instrument Neutral Distributed Interface INDI  1.9.2
Functions
hidapi API

Functions

HID_API_EXPORT hid_device *HID_API_CALL hid_open (unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number)
 Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number. More...
 
int HID_API_EXPORT HID_API_CALL hid_read (hid_device *device, unsigned char *data, size_t length)
 Read an Input report from a HID device. More...
 

Detailed Description

Function Documentation

◆ hid_open()

HID_API_EXPORT hid_device* HID_API_CALL hid_open ( unsigned short  vendor_id,
unsigned short  product_id,
const wchar_t *  serial_number 
)

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

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

Parameters
vendor_idThe Vendor ID (VID) of the device to open.
product_idThe Product ID (PID) of the device to open.
serial_numberThe 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.

Definition at line 612 of file hid_libusb.c.

◆ hid_read()

int HID_API_EXPORT HID_API_CALL hid_read ( hid_device device,
unsigned char *  data,
size_t  length 
)

Read an Input report from a HID device.

Input reports are returned

to the host through the INTERRUPT IN endpoint. The first byte will contain the Report number if the device uses numbered reports.

Parameters
deviceA device handle returned from hid_open().
dataA buffer to put the read data into.
lengthThe number of bytes to read. For devices with multiple reports, make sure to read an extra byte for the report number.
Returns
This function returns the actual number of bytes read and -1 on error.

Definition at line 1095 of file hid_libusb.c.