Re: USB gadget receiving data within setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 29 Jul 2009, Robin Callender wrote:

> Hi all,
> 
> I am working on a USB gadget driver for an audio device.

Are you aware that there are at least two other audio gadget 
implementations in the works?  Search through the mailing list 
archives.

> My reference spec is the "USB Device Class Definition for Audio Devices".
> I have the basic guts of the driver now, modeled after the gmidi gadget.
> But there is one part I am quite unhappy with: in particular the receiving
> of OUT data over ep0 for a setup-type transaction.
> As you may know, for Audio "SET_x" control operations, there is usually data
> carried as OUT phase, in addition to the standard w_* params received on the
> setup phase.
> For example, SET_CUR(volume) carries the new volume control value in the
> OUT phase of the setup transaction.

You probably mean "data stage", not "OUT phase" (see 8.5.3 in the USB 
2.0 spec).

> Basically I would like to know what the recommended model or coding pattern
> is for receiving OUT data during the setup callback.
> I have reviewed all the gadget drivers, but none appear to address this
> area, or I am missing something.
> Are there any sample sources or code snippets to act as a guide in this
> area?

The kerneldoc for usb_ep_queue() in include/linux/usb/gadget.h
discusses this, but somewhat briefly.

In drivers/usb/gadget/file_storage.c:class_setup_req(), the 
USB_CBI_ADSC_REQUEST case handles a control-OUT transfer.  Look in
fsg_setup() to see how this is done.  Basically you just submit a 
usb_request for ep0 to receive the OUT data.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux