Skip to content

Use upstream hidapi 0.14.0 with hid_get_report_descriptor on all platforms #18

Open

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.

Activity

  1. mcuee commented on Jun 3, 2023

    @mcuee

    @JoergAtGithub

    Maybe another way is to port the HID report parser to upstream HIDAPI. It will probably not accepted to the master branch due to license issues (the parser library is licensed under GPL). But maybe it is okay to live as a branch or a seperate repo.

  2. pier3100 commented on Feb 22, 2024

    @pier3100

    Hi guys,

    I wanted to use HID on windows 11, but ran into this issue. This issue has long been fixed in HIDAPI, but has not reached Supercollider due to the usage of the older fork. I implemented the mentioned specific fix for myself, but the proper way would be to use hidapi 0.14.0. I'm quite new to supercollider and even more new to application development. But I think this might be a nice first project to contribute. It's mainly testing I guess.
    @JoergAtGithub, @mcuee, if you are considering working on this, I would be more than happy to help and learn.

  3. mcuee commented on Feb 22, 2024

    @mcuee

    @pier3100

    Just wondering why you need to use this fork and not upstream hidapi.

    If you really need an HID report parser, you can use other tools or code base.

    You can also fork HIDAPI if you really think the report parser is important for your use case.

  4. beatboxchad commented on Jun 8, 2024

    @beatboxchad

    #19 is ready for review. It builds and runs on my Linux machine, and I'm developing against it. Kindly remind me if I've missed something basic.

  5. beatboxchad commented on Jun 8, 2024

    @beatboxchad

    For example, I didn't update any of the code in hidapi_parser.c to use hid_get_report_descriptor on all platforms. I basically only got it to build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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