Author Topic: Winusb Setup packet length  (Read 11325 times)

Luiz Gonzaga

  • Member
  • ***
  • Posts: 2
Winusb Setup packet length
« 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.


Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Winusb Setup packet length
« Reply #1 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

Luiz Gonzaga

  • Member
  • ***
  • Posts: 2
Re: Winusb Setup packet length
« Reply #2 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.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Winusb Setup packet length
« Reply #3 on: February 07, 2014, 09:27:02 am »
Good to know you got it working, thanks for posting.