1

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.

2

Re: HIDSharp HIDStream Write throws exception

What does the report descriptor look like for the device?

3

Re: HIDSharp HIDStream Write throws exception

Hello, the following Reports are supported according to GetReportDescriptor

ReportID (Reports)
--------
     177
     240
     241
     242
     243
     244
     245
     246
     247
     248
     249
     250
     251
     252
     253
     254
     240
     241
     242
     243
     244
     245
     246
     247
     248
     249
     250
     251
     252
     253
     254
     160
     161
     163
     162
     164
     176
     224
     225
     226
     
ReportID (InputReports)
--------
     177
     240
     241
     242
     243
     244
     245
     246
     247
     248
     249
     250
     251
     252
     253
     254
     
ReportID (OutputReports)
--------
     240
     241
     242
     243
     244
     245
     246
     247
     248
     249
     250
     251
     252
     253
     254
     
ReportID (FeatureReports)
--------
     160
     161
     163
     162
     164
     176
     224
     225
     226

0xC2 (194) is missing and the dll is working as expected I guess. But I'm not sure what to make of it as it works with the other dll.

If I can help with more information please tell me.

4

Re: HIDSharp HIDStream Write throws exception

Wow, that's a ton of Report IDs. What an unusual chip! Out of curiosity, what does GetRawReportDescriptor() return?

Based on the documentation of the FT260, that list appears to lack quite a few of the Report IDs that should exist. It's possible it is not reconstructing the report descriptor correctly (on Mac and Linux, it is able to retrieve it, but on Windows, it must reconstruct it as there is no API to get it directly). That said, the report descriptor should not affect your ability to write.

Are you using HidLibrary on the same PC? If not, is it possible to configure the FTDI chip to support I2C or UART? I wonder if Windows is caching an old HID descriptor.