Skip to content

Quick start example doesn't work (Hid.Net.Windows.WindowsHidException: WriteBufferSize must be specified) #80

Open
@zkbpkp

Description

@zkbpkp

I'm trying to rewrite a quick start example to read data from my USB mouse:

WindowsUsbDeviceFactory.Register();
WindowsHidDeviceFactory.Register();

var definitions = new List<FilterDeviceDefinition>
{
    new FilterDeviceDefinition
    {
        DeviceType = DeviceType.Hid,
        VendorId = 0x18F8,
        ProductId = 0x0F99,
    }
};

var devices = await DeviceManager.Current.GetDevicesAsync(definitions);
var device = devices.FirstOrDefault();
if (device == null)
{
    Console.WriteLine("No connected devices");
    return;
}
await device.InitializeAsync();

The last line (InitializeAsync) throws the following exception:

Unhandled Exception: Hid.Net.Windows.WindowsHidException: WriteBufferSize must be specified. HidD_GetAttributes may have failed or returned an OutputReportByteLength of 0. Please specify this argument in the constructor. Note: Hid devices are always opened in write
 mode. If you need to open in read mode, please log an issue here: https://github.com/MelbourneDeveloper/Device.Net/issues

Not sure where I should specialize WriteBufferSize as I don't call WindowsHidDevice constructor explicitly anywhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions