Marlon
2011-02-23 03:22:16 UTC
Hi,
Is anybody else experiencing this problem? It only happens in Windows
7. I tried it in Windows XP and could not reproduce there. Basically
I have a C++ app that recieves streaming data from our firmware. In a
separate thread I have a loop that calls BeginDataXfer() (Cypress USB
API Call) and when the event is signaled it calls FinishDataXfer()
(Cypress USB API Call). Everything is working fine until a user
inserts a thumbdrive to do other stuff and when he pulled it out I get
this error from FinishDataXfer(). This happens 50% of the time, so I
think it's a timing issue but I don't know how to work around it.
Here's my environment:
MS Visual Studio 2010
32-bit Windows 7 Professional,
Cypress driver 3.4.2.0,
The chip we are using is the Cypress Chip CY7C68001-56PVC.
The application is as a high speed USB interface to the DSP processor.
Here's a code snippet within the thread:
case WAIT_OBJECT_0+2: //overlapped read operation done
{
if(pInContext!=NULL && BulkInEpt!=NULL)
{
nLength=nBufferSize;
::ResetEvent(t_osRead.hEvent);
if(BulkInEpt->FinishDataXfer(szReceiveBuffer, nLength,
&t_osRead,pInContext))
{
szReceiveBuffer[nLength]=0;
pThis->UpdateTotalXFerBytes(nLength);
pThis->ApppendToReplyProcessQueue(szReceiveBuffer,
nLength);
//Start an async. read again
nLength=nBufferSize;
pInContext=BulkInEpt-
ReplyProcessThread
Sleep(0);
}
else
{
DWORD dwLastError=::GetLastError();
MessageBox.Show( "Reply-receive failed,
reconnecting...error code"+dwLastError);
}
}
}
break;
BTW, the GetLastError() always returns ERROR_IO_PENDING even before
the user removes a thumbdrive which another interesting phenomena.
Any insight would be appreciated.
Thank you.
Is anybody else experiencing this problem? It only happens in Windows
7. I tried it in Windows XP and could not reproduce there. Basically
I have a C++ app that recieves streaming data from our firmware. In a
separate thread I have a loop that calls BeginDataXfer() (Cypress USB
API Call) and when the event is signaled it calls FinishDataXfer()
(Cypress USB API Call). Everything is working fine until a user
inserts a thumbdrive to do other stuff and when he pulled it out I get
this error from FinishDataXfer(). This happens 50% of the time, so I
think it's a timing issue but I don't know how to work around it.
Here's my environment:
MS Visual Studio 2010
32-bit Windows 7 Professional,
Cypress driver 3.4.2.0,
The chip we are using is the Cypress Chip CY7C68001-56PVC.
The application is as a high speed USB interface to the DSP processor.
Here's a code snippet within the thread:
case WAIT_OBJECT_0+2: //overlapped read operation done
{
if(pInContext!=NULL && BulkInEpt!=NULL)
{
nLength=nBufferSize;
::ResetEvent(t_osRead.hEvent);
if(BulkInEpt->FinishDataXfer(szReceiveBuffer, nLength,
&t_osRead,pInContext))
{
szReceiveBuffer[nLength]=0;
pThis->UpdateTotalXFerBytes(nLength);
pThis->ApppendToReplyProcessQueue(szReceiveBuffer,
nLength);
//Start an async. read again
nLength=nBufferSize;
pInContext=BulkInEpt-
BeginDataXfer(szReceiveBuffer,nLength,&t_osRead);
// be nice and make sure giving time toReplyProcessThread
Sleep(0);
}
else
{
DWORD dwLastError=::GetLastError();
MessageBox.Show( "Reply-receive failed,
reconnecting...error code"+dwLastError);
}
}
}
break;
BTW, the GetLastError() always returns ERROR_IO_PENDING even before
the user removes a thumbdrive which another interesting phenomena.
Any insight would be appreciated.
Thank you.