PORTS Forum

Ports and Interfaces => USB => Topic started by: Luiz Gonzaga on February 06, 2014, 11:46:00 am

Title: Winusb Setup packet length
Post by: Luiz Gonzaga on February 06, 2014, 11:46:00 am
Hi All

iīm using WINUSB to transfer data to my device. The device works fine. I have problem when i send a CONTROL WRITE with no data setup. I set wLenght to 0, but WINUSB send 1. I donīt have data in CONTROL WRITE SETUP PACKET but WINUSB put 1 byte there. Is it necessary put at least one byte in Data stage  with WINUSB ?? Is this correct with WINUSB ?

I have an older driver, built with DDK that works well. The driver donīt carry an extra byte at my CONTROL WRITE SETUP.

Title: Re: Winusb Setup packet length
Post by: Jan Axelson on February 06, 2014, 11:52:29 am
The documentation suggests that the Data stage is optional:

If the application does not expect any data to be transferred during the data phase (BufferLength is zero), LengthTransferred can be NULL.

Be sure to set LengthTransferred to NULL.

http://msdn.microsoft.com/en-us/library/windows/hardware/ff540219%28v=vs.85%29.aspx
Title: Re: Winusb Setup packet length
Post by: Luiz Gonzaga on February 07, 2014, 05:41:15 am
  :)

Tanks Jan

Iīm really make a mistake. I was setting zero in  WINUSB_SETUP_PACKET SetupPacket. The BufferLength was set to 1.
Now, everything is correct.

Tanks for help.
Title: Re: Winusb Setup packet length
Post by: Jan Axelson on February 07, 2014, 09:27:02 am
Good to know you got it working, thanks for posting.