Topic: HIDSharp HIDStream Write throws exception
Hello,
I've trying to communicate with a FTDI FT260 Chip with the HIDSharp Library 2.1.
I can search / select the device, open it and get / set feature reports.
Also I get a HIDstream object back from the Open method. It is of type WinHidStream derived from HIDSharp.Platform.SysHidStream
Reading fails with the timeout as expected, as there is nothing to read yet,
But I'm unable to write a Byte array to the device with HIDStream.Write. I always get "Operation failed early: falscher Parameter" the german part meaning "wrong Parameter".
The following topic is related but the thread starter never answered back, so in my case. "Yes, I'm putting the report ID in the first byte." -->forum.zer7.com/topic/10086/
Here is the code up to this point (PowerShell on Windows 10 Version 1809 x64):
Add-Type -Path .\HidSharp.dll
[HidSharp.HidDevice[]]$devs = [HIDSharp.DeviceList]::Local.GetHidDevices(0x0403,0x6030)
[HIDSharp.HIDStream]$devstream = $devs[0].Open()
$buffer = New-Object Byte[] $devs[0].GetMaxFeatureReportLength()
$buffer[0] = 0xA1
$buffer.Count
$devstream.GetFeature($buffer)
$buffer[0] = 0xA1
$buffer[1] = 0x08
$buffer[2] = 0x04
$devstream.SetFeature($buffer)
$buffer = New-Object Byte[] $devs[0].GetMaxOutputReportLength()
$buffer[0] = 0xD0
$buffer[1] = 0x48
$buffer[2] = 0x06
$buffer[3] = 0x01
$buffer[4] = 0x00
$devstream.Write($buffer)
Has anyone an idea what to look for ?
To verify the device being working at all, I tried the same thing with the HidLibrary dll project, where it works. But I'd like to stay with HIDSharp because here the timeouts are working.