macOS: fix hid_send_output_report implementation

- fix name of the function on macOS
- add compile-time check by the CI

Fixes: #683
This commit is contained in:
Ihor Dutchak
2024-08-02 16:48:23 +03:00
parent 9fc8b01c77
commit d101e5c7e4
2 changed files with 22 additions and 1 deletions

View File

@@ -86,7 +86,11 @@ void print_hid_report_descriptor_from_device(hid_device *device) {
int res = 0;
printf(" Report Descriptor: ");
#if HID_API_VERSION >= HID_API_MAKE_VERSION(0, 14, 0)
res = hid_get_report_descriptor(device, descriptor, sizeof(descriptor));
#else
(void)res;
#endif
if (res < 0) {
printf("error getting: %ls", hid_error(device));
}
@@ -131,6 +135,23 @@ int main(int argc, char* argv[])
(void)argc;
(void)argv;
/* --- HIDAPI R&D: this is just to force the compiler to ensure
each of those functions are implemented (even as a stub)
by each backend. --- */
(void)&hid_open;
(void)&hid_open_path;
(void)&hid_read_timeout;
(void)&hid_get_input_report;
#if HID_API_VERSION >= HID_API_MAKE_VERSION(0, 15, 0)
(void)&hid_send_output_report;
#endif
(void)&hid_get_feature_report;
(void)&hid_send_feature_report;
#if HID_API_VERSION >= HID_API_MAKE_VERSION(0, 14, 0)
(void)&hid_get_report_descriptor;
#endif
/* --- */
int res;
unsigned char buf[256];
#define MAX_STR 255

View File

@@ -1341,7 +1341,7 @@ int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data,
return get_report(dev, kIOHIDReportTypeFeature, data, length);
}
int HID_API_EXPORT hid_send_output_feature_report(hid_device *dev, const unsigned char *data, size_t length)
int HID_API_EXPORT hid_send_output_report(hid_device *dev, const unsigned char *data, size_t length)
{
return set_report(dev, kIOHIDReportTypeOutput, data, length);
}