-
Notifications
You must be signed in to change notification settings - Fork 407
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
Add hid_get_path to API resolves #163 #164
Conversation
Add a new hid_get_path function to the API. This adds a new path member to the opaque structure of each hid implementation. The path is dynamically allocated and populated in the respective hid_open_path functions. The function returns a const char pointer to this path string. - Add path string to each hid_device_ structure in hid.c files - Add hid_get_path function to hidapi.h and hid.c files - Add init and free code for dev->path to hid.c files - Allocate and populate dev->path in hid_open_path in hid.c files - Add example of hid_get_path usage in test.c
This PR does have a significant caveat: I don't have the ability to test this on anything other than windows at the moment. The use of |
After getting my hands on a linux machine. I can say that the libusb and hidraw implementations also appear to work correctly. The limitation on this may be the fact that this linux machine was set up to be en_US.UTF-8. TODO: somehow test on a mac |
What's on to of my mind - replace |
Use strdup instead of strlen + calloc + strncpy.
I'm probably going to spend some more time on this. |
I haven't forgot about this one, but I remember I wanted to perform some kind of optimisation, at least for one of the platforms, before merging it. |
- new API function: `struct hid_device_info * hid_get_device_info(hid_device *dev);` to get `hid_device_info` after the device already opened; - reused existing implementation on Windows and macOS from enumeration routines to have the implementation; - refactored libusb implementation to have a shared routine for `hid_enumerate` and `hid_get_device_info`; - refactored hidraw implementation to have a shared routine for `hid_enumerate` and `hid_get_device_info`; Resolves: #431 Closes: #164 Closes: #163
This resolves the ability to get the device path from hid_device pointer issue in #163
Add a new hid_get_path function to the API. This adds a new path member
to the opaque structure of each hid implementation. The path is
dynamically allocated and populated in the respective hid_open_path
functions. The function returns a const char pointer to this path
string.