Skip to content

Commit d101e5c

Browse files
committed
macOS: fix hid_send_output_report implementation
- fix name of the function on macOS - add compile-time check by the CI Fixes: #683
1 parent 9fc8b01 commit d101e5c

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

hidtest/test.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ void print_hid_report_descriptor_from_device(hid_device *device) {
8686
int res = 0;
8787

8888
printf(" Report Descriptor: ");
89+
#if HID_API_VERSION >= HID_API_MAKE_VERSION(0, 14, 0)
8990
res = hid_get_report_descriptor(device, descriptor, sizeof(descriptor));
91+
#else
92+
(void)res;
93+
#endif
9094
if (res < 0) {
9195
printf("error getting: %ls", hid_error(device));
9296
}
@@ -131,6 +135,23 @@ int main(int argc, char* argv[])
131135
(void)argc;
132136
(void)argv;
133137

138+
/* --- HIDAPI R&D: this is just to force the compiler to ensure
139+
each of those functions are implemented (even as a stub)
140+
by each backend. --- */
141+
(void)&hid_open;
142+
(void)&hid_open_path;
143+
(void)&hid_read_timeout;
144+
(void)&hid_get_input_report;
145+
#if HID_API_VERSION >= HID_API_MAKE_VERSION(0, 15, 0)
146+
(void)&hid_send_output_report;
147+
#endif
148+
(void)&hid_get_feature_report;
149+
(void)&hid_send_feature_report;
150+
#if HID_API_VERSION >= HID_API_MAKE_VERSION(0, 14, 0)
151+
(void)&hid_get_report_descriptor;
152+
#endif
153+
/* --- */
154+
134155
int res;
135156
unsigned char buf[256];
136157
#define MAX_STR 255

mac/hid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,7 @@ int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data,
13411341
return get_report(dev, kIOHIDReportTypeFeature, data, length);
13421342
}
13431343

1344-
int HID_API_EXPORT hid_send_output_feature_report(hid_device *dev, const unsigned char *data, size_t length)
1344+
int HID_API_EXPORT hid_send_output_report(hid_device *dev, const unsigned char *data, size_t length)
13451345
{
13461346
return set_report(dev, kIOHIDReportTypeOutput, data, length);
13471347
}

0 commit comments

Comments
 (0)