From: Rick Bohning on 28 Nov 2006 13:21 All: I am using the WdfUsbTargetPipeReadSynchronously function to retrieve data from a bulk pipe. The data comes back fine, but the bytes read parm is all screwey. The board is a Cypress FX2 development board which an hardware engineer krufted together something that would blast back 512 bytes of data on the bulk pipe. The Bytes Read parm that is coming back tends to look like an NTSTATUS value, in that it is usually 0xCxxxxxxx. I extended an existing WDM driver to see if I could read the bulk pipe correctly with WDM. I could. The data and the number of bytes read come back correctly. Running version 1.1 of KMDF on an XP professional machine. Code snippet NTSTATUS CClass::CmdUSBDebugReadBulkData(WDFQUEUE Queue, WDFREQUEST Request, size_t OutputBufferLength, size_t /*InputBufferLength*/, ULONG /*IoControlCode*/) { KdPrint(("CHARTRVXD_CMD_EP_USB_DEBUG_BULK_READ_DATA\n")); NTSTATUS status = STATUS_UNSUCCESSFUL; if(OutputBufferLength < 512) return status; //get device context WDFDEVICE hDevice = WdfIoQueueGetDevice(Queue); PDEVICE_CONTEXT pContext = GetDeviceContext(hDevice); //get the pipe from the device context WDFUSBPIPE hBulkPipe = pContext->hBulkPipe; //get the memory WDFMEMORY hOutMemory; status = WdfRequestRetrieveOutputMemory(Request, &hOutMemory); if(!NT_SUCCESS(status)) return status; WDF_MEMORY_DESCRIPTOR memDesc; WDF_MEMORY_DESCRIPTOR_INIT_HANDLE(&memDesc, hOutMemory, NULL); ULONG bytesRead = 0; status = WdfUsbTargetPipeReadSynchronously(hBulkPipe, Request, NULL, &memDesc, &bytesRead); if(NT_SUCCESS(status)) { WdfRequestSetInformation(Request,bytesRead); } return status; }
|
Pages: 1 Prev: InitializePrintMonitor2 Next: MSVAD Virtual Audio Driver problem |