Hello,
You have to select the correct endpoints. I found the correct one by using a little program that gives you all the information you need. The program is called testlibusb-win.exe. After you run the program, connect the device and find the correct endpoint (HEX) for reading and writing.
I have uploaded the program on: http://www.xmit.be/files/x86.zip
To open a usb port I used the following code.
public void openDevice()
{
closeDevice();
mDevList = UsbGlobals.DeviceList;
foreach (UsbDevice bus in mDevList)
{
// Identification of Device
if (bus.Info.IdVendor == VENDOR_ID && bus.Info.IdProduct == PRODUCT_ID)
{
mDev = bus;
Console.WriteLine("Device: " + mDev.Info.ProductString + " - " + mDev.Info.ManufacturerString);
mDev.Open();
Debug.Assert(mDev.SetConfiguration(1) == 0);
Debug.Assert(mDev.ClaimInterface(0) == 0);
mEpReader = mDev.OpenBulkEndpointReader(ReadEndpoints.Ep01); // 0x81 thanks to program
mEpWriter = mDev.OpenBulkEndpointWriter(WriteEndpoints.Ep03);// 0x03
mEpReader.DataReceivedEnabled = false;
}
}
}
After opening the device you can read/write data by using the mEpReader.Read()/mEpReader.Write() methods. Choose your input buffer big enough otherwise you also will get an error.
I hope this has helped you.
Ps: The source code will become available on sourceForge as soon as I finish the program.
With Kind Regards,
Tim