Hello
First, great thanks for making so much ressources publicly available, this is indeed invaluable !
Communicating with my devices and testing works nicely.
But I came across one issue which looks like a bug.
One of my device has a InputReportByteLength=0x0 and OutputReportByteLength=0x3
I have updated the application to send 3 bytes.
When trying to write to the device, the bug arise in the FindTheHid sub.
Since the INputReportByteLength is 0, the runtime flow don't go into
If (MyHid.Capabilities.InputReportByteLength > 0) Then
' Set the size of the Input report buffer.
' Subtract 1 from the value in the Capabilities structure because
' the array begins at index 0.
Array.Resize(inputReportBuffer, MyHid.Capabilities.InputReportByteLength)
fileStreamdevicedata = New FileStream(hidHandle, FileAccess.Read Or FileAccess.Write, inputReportBuffer.Length, False)
End If
So in the ExchangeInputAndOutputReports sub, the
If (fileStreamdevicedata.CanWrite) Then
test throw a null object error
I have tried to fix the issue, by updating the ExchangeInputAndOutputReports to
...
If (fileStreamdevicedata.CanWrite) Then
'fileStreamdevicedata.Write(outputReportBuffer, 0, outputReportBuffer.Length)
fileStreamdevicedata.BeginWrite(outputReportBuffer, 0, outputReportBuffer.Length, New AsyncCallback(AddressOf GetOutputReportData), outputReportBuffer)
success = True
Else
...
And adding the fileStreamData initialization for this case in the FindTheHid handler:
...
If (MyHid.Capabilities.OutputReportByteLength > 0) Then
' Set the size of the Output report buffer.
' Subtract 1 from the value in the Capabilities structure because
' the array begins at index 0.
Array.Resize(outputReportBuffer, MyHid.Capabilities.OutputReportByteLength)
If (fileStreamdevicedata Is Nothing) Then
fileStreamdevicedata = New FileStream(hidHandle, FileAccess.Write, outputReportBuffer.Length, False)
End If
End If
...
But I'm still getting a runtime error
(approximative text, the error string beeing in french)
"The IO operation will not work. The file will probably get to big or the handle wasn't open to handler the synhchronous IO operations"
I'm not a VB expert so I might be missing something obvious, and getting this working would be really helpful, therefore any advice or insight really welcome to help me.
Regards,
Sébastien Portebois