py-hid will fail due to not finding libhidapi.so. The "library_paths" variable in the installed __init__.py located at /usr/local/lib/python3.9/site-packages/hid does not have a path for any suitable library for it to use. I have successfully patched it by adding 'libhidapi.so' to the list of library_paths. FreeBSD uses libhidapi.so and not any of the other library paths listed in __init__.py. I don't have a formal diff, but adding libhidapi.so fixes the problem and py-hid works correctly for my test case. It completely failed before. I'm hoping the maintainer can put in the proper patch.
Hey dennis, thank you for the report. Could you submit a PR upstream [1]? Then we could just update py-hid to a newer version and have the issue fixed without having to patch locally. Also, I've returned the port to the pool, so if you'd like to become a maintainer, feel free to assume maintainership :) [1]: https://github.com/apmorton/pyhidapi/blob/master/hid/__init__.py
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=9675d0a4f943418c1dce991da3ad87734ed09152 commit 9675d0a4f943418c1dce991da3ad87734ed09152 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2024-04-11 15:53:25 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2024-04-11 15:55:47 +0000 comms/py-hid: Add libhidapi.so to library_paths dennis <drac7ft@gmail.com> reportsed that py-hid would fail due to not finding libhidapi.so. The "library_paths" variable in the installed __init__.py did not have a path for any suitable library for it to use. PR: 278086 Reported by: dennis <drac7ft@gmail.com> comms/py-hid/Makefile | 1 + comms/py-hid/files/patch-hid_____init____.py (new) | 10 ++++++++++ 2 files changed, 11 insertions(+)
I've written a patch according to your description. Let me know if that fixed the issue.