Story: WinRT backend for Windows #329
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#329
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Current Windows backend is WinAPI based.
There is also an alternative - WinRT API, and it actually uses a different implementation.
More discussion about it: #282.
Having an alternative backend might be useful in the future. Leaving this ticket to follow up on it if someone ever gets to finish it.
Some attempt to move in this direction:https://github.com/LeeChunHei/hidapiUPD: see next comment.
A general recommentation is to have this backend implemented in C++, due to way simpler implementation, when it comes to WinRT, compared to C.
I have had a little "weekend codding" session, and tried to implement the WinRT backend implementation for HIDAPI, and here is the result: https://github.com/libusb/hidapi/compare/winrt
I'm not even sure if it worth making a PR into master as of yet, but here are some statements about the implementation:
hid_errorlooks very familiar, but that's not the point);Windows.Devices.HumanInterfaceDevicesubsystem as of this moment, e.g.:And I wasn't able to test it intensively, keeping it in the branch for now. Just in case someone would want to play with it.
The Microsoft Store is no longer restricted to UWP: https://developer.microsoft.com/en-us/microsoft-store/desktop-apps
I believe there're still restrictions on WinAPI usage (and HIDAPI/WinAPI doesn't follow them).
I'll search for link with description later.
This seems to work pretty well, tested under Windows 11 with VS2022.
Edit: this is not correct. So I deleted the output.
I do not believe you've actually used the winrt backend.
You need to pass
-DHIDAPI_WITH_WINRT=ONand run thehidtest-winrtexecutable.Here is the output for the draft WinRT backend. Other than the limitations mentioned in the first post, I can see that product string is also not correct when there is none. Now it uses the computer name.
Click for the details
Output from the normal Windows backend as a comparison.
Click for the details
Another computer using Windows 10.
click for the run log for WinRT backend
Normal Windows backend output.
click for the run log for normal Windows backend
Looks about right - consistent with my testing.
All of what is missing - are the limitation of the WinRT API for HID devices.