AnsweredAssumed Answered

handling USB vendor requests with a data stage in KSDK 2.2 on K64

Question asked by Ryan Lush on Dec 22, 2017
Latest reply on Jan 18, 2018 by Ryan Lush

I am rewriting some USB firmware that needs to play nicely with an existing windows library. The library uses setup packets to exchange an encryption key with the device. Other than that I'm doing nothing more than bulk transfers so I started with the dev_cdc_vcom_bm example and created my own cdc bulk class.

 

The way the old firmware works is to call a vendor request callback with the setup packet and the data that went along with it.

 

In KSDK 2.2, setup packets are handled in USB_DeviceControlCallback in usb_device_ch9.c. What doesnt make sense to me is it calls USB_DeviceClassCallback(handle, kUSB_DeviceEventVendorRequest, &controlRequest); before the data stage. USB_DeviceClassCallback is actually expecting the vendor requests callback to update a buffer pointer in &controlRequest so it knows where to put the data from the data stage.

 

What is the correct way to handle setup packets of type vendor, that include a data stage, given the existing KSDK 2.2 USB framework?

Outcomes