Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
config.c File Reference
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/list.h>
#include <linux/string.h>
#include <linux/device.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>

Go to the source code of this file.

Functions

int usb_descriptor_fillbuf (void *buf, unsigned buflen, const struct usb_descriptor_header **src)
 
 EXPORT_SYMBOL_GPL (usb_descriptor_fillbuf)
 
int usb_gadget_config_buf (const struct usb_config_descriptor *config, void *buf, unsigned length, const struct usb_descriptor_header **desc)
 
 EXPORT_SYMBOL_GPL (usb_gadget_config_buf)
 
struct usb_descriptor_header ** usb_copy_descriptors (struct usb_descriptor_header **src)
 
 EXPORT_SYMBOL_GPL (usb_copy_descriptors)
 

Function Documentation

EXPORT_SYMBOL_GPL ( usb_descriptor_fillbuf  )
EXPORT_SYMBOL_GPL ( usb_gadget_config_buf  )
EXPORT_SYMBOL_GPL ( usb_copy_descriptors  )
struct usb_descriptor_header** usb_copy_descriptors ( struct usb_descriptor_header **  src)
read

usb_copy_descriptors - copy a vector of USB descriptors : null-terminated vector to copy Context: initialization code, which may sleep

This makes a copy of a vector of USB descriptors. Its primary use is to support usb_function objects which can have multiple copies, each needing different descriptors. Functions may have static tables of descriptors, which are used as templates and customized with identifiers (for interfaces, strings, endpoints, and more) as needed by a given function instance.

Definition at line 125 of file config.c.

int usb_descriptor_fillbuf ( void buf,
unsigned  buflen,
const struct usb_descriptor_header **  src 
)

usb_descriptor_fillbuf - fill buffer with descriptors : Buffer to be filled : Size of buf : Array of descriptor pointers, terminated by null pointer.

Copies descriptors into the buffer, returning the length or a negative error code if they can't all be copied. Useful when assembling descriptors for an associated set of interfaces used as part of configuring a composite device; or in other cases where sets of descriptors need to be marshaled.

Definition at line 37 of file config.c.

int usb_gadget_config_buf ( const struct usb_config_descriptor config,
void buf,
unsigned  length,
const struct usb_descriptor_header **  desc 
)

usb_gadget_config_buf - builts a complete configuration descriptor : Header for the descriptor, including characteristics such as power requirements and number of interfaces. : Null-terminated vector of pointers to the descriptors (interface, endpoint, etc) defining all functions in this device configuration. : Buffer for the resulting configuration descriptor. : Length of buffer. If this is not big enough to hold the entire configuration descriptor, an error code will be returned.

This copies descriptors into the response buffer, building a descriptor for that configuration. It returns the buffer length or a negative status code. The config.wTotalLength field is set to match the length of the result, but other descriptor fields (including power usage and interface count) must be set by the caller.

Gadget drivers could use this when constructing a config descriptor in response to USB_REQ_GET_DESCRIPTOR. They will need to patch the resulting bDescriptorType value if USB_DT_OTHER_SPEED_CONFIG is needed.

Definition at line 79 of file config.c.