hidapi.h: adjust so that it gives a smaller diff against mainstream

This commit is contained in:
Ozkan Sezer 2021-01-22 20:03:50 +03:00
parent d4794028bb
commit e91f83c1e0
1 changed files with 31 additions and 29 deletions

View File

@ -77,9 +77,11 @@ namespace NAMESPACE {
(Windows/Mac only).*/ (Windows/Mac only).*/
unsigned short usage; unsigned short usage;
/** The USB interface which this logical device /** The USB interface which this logical device
represents. Valid on both Linux implementations represents.
in all cases, and valid on the Windows implementation
only if the device contains more than one interface. */ * Valid on both Linux implementations in all cases.
* Valid on the Windows implementation only if the device
contains more than one interface. */
int interface_number; int interface_number;
/** Additional information about the USB interface. /** Additional information about the USB interface.
@ -139,7 +141,7 @@ namespace NAMESPACE {
@returns @returns
This function returns a pointer to a linked list of type This function returns a pointer to a linked list of type
struct #hid_device, containing information about the HID devices struct #hid_device_info, containing information about the HID devices
attached to the system, or NULL in the case of failure. Free attached to the system, or NULL in the case of failure. Free
this linked list by calling hid_free_enumeration(). this linked list by calling hid_free_enumeration().
*/ */
@ -205,7 +207,7 @@ namespace NAMESPACE {
the Control Endpoint (Endpoint 0). the Control Endpoint (Endpoint 0).
@ingroup API @ingroup API
@param device A device handle returned from hid_open(). @param dev A device handle returned from hid_open().
@param data The data to send, including the report number as @param data The data to send, including the report number as
the first byte. the first byte.
@param length The length in bytes of the data to send. @param length The length in bytes of the data to send.
@ -214,7 +216,7 @@ namespace NAMESPACE {
This function returns the actual number of bytes written and This function returns the actual number of bytes written and
-1 on error. -1 on error.
*/ */
int HID_API_EXPORT HID_API_CALL hid_write(hid_device *device, const unsigned char *data, size_t length); int HID_API_EXPORT HID_API_CALL hid_write(hid_device *dev, const unsigned char *data, size_t length);
/** @brief Read an Input report from a HID device with timeout. /** @brief Read an Input report from a HID device with timeout.
@ -223,7 +225,7 @@ namespace NAMESPACE {
contain the Report number if the device uses numbered reports. contain the Report number if the device uses numbered reports.
@ingroup API @ingroup API
@param device A device handle returned from hid_open(). @param dev A device handle returned from hid_open().
@param data A buffer to put the read data into. @param data A buffer to put the read data into.
@param length The number of bytes to read. For devices with @param length The number of bytes to read. For devices with
multiple reports, make sure to read an extra byte for multiple reports, make sure to read an extra byte for
@ -235,7 +237,7 @@ namespace NAMESPACE {
-1 on error. If no packet was available to be read within -1 on error. If no packet was available to be read within
the timeout period, this function returns 0. the timeout period, this function returns 0.
*/ */
int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *device, unsigned char *data, size_t length, int milliseconds); int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds);
/** @brief Read an Input report from a HID device. /** @brief Read an Input report from a HID device.
@ -244,7 +246,7 @@ namespace NAMESPACE {
contain the Report number if the device uses numbered reports. contain the Report number if the device uses numbered reports.
@ingroup API @ingroup API
@param device A device handle returned from hid_open(). @param dev A device handle returned from hid_open().
@param data A buffer to put the read data into. @param data A buffer to put the read data into.
@param length The number of bytes to read. For devices with @param length The number of bytes to read. For devices with
multiple reports, make sure to read an extra byte for multiple reports, make sure to read an extra byte for
@ -255,7 +257,7 @@ namespace NAMESPACE {
-1 on error. If no packet was available to be read and -1 on error. If no packet was available to be read and
the handle is in non-blocking mode, this function returns 0. the handle is in non-blocking mode, this function returns 0.
*/ */
int HID_API_EXPORT HID_API_CALL hid_read(hid_device *device, unsigned char *data, size_t length); int HID_API_EXPORT HID_API_CALL hid_read(hid_device *dev, unsigned char *data, size_t length);
/** @brief Set the device handle to be non-blocking. /** @brief Set the device handle to be non-blocking.
@ -267,7 +269,7 @@ namespace NAMESPACE {
Nonblocking can be turned on and off at any time. Nonblocking can be turned on and off at any time.
@ingroup API @ingroup API
@param device A device handle returned from hid_open(). @param dev A device handle returned from hid_open().
@param nonblock enable or not the nonblocking reads @param nonblock enable or not the nonblocking reads
- 1 to enable nonblocking - 1 to enable nonblocking
- 0 to disable nonblocking. - 0 to disable nonblocking.
@ -275,7 +277,7 @@ namespace NAMESPACE {
@returns @returns
This function returns 0 on success and -1 on error. This function returns 0 on success and -1 on error.
*/ */
int HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *device, int nonblock); int HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *dev, int nonblock);
/** @brief Send a Feature report to the device. /** @brief Send a Feature report to the device.
@ -293,7 +295,7 @@ namespace NAMESPACE {
in would be 17. in would be 17.
@ingroup API @ingroup API
@param device A device handle returned from hid_open(). @param dev A device handle returned from hid_open().
@param data The data to send, including the report number as @param data The data to send, including the report number as
the first byte. the first byte.
@param length The length in bytes of the data to send, including @param length The length in bytes of the data to send, including
@ -303,7 +305,7 @@ namespace NAMESPACE {
This function returns the actual number of bytes written and This function returns the actual number of bytes written and
-1 on error. -1 on error.
*/ */
int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *device, const unsigned char *data, size_t length); int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *dev, const unsigned char *data, size_t length);
/** @brief Get a feature report from a HID device. /** @brief Get a feature report from a HID device.
@ -314,7 +316,7 @@ namespace NAMESPACE {
start in data[1]. start in data[1].
@ingroup API @ingroup API
@param device A device handle returned from hid_open(). @param dev A device handle returned from hid_open().
@param data A buffer to put the read data into, including @param data A buffer to put the read data into, including
the Report ID. Set the first byte of @p data[] to the the Report ID. Set the first byte of @p data[] to the
Report ID of the report to be read, or set it to zero Report ID of the report to be read, or set it to zero
@ -328,55 +330,55 @@ namespace NAMESPACE {
one for the report ID (which is still in the first one for the report ID (which is still in the first
byte), or -1 on error. byte), or -1 on error.
*/ */
int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *device, unsigned char *data, size_t length); int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *dev, unsigned char *data, size_t length);
/** @brief Close a HID device. /** @brief Close a HID device.
@ingroup API @ingroup API
@param device A device handle returned from hid_open(). @param dev A device handle returned from hid_open().
*/ */
void HID_API_EXPORT HID_API_CALL hid_close(hid_device *device); void HID_API_EXPORT HID_API_CALL hid_close(hid_device *dev);
/** @brief Get The Manufacturer String from a HID device. /** @brief Get The Manufacturer String from a HID device.
@ingroup API @ingroup API
@param device A device handle returned from hid_open(). @param dev A device handle returned from hid_open().
@param string A wide string buffer to put the data into. @param string A wide string buffer to put the data into.
@param maxlen The length of the buffer in multiples of wchar_t. @param maxlen The length of the buffer in multiples of wchar_t.
@returns @returns
This function returns 0 on success and -1 on error. This function returns 0 on success and -1 on error.
*/ */
int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *device, wchar_t *string, size_t maxlen); int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *dev, wchar_t *string, size_t maxlen);
/** @brief Get The Product String from a HID device. /** @brief Get The Product String from a HID device.
@ingroup API @ingroup API
@param device A device handle returned from hid_open(). @param dev A device handle returned from hid_open().
@param string A wide string buffer to put the data into. @param string A wide string buffer to put the data into.
@param maxlen The length of the buffer in multiples of wchar_t. @param maxlen The length of the buffer in multiples of wchar_t.
@returns @returns
This function returns 0 on success and -1 on error. This function returns 0 on success and -1 on error.
*/ */
int HID_API_EXPORT_CALL hid_get_product_string(hid_device *device, wchar_t *string, size_t maxlen); int HID_API_EXPORT_CALL hid_get_product_string(hid_device *dev, wchar_t *string, size_t maxlen);
/** @brief Get The Serial Number String from a HID device. /** @brief Get The Serial Number String from a HID device.
@ingroup API @ingroup API
@param device A device handle returned from hid_open(). @param dev A device handle returned from hid_open().
@param string A wide string buffer to put the data into. @param string A wide string buffer to put the data into.
@param maxlen The length of the buffer in multiples of wchar_t. @param maxlen The length of the buffer in multiples of wchar_t.
@returns @returns
This function returns 0 on success and -1 on error. This function returns 0 on success and -1 on error.
*/ */
int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *device, wchar_t *string, size_t maxlen); int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *dev, wchar_t *string, size_t maxlen);
/** @brief Get a string from a HID device, based on its string index. /** @brief Get a string from a HID device, based on its string index.
@ingroup API @ingroup API
@param device A device handle returned from hid_open(). @param dev A device handle returned from hid_open().
@param string_index The index of the string to get. @param string_index The index of the string to get.
@param string A wide string buffer to put the data into. @param string A wide string buffer to put the data into.
@param maxlen The length of the buffer in multiples of wchar_t. @param maxlen The length of the buffer in multiples of wchar_t.
@ -384,18 +386,18 @@ namespace NAMESPACE {
@returns @returns
This function returns 0 on success and -1 on error. This function returns 0 on success and -1 on error.
*/ */
int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *device, int string_index, wchar_t *string, size_t maxlen); int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *dev, int string_index, wchar_t *string, size_t maxlen);
/** @brief Get a string describing the last error which occurred. /** @brief Get a string describing the last error which occurred.
@ingroup API @ingroup API
@param device A device handle returned from hid_open(). @param dev A device handle returned from hid_open().
@returns @returns
This function returns a string containing the last error This function returns a string containing the last error
which occurred or NULL if none has occurred. which occurred or NULL if none has occurred.
*/ */
HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *device); HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *dev);
#if defined(__cplusplus) && !defined(NAMESPACE) #if defined(__cplusplus) && !defined(NAMESPACE)
} }