Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Drivers > Communication to Cypress USB Driver is interrupted when user remove athumbdrive in Windows 7

Reply
Thread Tools Display Modes

Communication to Cypress USB Driver is interrupted when user remove athumbdrive in Windows 7

 
 
Marlon
Guest
Posts: n/a

 
      02-23-2011
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-
>BeginDataXfer(szReceiveBuffer,nLength,&t_osRead );


// be nice and make sure giving time to
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.




 
Reply With Quote
 
 
 
 
Marlon
Guest
Posts: n/a

 
      02-24-2011
On Feb 22, 7:22*pm, Marlon <mbaldov...@gmail.com> wrote:
> 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-
>
> >BeginDataXfer(szReceiveBuffer,nLength,&t_osRead );

>
> * * * * * * * * *// be nice and make sure giving time to
> 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.


The workaround in this Knowledge Base article worked after rebooting
the pc. But I have to use the "Safely Remove Hardware and Media" from
the system tray for it to work properly. If I just remove the USB
thumbdrive I still get the disconnection error.

http://support.microsoft.com/kb/2401954

 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Update keeps coming back with updates I already installed. JustWantItToWork Windows Update 5 03-01-2010 04:50 PM
Re: Disable Windows Firewall Lanwench [MVP - Exchange] Windows Small Business Server 7 01-06-2010 11:45 PM
crcdisk.sys start up problem (with boot log) Jimmy Windows Vista Hardware 2 08-13-2007 07:22 PM
BUGCODE_USB_DRIVER with external USB HDD PHILIPS Deathwing00 Windows Vista Hardware 11 06-15-2007 07:02 PM
Vista won't boot, kernal issues Lt. Washburn Windows Vista Installation 3 03-30-2007 01:09 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59