Windows: ensure buffer passed to HidD_SetFeature is large enough #224

Merged
Mornix merged 2 commits from win_set_feat_fix into master 2020-12-24 00:13:55 -06:00
Mornix commented 2020-12-13 03:03:48 -06:00 (Migrated from github.com)

HidD_SetFeature() requires a feature report be at least a certain size similar to the requirement for WriteFile() in the implementation of hid_write().

`HidD_SetFeature()` requires a feature report be at least a certain size similar to the requirement for `WriteFile()` in the implementation of `hid_write()`.
Youw commented 2020-12-16 06:56:33 -06:00 (Migrated from github.com)

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.

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.
Youw (Migrated from github.com) approved these changes 2020-12-18 05:50:03 -06:00
Youw (Migrated from github.com) left a comment

Nice!
This is exactly how I'd do it.

Nice! This is exactly how I'd do it.
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-libusb/hidapi!224
No description provided.