Skip to content

How to send HID Feature Report with Hid.Net? #252

@daniel199904

Description

@daniel199904

Describe the issue

I'm trying to send a Feature Report to a HID device using Hid.Net, but it seems that WriteAsync() does not send a feature report, and I cannot find any exposed method such as WriteFeatureReportAsync.

How can I send (set) a HID Feature report using Hid.Net?

I've also checked the documentation and source code but couldn't find a clear approach for this. If WriteAsync only supports Output reports, is there a recommended way to perform HidD_SetFeature or a built-in wrapper for that?


Screenshots

Below is the debugger view of my device instance, confirming that the WriteBufferSize is correctly set:

_device = Hid.Net.HidDevice
WriteBufferSize = 33

(You can add an actual screenshot here if needed)


Your Code

var factory = new FilterDeviceDefinition(vendorId: 0x1234, productId: 0x5678)
    .CreateWindowsHidDeviceFactory();

var deviceDefinitions = await factory.GetConnectedDeviceDefinitionsAsync();
var device = await factory.GetDeviceAsync(deviceDefinitions.First());

await device.InitializeAsync();

// Attempting to send a Feature Report
byte[] featureReport = new byte[33];
featureReport[0] = 0x01; // Report ID
featureReport[1] = 0xA0; // Sample payload

await device.WriteAsync(featureReport); // Does not appear to trigger SetFeature

Log / Stack Trace

There is no exception, but the device does not respond as it should when receiving a Feature report. I suspect the report is being sent as an Output report instead.

I've enabled logging but did not see anything indicating a Feature report was sent.


Info

  • Platform: Windows 11
  • Device Type: HID
  • Hid.Net Version: 4.2.1

✅ What I want to know

  1. Does Hid.Net support SetFeature natively?
  2. If not, what's the recommended way to call HidD_SetFeature while using Hid.Net?
  3. Is it possible to extend the current device class to expose this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions