Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

usb_interface_id(9) [centos man page]

USB_INTERFACE_ID(9)					      Kernel Mode Gadget API					       USB_INTERFACE_ID(9)

usb_interface_id - allocate an unused interface ID SYNOPSIS
int usb_interface_id(struct usb_configuration * config, struct usb_function * function); ARGUMENTS
config configuration associated with the interface function function handling the interface CONTEXT
single threaded during gadget setup DESCRIPTION
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. AUTHOR
David Brownell <> Author. COPYRIGHT
Kernel Hackers Manual 3.10 June 2014 USB_INTERFACE_ID(9)

Check Out this Related Man Page

struct_usb_function - describes one function of a configuration SYNOPSIS
struct usb_function { const char * name; struct usb_gadget_strings ** strings; struct usb_descriptor_header ** descriptors; struct usb_descriptor_header ** hs_descriptors; struct usb_configuration * config; int (* bind) (struct usb_configuration *,struct usb_function *); void (* unbind) (struct usb_configuration *,struct usb_function *); int (* set_alt) (struct usb_function *,unsigned interface, unsigned alt); int (* get_alt) (struct usb_function *,unsigned interface); void (* disable) (struct usb_function *); int (* setup) (struct usb_function *,const struct usb_ctrlrequest *); void (* suspend) (struct usb_function *); void (* resume) (struct usb_function *); }; MEMBERS
name For diagnostics, identifies the function. strings tables of strings, keyed by identifiers assigned during bind and by language IDs provided in control requests descriptors Table of full (or low) speed descriptors, using interface and string identifiers assigned during bind(). If this pointer is null, the function will not be available at full speed (or at low speed). hs_descriptors Table of high speed descriptors, using interface and string identifiers assigned during bind(). If this pointer is null, the function will not be available at high speed. config assigned when usb_add_function() is called; this is the configuration with which this function is associated. bind Before the gadget can register, all of its functions bind to the available resources including string and interface identifiers used in interface or class descriptors; endpoints; I/O buffers; and so on. unbind Reverses bind; called as a side effect of unregistering the driver which added this function. set_alt (REQUIRED) Reconfigures altsettings; function drivers may initialize usb_ep.driver data at this time (when it is used). Note that setting an interface to its current altsetting resets interface state, and that all interfaces have a disabled state. get_alt Returns the active altsetting. If this is not provided, then only altsetting zero is supported. disable (REQUIRED) Indicates the function should be disabled. Reasons include host resetting or reconfiguring the gadget, and disconnection. setup Used for interface-specific control requests. suspend Notifies functions when the host stops sending USB traffic. resume Notifies functions when the host restarts USB traffic. DESCRIPTION
A single USB function uses one or more interfaces, and should in most cases support operation at both full and high speeds. Each function is associated by usb_add_function() with a one configuration; that function causes bind() to be called so resources can be allocated as part of setting up a gadget driver. Those resources include endpoints, which should be allocated using usb_ep_autoconfig(). To support dual speed operation, a function driver provides descriptors for both high and full speed operation. Except in rare cases that don't involve bulk endpoints, each speed needs different endpoint descriptors. Function drivers choose their own strategies for managing instance data. The simplest strategy just declares it "static', which means the function can only be activated once. If the function needs to be exposed in more than one configuration at a given speed, it needs to support multiple usb_function structures (one for each configuration). A more complex strategy might encapsulate a usb_function structure inside a driver-specific instance structure to allows multiple activations. An example of multiple activations might be a CDC ACM function that supports two or more distinct instances within the same configuration, providing several independent logical data links to a USB host. AUTHOR
David Brownell <> Author. COPYRIGHT
Kernel Hackers Manual 2.6. July 2010 STRUCT USB_FUNCTION(9)
Man Page