|
code:
BOOL GetSensorData(BYTE *pOut, LONG bufsize)
{
OVERLAPPED inOvLap;
bool bRequest = FALSE;
inOvLap.hEvent = CreateEvent(NULL, false, false, NULL);
UCHAR *inContext = USBDevice->BulkInEndPt->BeginDataXfer(pOut,bufsize, &inOvLap);
if(!USBDevice->BulkInEndPt->WaitForXfer(&inOvLap,2000))
{
USBDevice->BulkInEndPt->Reset();
CloseHandle(inOvLap.hEvent);
return FALSE;
}
bRequest = USBDevice->BulkInEndPt->FinishDataXfer(pOut,bufsize, &inOvLap,inContext);
CloseHandle(inOvLap.hEvent);
if(!bRequest)
{
USBDevice->BulkInEndPt->Abort();
USBDevice->BulkInEndPt->Reset();
}
return bRequest ;
}
another question is that it looks like that the bufsize can't be too large,or this fuction will return FALSE, what should i do?
and i can't find cyusb.sys for 64 bit systerm.
|