Discussion:
[Libusb-win32-devel] ReadBufferSize cause error windows8
Zaslavsky Evelina
2015-10-20 08:12:01 UTC
Permalink
Hi All, I'm really sorry for disturbing you. I have a problem with my
LibUsbDotNet project and asking for your help.

In windows 7 the project works correctly, but when I migrate the project to
windows 8 i get the follow error:
No data to read IOTimeOut.
(I checked the devise side, cmdWrite reseaved correctly and device send the
answer)

This is the function:
private void cmdRead_Click(object sender, EventArgs e)
{
cmdRead.Enabled = false;
byte[] readBuffer = new byte[1024];
int uiTransmitted;
ErrorCode eReturn;

if ((eReturn = mEpReader.Read(readBuffer, 1000, out
uiTransmitted)) == ErrorCode.None)
{
tsStatus.Text = uiTransmitted + " bytes read.";
showBytes(readBuffer, uiTransmitted);
}
else
tsStatus.Text = "No data to read! " + eReturn;
}
cmdRead.Enabled = true;
}

After this readBuffer contains the readed correct answer from device, but
eReturn = IOTimeOut

When I debugged it i sow that
the follow function returns false:

Kernel32.DeviceIoControl(endPointBase.Device.Handle,
cltCode,
req,
LibUsbRequest.Size,
buffer,
bufferLength,
out lengthTransferred,
pOverlapped);

This error happens if the readBuffe.size more then 64.

mEpReader.ReadBufferSize = 1024; - doesn't help

This code will run perfect:

private void cmdRead_Click(object sender, EventArgs e)
{
cmdRead.Enabled = false;
byte[] readBuffer = new byte[64];;
int uiTransmitted;
ErrorCode eReturn;

if ((eReturn = mEpReader.Read(readBuffer, 1000, out
uiTransmitted)) == ErrorCode.None)
{
tsStatus.Text = uiTransmitted + " bytes read.";
showBytes(readBuffer, uiTransmitted);
}
else
tsStatus.Text = "No data to read! " + eReturn;
}
cmdRead.Enabled = true;
}

I already reinstalled the LibUSB0 drivers.

Thank you for your attention.

Have a nice day.
Xiaofan Chen
2015-10-21 08:33:56 UTC
Permalink
Post by Zaslavsky Evelina
Hi All, I'm really sorry for disturbing you. I have a problem with my
LibUsbDotNet project and asking for your help.
In windows 7 the project works correctly, but when I migrate the project to
No data to read IOTimeOut.
I already reinstalled the LibUSB0 drivers.
I do not know much about libusbdotnet so I am guessing here.
1) Have you tried to increase the timeout?
2) Can you try WinUSB driver instead or libusbK driver instead to see
if that helps?
--
Xiaofan

------------------------------------------------------------------------------
Loading...