mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-02-24 02:06:44 -05:00
Add optional HID device hotplug support (requires https://gitlab.com/OpenRGBDevelopers/hidapi-hotplug)
This commit is contained in:
@@ -19,31 +19,40 @@
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Type definitions for libhidapi function pointers |
|
||||
\*-----------------------------------------------------*/
|
||||
typedef int (*hidapi_wrapper_send_feature_report) (hid_device*, const unsigned char*, size_t);
|
||||
typedef int (*hidapi_wrapper_get_feature_report) (hid_device*, unsigned char*, size_t);
|
||||
typedef int (*hidapi_wrapper_get_serial_number_string) (hid_device*, wchar_t*, size_t);
|
||||
typedef hid_device* (*hidapi_wrapper_open_path) (const char*);
|
||||
typedef hid_device_info* (*hidapi_wrapper_enumerate) (unsigned short, unsigned short);
|
||||
typedef void (*hidapi_wrapper_free_enumeration) (hid_device_info*);
|
||||
typedef void (*hidapi_wrapper_close) (hid_device*);
|
||||
typedef const wchar_t* (*hidapi_wrapper_error) (hid_device*);
|
||||
/*---------------------------------------------------------*\
|
||||
| Type definitions for libhidapi function pointers |
|
||||
\*---------------------------------------------------------*/
|
||||
typedef int (*hidapi_wrapper_send_feature_report) (hid_device*, const unsigned char*, size_t);
|
||||
typedef int (*hidapi_wrapper_get_feature_report) (hid_device*, unsigned char*, size_t);
|
||||
typedef int (*hidapi_wrapper_get_serial_number_string) (hid_device*, wchar_t*, size_t);
|
||||
typedef hid_device* (*hidapi_wrapper_open_path) (const char*);
|
||||
typedef hid_device_info* (*hidapi_wrapper_enumerate) (unsigned short, unsigned short);
|
||||
typedef void (*hidapi_wrapper_free_enumeration) (hid_device_info*);
|
||||
typedef void (*hidapi_wrapper_close) (hid_device*);
|
||||
typedef const wchar_t* (*hidapi_wrapper_error) (hid_device*);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| See comment at top of HyperXQuadcastSDetect.cpp for |
|
||||
| details about the hidapi wrapper for this device |
|
||||
\*-----------------------------------------------------*/
|
||||
#if(HID_HOTPLUG_ENABLED)
|
||||
typedef int (*hidapi_wrapper_hotplug_register_callback) (unsigned short vendor_id, unsigned short product_id, int events, int flags, hid_hotplug_callback_fn callback, void* user_data, hid_hotplug_callback_handle* callback_handle);
|
||||
typedef int (*hidapi_wrapper_hotplug_deregister_callback) (hid_hotplug_callback_handle callback_handle);
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| See comment at top of HyperXQuadcastSDetect.cpp for |
|
||||
| details about the hidapi wrapper for this device |
|
||||
\*---------------------------------------------------------*/
|
||||
struct hidapi_wrapper
|
||||
{
|
||||
void* dyn_handle;
|
||||
hidapi_wrapper_send_feature_report hid_send_feature_report;
|
||||
hidapi_wrapper_get_feature_report hid_get_feature_report;
|
||||
hidapi_wrapper_get_serial_number_string hid_get_serial_number_string;
|
||||
hidapi_wrapper_open_path hid_open_path;
|
||||
hidapi_wrapper_enumerate hid_enumerate;
|
||||
hidapi_wrapper_free_enumeration hid_free_enumeration;
|
||||
hidapi_wrapper_close hid_close;
|
||||
hidapi_wrapper_error hid_error;
|
||||
void* dyn_handle;
|
||||
hidapi_wrapper_send_feature_report hid_send_feature_report;
|
||||
hidapi_wrapper_get_feature_report hid_get_feature_report;
|
||||
hidapi_wrapper_get_serial_number_string hid_get_serial_number_string;
|
||||
hidapi_wrapper_open_path hid_open_path;
|
||||
hidapi_wrapper_enumerate hid_enumerate;
|
||||
hidapi_wrapper_free_enumeration hid_free_enumeration;
|
||||
hidapi_wrapper_close hid_close;
|
||||
hidapi_wrapper_error hid_error;
|
||||
#if(HID_HOTPLUG_ENABLED)
|
||||
hidapi_wrapper_hotplug_register_callback hid_hotplug_register_callback;
|
||||
hidapi_wrapper_hotplug_deregister_callback hid_hotplug_deregister_callback;
|
||||
#endif
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user