Add hid_get_path to API resolves #163 #164
No reviewers
Labels
No labels
3rdparty
Android
API
Author does not respond
bsd
bug
build system/CI
ci-virtual-device
CMake
Contributions Welcome
Core
dependencies
device-specific
documentation
don't_merge
duplicate
enhancement
Example
Haiku
hidraw
hotplug
info required
invalid
libusb
macOS
Misc
Not an issue
question
Release
Test
Test GUI
Windows
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-libusb/hidapi!164
Loading…
Reference in a new issue
No description provided.
Delete branch "get_path"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.
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
char *may not be appropriate on some implementations (I am thinking of linux with UTF-8 capable filesystems). Please let me know if you can test this on other hidapi implementations.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
calloc+strcpywithstrdupI'll check everything closely a bit later
I'm probably going to spend some more time on this.
I think it is possible to postpone initialization of the "path" variable until it is first time called (at least for some backends).
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.
Pull request closed