Announcements
IMPORTANT: Cypress Developer Community is transitioning on October 20th. To learn more and be prepared for this change, check out our latest announcement.
cancel
Showing results for 
Search instead for 
Did you mean: 

USB Low-Full-High Speed Peripherals

Anonymous
Not applicable

Hi,

   

I'm trying to make a bulk transfer using the IOCTL Interface of the cyusb.sys driver with Delphi, but the DeviceIOControl Function always returns 87 (ERROR_INVALID_PARAMETER).

   

I'm using the following Code :

   

procedure NonEP0TransferOut(handle:THandle;endPointAddress:Byte; pBuffer:PBuffer; bufferSize:Word);
const cBufSize = 512;
var
    singleTransfer:SINGLE_TRANSFER;
  buffer : array[0..cBufSize+SizeOf(SINGLE_TRANSFER)-1] of Byte;
  i : Integer;
  dwBytes: DWORD;
begin
    ZeroMemory(@singleTransfer, SizeOf(SINGLE_TRANSFER));

  SingleTransfer.SetupPacket.ulTimeOut := 1000;
  singleTransfer.ucEndpointAddress := endPointAddress;
  singleTransfer.IsoPacketLength := 0;
  singleTransfer.BufferOffset := SizeOf(SINGLE_TRANSFER);
  singleTransfer.BufferLength := bufferSize;
  dwBytes := 0;

    Move(SingleTransfer,Buffer,SizeOf(SINGLE_TRANSFER));

  for i := 0 to bufferSize-1 do begin
      buffer[i+SizeOf(TSingleTransfernEP0)] := pBuffer^; // buffer direkt hinter den SINGLE_TRANFER record schreiben
  end;

  if not DeviceIoControl(    handle,IOCTL_ADAPT_SEND_NON_EP0_TRANSFER,
                          @buffer, bufferSize+SizeOf(SINGLE_TRANSFER),
                          @buffer, bufferSize+SizeOf(SINGLE_TRANSFER),
                          dwBytes,nil) then
      raise ECyUSBException.Create('Error #17 during nonEP0 control Transfer : ' + IntToStr(getLastError()));
end;

   

The SINGLE_TRANSFER structure seems to be correct. It works fine for EP0 Transfers. I also tried IOCTL_ADAPT_SEND_NON_EP0_DIRECT, which gives the same error. Can someone tell me what I'm doing wrong ?

   

regards

   

Simon Koops

0 Likes
2 Replies
Anonymous
Not applicable

I have the solution now, i used pipe address instead of descriptor address. now it works

0 Likes
Anonymous
Not applicable

 Glad to hear that the problem is solved now, and good that you shared it here.

   

 

   

Regards,

   

Gayathri

0 Likes