Skip to content

Use upstream hidapi 0.14.0 with hid_get_report_descriptor on all platforms #18

@JoergAtGithub

Description

@JoergAtGithub

This hidapi version was forked by @tonyrog from a very old version of signal11/hidapi. It adds support for reading and parsing HID Report Descriptors for Linux/BSD (and adds hidapi2osc).
Since version 0.14.0 upstream libusb/hidapi has a function hid_get_report_descriptor which returns the HID Report Descriptor on all operating systems including Windows and macOS.
This means that you could use the code

#ifdef LINUX_FREEBSD
unsigned char descr_buf[HIDAPI_MAX_DESCRIPTOR_SIZE];
int res;
res = hid_get_report_descriptor( devd, descr_buf, HIDAPI_MAX_DESCRIPTOR_SIZE );
if (res < 0){
printf("Unable to read report descriptor\n");
return NULL;
} else {
desc = (struct hid_dev_desc *) malloc( sizeof( struct hid_dev_desc ) );
desc->device = devd;
hid_parse_report_descriptor( descr_buf, res, desc );
return desc;
}
#endif

on all operating systems, with upstream libusb/hidapi 0.14.0 https://github.com/libusb/hidapi/releases/tag/hidapi-0.14.0

And you get of cause all the other features, which were added to hidapi since the time of the fork, like support for Feature Reports, HID over Bluetooth LE, I2C and SPI, and a standard CMake build setup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions