Linux Kernel
3.7.1
|
#include <linux/kallsyms.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/utsname.h>
#include <linux/usb/composite.h>
#include <asm/unaligned.h>
Go to the source code of this file.
Macros | |
#define | for_each_ep_desc(start, ep_desc) |
int config_ep_by_speed | ( | struct usb_gadget * | g, |
struct usb_function * | f, | ||
struct usb_ep * | _ep | ||
) |
config_ep_by_speed() - configures the given endpoint according to gadget speed. : pointer to the gadget : usb function : the endpoint to configure
Return: error code, 0 on success
This function chooses the right descriptors for a given endpoint according to gadget speed and saves it in the endpoint desc field. If the endpoint already has a descriptor assigned to it - overwrites it with currently corresponding descriptor. The endpoint maxpacket field is updated according to the chosen descriptor. Note: the supplied function should hold all the descriptors for supported speeds
Definition at line 78 of file composite.c.
EXPORT_SYMBOL_GPL | ( | config_ep_by_speed | ) |
EXPORT_SYMBOL_GPL | ( | usb_add_function | ) |
EXPORT_SYMBOL_GPL | ( | usb_function_deactivate | ) |
EXPORT_SYMBOL_GPL | ( | usb_function_activate | ) |
EXPORT_SYMBOL_GPL | ( | usb_interface_id | ) |
EXPORT_SYMBOL_GPL | ( | usb_add_config | ) |
EXPORT_SYMBOL_GPL | ( | usb_string_id | ) |
EXPORT_SYMBOL_GPL | ( | usb_string_ids_tab | ) |
EXPORT_SYMBOL_GPL | ( | usb_string_ids_n | ) |
EXPORT_SYMBOL_GPL | ( | usb_composite_probe | ) |
EXPORT_SYMBOL_GPL | ( | usb_composite_unregister | ) |
EXPORT_SYMBOL_GPL | ( | usb_composite_setup_continue | ) |
EXPORT_SYMBOL_GPL | ( | usb_composite_overwrite_options | ) |
MODULE_AUTHOR | ( | "David Brownell" | ) |
MODULE_LICENSE | ( | "GPL" | ) |
int usb_add_config | ( | struct usb_composite_dev * | cdev, |
struct usb_configuration * | config, | ||
int(*)(struct usb_configuration *) | bind | ||
) |
usb_add_config() - add a configuration to a device. : wraps the USB gadget : the configuration, with bConfigurationValue assigned : the configuration's bind function Context: single threaded during gadget setup
One of the main tasks of a composite () routine is to add each of the configurations it supports, using this routine.
This function returns the value of the configuration's (), which is zero for success else a negative errno value. Binding configurations assigns global resources including string IDs, and per-configuration resources such as interface IDs and endpoints.
Definition at line 682 of file composite.c.
int usb_add_function | ( | struct usb_configuration * | config, |
struct usb_function * | function | ||
) |
usb_add_function() - add a function to a configuration : the configuration : the function being added Context: single threaded during gadget setup
After initialization, each configuration must have one or more functions added to it. Adding a function involves calling its () method to allocate resources such as interface and string identifiers and endpoints.
This function returns the value of the function's bind(), which is zero for success else a negative errno value.
Definition at line 173 of file composite.c.
void usb_composite_overwrite_options | ( | struct usb_composite_dev * | cdev, |
struct usb_composite_overwrite * | covr | ||
) |
Definition at line 1653 of file composite.c.
int usb_composite_probe | ( | struct usb_composite_driver * | driver | ) |
usb_composite_probe() - register a composite driver : the driver to register : the callback used to allocate resources that are shared across the whole device, such as string IDs, and add its configurations using (). This may fail by returning a negative errno value; it should return zero on successful initialization. Context: single threaded during gadget setup
This function is used to register drivers using the composite driver framework. The return value is zero, or a negative errno value. Those values normally come from the driver's method, which does all the work of setting up the driver to match the hardware.
On successful return, the gadget is ready to respond to requests from the host, unless one of its components invokes usb_gadget_disconnect() while it was binding. That would usually be done in order to wait for some userspace participation.
Definition at line 1566 of file composite.c.
void usb_composite_setup_continue | ( | struct usb_composite_dev * | cdev | ) |
usb_composite_setup_continue() - Continue with the control transfer : the composite device who's control transfer was kept waiting
This function must be called by the USB function driver to continue with the control transfer's data/status stage in case it had requested to delay the data/status stages. A USB function's setup handler (e.g. set_alt()) can request the composite framework to delay the setup request's data/status stages by returning USB_GADGET_DELAYED_STATUS.
Definition at line 1610 of file composite.c.
void usb_composite_unregister | ( | struct usb_composite_driver * | driver | ) |
usb_composite_unregister() - unregister a composite driver : the driver to unregister
This function is used to unregister drivers using the composite driver framework.
Definition at line 1594 of file composite.c.
int usb_function_activate | ( | struct usb_function * | function | ) |
usb_function_activate - allow function and gadget enumeration : function on which usb_function_activate() was called
Reverses effect of usb_function_deactivate(). If no more functions are delaying their activation, the gadget driver will respond to host enumeration procedures.
Returns zero on success, else negative errno.
Definition at line 265 of file composite.c.
int usb_function_deactivate | ( | struct usb_function * | function | ) |
usb_function_deactivate - prevent function and gadget enumeration : the function that isn't yet ready to respond
Blocks response of the gadget driver to host enumeration by preventing the data line pullup from being activated. This is normally called during () processing to change from the initial "ready to respond" state, or when a required resource becomes available.
For example, drivers that serve as a passthrough to a userspace daemon can block enumeration unless that daemon (such as an OBEX, MTP, or print server) is ready to handle host requests.
Not all systems support software control of their USB peripheral data pullups.
Returns zero on success, else negative errno.
Definition at line 237 of file composite.c.
int usb_interface_id | ( | struct usb_configuration * | config, |
struct usb_function * | function | ||
) |
usb_interface_id() - allocate an unused interface ID : configuration associated with the interface : function handling the interface Context: single threaded during gadget setup
usb_interface_id() is called from usb_function.bind() callbacks to allocate new interface IDs. The function driver will then store that ID in interface, association, CDC union, and other descriptors. It will also handle any control requests targeted at that interface, particularly changing its altsetting via set_alt(). There may also be class-specific or vendor-specific requests to handle.
All interface identifier should be allocated using this routine, to ensure that for example different functions don't wrongly assign different meanings to the same identifier. Note that since interface identifiers are configuration-specific, functions used in more than one configuration (or more than once in a given configuration) need multiple versions of the relevant descriptors.
Returns the interface ID which was allocated; or -ENODEV if no more interface IDs can be allocated.
Definition at line 309 of file composite.c.
void usb_remove_config | ( | struct usb_composite_dev * | cdev, |
struct usb_configuration * | config | ||
) |
usb_remove_config() - remove a configuration from a device. : wraps the USB gadget : the configuration
Drivers must call usb_gadget_disconnect before calling this function to disconnect the device from the host and make sure the host will not try to enumerate the device while we are changing the config list.
Definition at line 796 of file composite.c.
int usb_string_id | ( | struct usb_composite_dev * | cdev | ) |
usb_string_id() - allocate an unused string ID : the device whose string descriptor IDs are being allocated Context: single threaded during gadget setup
() is called from bind() callbacks to allocate string IDs. Drivers for functions, configurations, or gadgets will then store that ID in the appropriate descriptors and string table.
All string identifier should be allocated using this, () or () routine, to ensure that for example different functions don't wrongly assign different meanings to the same identifier.
Definition at line 945 of file composite.c.
int usb_string_ids_n | ( | struct usb_composite_dev * | c, |
unsigned | n | ||
) |
usb_string_ids_n() - allocate unused string IDs in batch : the device whose string descriptor IDs are being allocated
: number of string IDs to allocate Context: single threaded during gadget setup
Returns the first requested ID. This ID and next
-1 IDs are now valid IDs. At least provided that
is non-zero because if it is, returns last requested ID which is now very useful information.
() is called from bind() callbacks to allocate string IDs. Drivers for functions, configurations, or gadgets will then store that ID in the appropriate descriptors and string table.
All string identifier should be allocated using this, () or () routine, to ensure that for example different functions don't wrongly assign different meanings to the same identifier.
Definition at line 1009 of file composite.c.
int usb_string_ids_tab | ( | struct usb_composite_dev * | cdev, |
struct usb_string * | str | ||
) |
usb_string_ids() - allocate unused string IDs in batch : the device whose string descriptor IDs are being allocated : an array of usb_string objects to assign numbers to Context: single threaded during gadget setup
() is called from bind() callbacks to allocate string IDs. Drivers for functions, configurations, or gadgets will then copy IDs from the string table to the appropriate descriptors and string table for other languages.
All string identifier should be allocated using this, () or () routine, to ensure that for example different functions don't wrongly assign different meanings to the same identifier.
Definition at line 974 of file composite.c.