My company has purchased a few PassMark USB 3.0 Loopback plugs.
The company has an API for C++ for using this plug, but since we mostly develop in C# I asked them if they supplied their API for .NET which they don't.
So far I've managed to establish a connection and send data back and forth, using SuiteUSB 3.4, over USB and this works fine.
However, there are a few vendor specific (PassMark) commands that I would like to send to the plug.
I've looked into how this is done in PassMarks C++ console implementation and it works fine.
My idea is to mimic this behaviour using SuiteUSB3.4.
For instance they perform
double Voltage = 0;
SendVendorCommand(CurUSBDevice, VENDOR_REQ_READ, GET_VOLTAGE, (UCHAR*)&Voltage, sizeof(Voltage));
bool SendVendorCommand(CCyUSBDevice *USBDevice, USB30_VENDOR RequestType, WORD wValue, UCHAR *buf, LONG buflen)
if (USBDevice->IsOpen() == false)
ept = USBDevice->ControlEndPt;
ept->Target = TGT_DEVICE;
ept->ReqType = REQ_VENDOR;
ept->ReqCode = 0x00;
ept->Value = wValue;
ept->Index = 0;
if (RequestType == VENDOR_REQ_READ)
which is fairly straight forward for reading the voltage for the device.
I want to perform the same in C#
ReadVendorCommand(device, GET_VOLTAGE, sizeof(double));
private byte ReadVendorCommand(CyUSBDevice device, ushort wValue, int lengthToRead)
var controlEndPoint = device.ControlEndPt;
controlEndPoint.Target = TGT_DEVICE;
controlEndPoint.ReqType = REQ_VENDOR;
controlEndPoint.ReqCode = 0x00;
controlEndPoint.Value = wValue;
controlEndPoint.Index = 0;
controlEndPoint.Direction = 1;
byte data = new byte[lengthToRead];
var result = controlEndPoint.Read(ref data, ref lengthToRead);
if (result) return data;
However, the data returned is all zeros (8 of them to be exact) and the lengthToRead (which was 8 when calling controlEndPoint.Read) is now only two bytes.
I've checked and the data and all patterns up to the call seem exactly the same as in the C++ code.
Since SuiteUSB 3.4 has not been updated for some quite some time (9 years) I was wondering if anyone else has any leads or tip that could point me in the right direction to resolve the issue.
Thanks a lot in advance,