Windows: ensure buffer passed to HidD_SetFeature is large enough #224
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!224
Loading…
Reference in a new issue
No description provided.
Delete branch "win_set_feat_fix"
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?
HidD_SetFeature()requires a feature report be at least a certain size similar to the requirement forWriteFile()in the implementation ofhid_write().Thanks, this is good.
Do you mind making a small change?
Cache the buffer as a device member, and allocate it only on first use.
An optimisation, so we don't do dynamica allocations on each report.
I wanted to apply same optimisation for hid_write to, just didn't have a chance to do so yet.
Nice!
This is exactly how I'd do it.