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

Support hidraw(4) on FreeBSD #597

Merged
merged 1 commit into from Jun 27, 2022
Merged

Conversation

grembo
Copy link
Contributor

@grembo grembo commented Jun 22, 2022

Add support for the hidraw(4) driver introduced in FreeBSD 13.
As this driver is lacking support for USB_GET_DEVICEINFO at the
moment, fall back to an alternative to retrieve device information.

Once hidraw(4) gains support for USB_GET_DEVICEINFO, its results
will be used automatically.

Copy link
Contributor

@martelletto martelletto left a comment

Choose a reason for hiding this comment

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

Thank you for the PR. Please excuse all the noise coming from GitHub Actions. I have left a few questions, and would like to add another one, if I may: do I understand correctly that the PR is relying on the ioctl() in fido_hid_open() to place hidraw(4) in uhid(4) mode, as described in https://www.freebsd.org/cgi/man.cgi?query=hidraw&apropos=0&sektion=0&manpath=FreeBSD+13.1-RELEASE+and+Ports&arch=default&format=html#end?

-p.

src/hid_freebsd.c Outdated Show resolved Hide resolved
src/hid_freebsd.c Outdated Show resolved Hide resolved
src/hid_freebsd.c Outdated Show resolved Hide resolved
@grembo
Copy link
Contributor Author

grembo commented Jun 23, 2022

Thank you for your good remarks.

Thank you for the PR. Please excuse all the noise coming from GitHub Actions. I have left a few questions, and would like to add another one, if I may: do I understand correctly that the PR is relying on the ioctl() in fido_hid_open() to place hidraw(4) in uhid(4) mode, as described in https://www.freebsd.org/cgi/man.cgi?query=hidraw&apropos=0&sektion=0&manpath=FreeBSD+13.1-RELEASE+and+Ports&arch=default&format=html#end?

That's correct.

I'll add a couple of comments to the code, so the next one reading it will have those questions answered.

@martelletto
Copy link
Contributor

Thank you for the quick turnaround. I have pushed a commit with minor tweaks. @LDVG @kongeo thoughts?

@martelletto martelletto requested review from kongeo and LDVG June 23, 2022 12:14
@martelletto
Copy link
Contributor

Feel free to squash my commit on top of @grembo's (if they agree) before merging.

Copy link
Contributor Author

@grembo grembo left a comment

Choose a reason for hiding this comment

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

A few minor remarks on code and consistency.

Maybe you can give me a better understanding of your philosophy when it comes to comments - I tried to add them where things weren't clear to you in the review, but it seems like almost all of them were - excuse the word - butchered removed in the process. If that's the underlying philosophy, that's ok, I'm just curious if it wouldn't make sense to have something in there that explains what is going on, as the hidraw/uhid situation isn't necessarily obvious.

src/hid_freebsd.c Outdated Show resolved Hide resolved
src/hid_freebsd.c Outdated Show resolved Hide resolved
src/hid_freebsd.c Outdated Show resolved Hide resolved
src/hid_freebsd.c Outdated Show resolved Hide resolved
src/hid_freebsd.c Outdated Show resolved Hide resolved
src/hid_freebsd.c Outdated Show resolved Hide resolved
@grembo
Copy link
Contributor Author

grembo commented Jun 23, 2022

@LDVG @kongeo @martelletto None of my remarks above are blockers (even though I think leaving comments in that help implementors to understand the hidraw driver on FreeBSD and how to activate it for testing might help). If you prefer as few comments as possible, maybe they could be moved to the commit message.

src/hid_freebsd.c Outdated Show resolved Hide resolved
@grembo
Copy link
Contributor Author

grembo commented Jun 23, 2022

@martelletto @hselasky The latest commit should incorporate all changes we discussed, please let me know if this needs more refinement.

Thanks for your input so far, much appreciated!

@martelletto
Copy link
Contributor

Thank you. I will try to take a look over the weekend.

@martelletto
Copy link
Contributor

LGTM. Sorry once again for all the GitHub Actions noise.

Add support for the hidraw(4) driver introduced in FreeBSD 13.
As this driver is lacking support for USB_GET_DEVICEINFO at the
moment, fall back to an alternative to retrieve device information.

Once hidraw(4) gains support for USB_GET_DEVICEINFO, its results
will be used automatically.
@martelletto
Copy link
Contributor

rebased and squashed; no code change. GitHub Actions should be OK now.

@martelletto martelletto merged commit 9301603 into Yubico:main Jun 27, 2022
@martelletto
Copy link
Contributor

Merged; thank you!

@grembo
Copy link
Contributor Author

grembo commented Jun 27, 2022

@martelletto Thank you for reviewing (and improving) the code.

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

Successfully merging this pull request may close these issues.

None yet

5 participants