Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement hid_get_input_report for Linux hidraw backend #351

Merged
merged 1 commit into from
Dec 10, 2021

Conversation

Be-ing
Copy link
Contributor

@Be-ing Be-ing commented Nov 14, 2021

Fixes #259

@Be-ing
Copy link
Contributor Author

Be-ing commented Nov 14, 2021

I don't know if this actually works with Linux < 5.11, but at least it should build.

@Be-ing
Copy link
Contributor Author

Be-ing commented Nov 14, 2021

Looking closer at the commit that implemented this in Linux, simply defining the macro won't do anything in Linux < 5.11 without the other changes in that commit. So I changed this to keep the old dummy code that just returns an error for old versions of Linux.

@JoergAtGithub
Copy link
Contributor

The ifdef checks the Kernel at compile time and returns the error if it was compiled on a too old Kernel.
But what happens if the executable is compiled on a new kernel, but executed on an old one?

@Be-ing
Copy link
Contributor Author

Be-ing commented Nov 14, 2021

I have not tested that.

@Be-ing
Copy link
Contributor Author

Be-ing commented Nov 14, 2021

I suppose that could actually happen with Flatpak... I'll test what happens with a VM running an old kernel.

@Youw
Copy link
Member

Youw commented Nov 14, 2021

Lets have the functionality compile regardless of the kernel version (e.g. if not defined HIDIOCGINPUT - define it);
As fo running on the older kernel - I'm pretty sure the call will simply fail, since the correspondind ioctl isn't supported.

@Be-ing Be-ing force-pushed the hidraw_get_input_report branch 2 times, most recently from edad695 to 6bd5157 Compare November 14, 2021 15:01
@Be-ing
Copy link
Contributor Author

Be-ing commented Nov 14, 2021

Okay I switched it back to the original implementation copying the definition from hidraw.h.

@Be-ing Be-ing force-pushed the hidraw_get_input_report branch 2 times, most recently from 98d9ae7 to ed57e4d Compare November 14, 2021 15:03
Copy link
Member

@Youw Youw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good.
I'd like to check it locally with my device(s) befor having it merged.

linux/hid.c Outdated Show resolved Hide resolved
@mcuee mcuee added the hidraw Related to Linux/hidraw backend label Nov 29, 2021
@Be-ing
Copy link
Contributor Author

Be-ing commented Dec 5, 2021

Have you had a chance to test this yet?

Copy link
Member

@Youw Youw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I finally had.
Everything looks perfect. Thanks!

@Youw Youw merged commit d67b5c9 into libusb:master Dec 10, 2021
@Be-ing Be-ing deleted the hidraw_get_input_report branch December 10, 2021 13:09
@Be-ing
Copy link
Contributor Author

Be-ing commented Dec 10, 2021

Thanks. Do you have a plan when you will make the next release?

@Youw
Copy link
Member

Youw commented Dec 10, 2021

The major (minor actually) release is not going to happen soon - nothing really done for that.
But I'll try to make a patch release soon.

@Be-ing
Copy link
Contributor Author

Be-ing commented Dec 10, 2021

A patch release soon with this fix would be good.

@Be-ing
Copy link
Contributor Author

Be-ing commented Jan 3, 2022

Any further updates about a patch release?

@Youw
Copy link
Member

Youw commented Jan 3, 2022

@Be-ing I know you've waited for 0.11.1 the most of all, but be aware, that I've removed 0.11.1 release due to non-updated version file in that release (see #366).
0.11.2 is as good for you.

@Be-ing
Copy link
Contributor Author

Be-ing commented Jan 3, 2022

Thanks! I made a PR to update vcpkg.

@Be-ing
Copy link
Contributor Author

Be-ing commented Jan 3, 2022

I also made a PR to update the Rust bindings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hidraw Related to Linux/hidraw backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

hidraw: hid_get_input_report implementation for Kernels that support it
4 participants