Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile hidapi library from source #94

Merged
merged 6 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
- name: Install dependencies
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get update -qq && sudo apt-get install -y build-essential cmake liblua5.4-dev libhidapi-dev
sudo apt-get update -qq && sudo apt-get install -y build-essential cmake liblua5.4-dev libudev-dev libhidapi-dev
echo 'XPANEL_INSTALL_DEPS_FLAG=-DINSTALL_DEPS=ON' >> $GITHUB_ENV


Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ jobs:
- name: Copy 3rd party dlls (Windows)
run: |
cp 3rdparty/LUA/lua54.dll built-plugin-windows/plugins/XPanel/64/
cp 3rdparty/hidapi/lib/hidapi.dll built-plugin-windows/plugins/XPanel/64/
cp 3rdparty/FIP-SDK/lib/DirectOutput.dll built-plugin-windows/plugins/XPanel/64/

- name: Copy board-config.ini
Expand Down
12 changes: 0 additions & 12 deletions 3rdparty/hidapi/CMakeLists.txt

This file was deleted.

63 changes: 21 additions & 42 deletions 3rdparty/hidapi/headers/hidapi.h → 3rdparty/hidapi/hidapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

libusb/hidapi Team

Copyright 2023, All Rights Reserved.
Copyright 2022, All Rights Reserved.

At the discretion of the user of this library,
this software may be licensed under the terms of the
Expand All @@ -29,17 +29,13 @@

#include <wchar.h>

/* #480: this is to be refactored properly for v1.0 */
#ifdef _WIN32
#ifndef HID_API_NO_EXPORT_DEFINE
#define HID_API_EXPORT __declspec(dllexport)
#endif
#define HID_API_CALL
#else
#define HID_API_EXPORT /**< API export macro */
#define HID_API_CALL /**< API call macro */
#endif
#ifndef HID_API_EXPORT
#define HID_API_EXPORT /**< API export macro */
#endif
/* To be removed in v1.0 */
#define HID_API_CALL /**< API call macro */

#define HID_API_EXPORT_CALL HID_API_EXPORT HID_API_CALL /**< API export and call macro*/

Expand All @@ -52,12 +48,12 @@

@ingroup API
*/
#define HID_API_VERSION_MINOR 14
#define HID_API_VERSION_MINOR 13
/** @brief Static/compile-time patch version of the library.

@ingroup API
*/
#define HID_API_VERSION_PATCH 0
#define HID_API_VERSION_PATCH 1

/* Helper macros */
#define HID_API_AS_STR_IMPL(x) #x
Expand All @@ -70,9 +66,7 @@
This macro was added in version 0.12.0.

Convenient function to be used for compile-time checks, like:
@code{.c}
#if HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0)
@endcode

@ingroup API
*/
Expand Down Expand Up @@ -105,11 +99,10 @@
#ifdef __cplusplus
extern "C" {
#endif
/** A structure to hold the version numbers. */
struct hid_api_version {
int major; /**< major version number */
int minor; /**< minor version number */
int patch; /**< patch version number */
int major;
int minor;
int patch;
};

struct hid_device_;
Expand All @@ -120,27 +113,27 @@ extern "C" {
@ingroup API
*/
typedef enum {
/** Unknown bus type */
/* Unknown bus type */
HID_API_BUS_UNKNOWN = 0x00,

/** USB bus
/* USB bus
Specifications:
https://usb.org/hid */
HID_API_BUS_USB = 0x01,

/** Bluetooth or Bluetooth LE bus
/* Bluetooth or Bluetooth LE bus
Specifications:
https://www.bluetooth.com/specifications/specs/human-interface-device-profile-1-1-1/
https://www.bluetooth.com/specifications/specs/hid-service-1-0/
https://www.bluetooth.com/specifications/specs/hid-over-gatt-profile-1-0/ */
HID_API_BUS_BLUETOOTH = 0x02,

/** I2C bus
/* I2C bus
Specifications:
https://docs.microsoft.com/previous-versions/windows/hardware/design/dn642101(v=vs.85) */
HID_API_BUS_I2C = 0x03,

/** SPI bus
/* SPI bus
Specifications:
https://www.microsoft.com/download/details.aspx?id=103325 */
HID_API_BUS_SPI = 0x04,
Expand Down Expand Up @@ -172,9 +165,11 @@ extern "C" {
/** The USB interface which this logical device
represents.

Valid only if the device is a USB HID device.
Set to -1 in all other cases.
*/
* Valid on both Linux implementations in all cases.
* Valid on the Windows implementation only if the device
contains more than one interface.
* Valid on the Mac implementation if and only if the device
is a USB HID device. */
int interface_number;

/** Pointer to the next device */
Expand Down Expand Up @@ -550,23 +545,6 @@ extern "C" {
*/
int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *dev, int string_index, wchar_t *string, size_t maxlen);

/** @brief Get a report descriptor from a HID device.

Since version 0.14.0, @ref HID_API_VERSION >= HID_API_MAKE_VERSION(0, 14, 0)

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

@ingroup API
@param dev A device handle returned from hid_open().
@param buf The buffer to copy descriptor into.
@param buf_size The size of the buffer in bytes.

@returns
This function returns non-negative number of bytes actually copied, or -1 on error.
*/
int HID_API_EXPORT_CALL hid_get_report_descriptor(hid_device *dev, unsigned char *buf, size_t buf_size);

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

This function is intended for logging/debugging purposes.
Expand Down Expand Up @@ -622,3 +600,4 @@ extern "C" {
#endif

#endif

Binary file removed 3rdparty/hidapi/lib/hidapi.dll
Binary file not shown.
Binary file removed 3rdparty/hidapi/lib/hidapi.lib
Binary file not shown.
Loading
Loading