Dear all,
I try to port da esktop USB driver to WinCE.Net 4.2 for a custom USB
hardware. On desktop PC, it use UsbBuildVendorRequest to send a data out
through control endpoint and receive data using
UsbBuildInterruptOrBulkTransferRequest from bulk endpoint.
-------------------------------------------------------- PC USB
er: --------------------------------------------------------------
Write:
// write to default pipe
UsbBuildVendorRequest(urb,
URB_FUNCTION_VENDOR_ENDPOINT,
sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST),
0,
4, //ReservedBits
0x01, // bRequest
0, // wValue (not use)
0, // wIndex (not use)
&(inputBuffer[3]), // data
NULL,
0, // data length
NULL
);
Read:
// read from bulk pipe
UsbBuildInterruptOrBulkTransferRequest(urb, sizeof(struct
_URB_BULK_OR_INTERRUPT_TRANSFER), pipeInfo->PipeHandle, NULL,
Irp->MdlAddress, 8,
USBD_TRANSFER_DIRECTION_IN|USBD_SHORT_TRANSFER_OK, NULL);
----------------------------------------------------------------------------
--------------------------------------------------------------
For WinCE.Net, I have replace these two function to IssueVendorTransfer and
IssueBulkTransfer.
-------------------------------------------------------- WinCE.Net
-----------------------------------------------------------
Write:
ControlHeader.bmRequestType =
0x04|USB_REQUEST_VENDOR|USB_REQUEST_FOR_ENDPOINT;
ControlHeader.bRequest = 0x01;
ControlHeader.wValue = 0;
ControlHeader.wIndex = 0;
ControlHeader.wLength = 0;
m_hControlTransfer = (*m_lpUsbFuncs->lpIssueVendorTransfer)(m_hDevice,
NULL, NULL, 0 ,
&ControlHeader, (LPVOID) 0, 0);
Read:
m_hBulkTransfer = (*m_lpUsbFuncs->lpIssueBulkTransfer)( m_hBulkPipeIn,
BulkTransferComplete, 0,
USB_IN_TRANSFER |
USB_SHORT_TRANSFER_OK, 8, (LPVOID)m_pbDataBuffer, 0);
----------------------------------------------------------------------------
--------------------------------------------------------------
My problem is I can send out data to USB device successfully because I
receive USB_NO_ERROR when calling GetTransferStatus().
When i try to read data from bulk pipe, IssueBulkTransfer return a handle
but when call GetTransferStatus(), it returns
USB_DEVICE_NOT_RESPONDING_ERROR.
FYI, I have a valid m_hBulkPipeIn that point to pipe address 0x81.
Do you guys have any idea which step i did wrong? Is the my setting for
above function correct (IssueVendorTransfer & IssueBulkTransfer)?
Or, did i miss out something?
Is ReservedBits in UsbBuildVendorRequest equivalent to bmRequestType for
IssueVendorTransfer?
Thank for your help.
Best Regards,
Francis