-
Notifications
You must be signed in to change notification settings - Fork 399
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
Initial NetBSD/UHID native backend implementation #612
Conversation
Minor code cleanup. I noticed some improvements I could make when reusing some of the code for another project of mine. |
Nice, the first simple test seems to work fine. I need to modify hidapitester to test this more. I am using NetBSD 9.3 VM running under Proxmox and I attach a generic HID device to the VM.
|
Feel free to refine it further but I have reached the limit of what I can see to do. I am considering writing a FreeBSD backend after NetBSD has been merged. It is probably the last native BSD backend that has enough kernel API functionality to work with the current library abstraction. I may end up creating two versions for FreeBSD due to it having the option of using a |
That would be wonderful. I tend to think the 1hidraw` backend is the way to go for FreeBSD. |
Preliminary investigation suggests this has its own problems due to how new this backend is. It isn't enabled by default on fresh installations. Of the two,
Any solution would probably have to be prepared to use whichever API the FreeBSD environment is configured to use as I don't think it would be a good practice to forcefully enable |
I agree. I'd say that even if we will get the |
Thanks for the analysis. However, for the FreeBSD OS, there is already a libusb backend which will be the default as it already works fine (other than common libusb issues: https://github.com/libusb/hidapi/issues?q=is%3Aopen+is%3Aissue+label%3Alibusb). So libusb backend will be the preferred backend in the foreseeable future. I believe ugen driver is also attached to generic USB HID device along with uhid (or hidraw). That is why it works. I see this as similar to Linux side last time -- libusb was the preferred and hidraw was secondary as there was too many limitations previously. Now hidraw is the preferred. But of course you can develop uhid backend first as it is more common for now. However, I tend to believe hidraw may be the future for FreeBSD as well (and maybe NetBSD/OpenBSD). |
This PR does not support the existing auto-tools build system. Do we want to keep the auto-tools support? |
I left it out because I found comments saying that it was deprecated so I assumed it was going to be removed in the near future. |
No.
This is exactly why. BTW: I've reviewed all CMake changes - very consistent with what we already have. Very nice, thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall very consistent implementation.
I didn't check all of the implementation/logic (specially what consernes the uhid
API/usage) but overall looks very good.
Just a few comments/improvements to consider.
This also modifies an internal routine for walking the device tree to accept a function pointer for the string comparison so it can be reused in more places than its originally intended one.
Re-based on latest |
Ok. That should handle the requested changes. Anything else? |
just one last comment |
There. That comment should cover it. |
This is the culmination of the research I did for
uhid
on NetBSD. It should be as complete as a native backend can be given the limitations of NetBSD's kernel anduhid
as a whole. See related issue, #608.