1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>struct usb_composite_driver</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="USB Gadget API for Linux"><link rel="up" href="composite.html" title="Composite Device Framework"><link rel="prev" href="API-struct-usb-configuration.html" title="struct usb_configuration"><link rel="next" href="API-module-usb-composite-driver.html" title="module_usb_composite_driver"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">struct usb_composite_driver</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-struct-usb-configuration.html">Prev</a> </td><th width="60%" align="center">Composite Device Framework</th><td width="20%" align="right"> <a accesskey="n" href="API-module-usb-composite-driver.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-struct-usb-composite-driver"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct usb_composite_driver — 2 groups configurations into a gadget 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="programlisting"> 4struct usb_composite_driver { 5 const char * name; 6 const struct usb_device_descriptor * dev; 7 struct usb_gadget_strings ** strings; 8 enum usb_device_speed max_speed; 9 unsigned needs_serial:1; 10 int (* bind) (struct usb_composite_dev *cdev); 11 int (* unbind) (struct usb_composite_dev *); 12 void (* disconnect) (struct usb_composite_dev *); 13 void (* suspend) (struct usb_composite_dev *); 14 void (* resume) (struct usb_composite_dev *); 15 struct usb_gadget_driver gadget_driver; 16}; </pre></div><div class="refsect1"><a name="idp1124356428"></a><h2>Members</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">name</span></dt><dd><p> 17 For diagnostics, identifies the driver. 18 </p></dd><dt><span class="term">dev</span></dt><dd><p> 19 Template descriptor for the device, including default device 20 identifiers. 21 </p></dd><dt><span class="term">strings</span></dt><dd><p> 22 tables of strings, keyed by identifiers assigned during <em class="parameter"><code>bind</code></em> 23 and language IDs provided in control requests. Note: The first entries 24 are predefined. The first entry that may be used is 25 USB_GADGET_FIRST_AVAIL_IDX 26 </p></dd><dt><span class="term">max_speed</span></dt><dd><p> 27 Highest speed the driver supports. 28 </p></dd><dt><span class="term">needs_serial</span></dt><dd><p> 29 set to 1 if the gadget needs userspace to provide 30 a serial number. If one is not provided, warning will be printed. 31 </p></dd><dt><span class="term">bind</span></dt><dd><p> 32 (REQUIRED) Used to allocate resources that are shared across the 33 whole device, such as string IDs, and add its configurations using 34 @<code class="function">usb_add_config</code>. This may fail by returning a negative errno 35 value; it should return zero on successful initialization. 36 </p></dd><dt><span class="term">unbind</span></dt><dd><p> 37 Reverses <em class="parameter"><code>bind</code></em>; called as a side effect of unregistering 38 this driver. 39 </p></dd><dt><span class="term">disconnect</span></dt><dd><p> 40 optional driver disconnect method 41 </p></dd><dt><span class="term">suspend</span></dt><dd><p> 42 Notifies when the host stops sending USB traffic, 43 after function notifications 44 </p></dd><dt><span class="term">resume</span></dt><dd><p> 45 Notifies configuration when the host restarts USB traffic, 46 before function notifications 47 </p></dd><dt><span class="term">gadget_driver</span></dt><dd><p> 48 Gadget driver controlling this driver 49 </p></dd></dl></div></div><div class="refsect1"><a name="idp1124366244"></a><h2>Description</h2><p> 50 Devices default to reporting self powered operation. Devices which rely 51 on bus powered operation should report this in their <em class="parameter"><code>bind</code></em> method. 52 </p><p> 53 54 Before returning from <em class="parameter"><code>bind</code></em>, various fields in the template descriptor 55 may be overridden. These include the idVendor/idProduct/bcdDevice values 56 normally to bind the appropriate host side driver, and the three strings 57 (iManufacturer, iProduct, iSerialNumber) normally used to provide user 58 meaningful device identifiers. (The strings will not be defined unless 59 they are defined in <em class="parameter"><code>dev</code></em> and <em class="parameter"><code>strings</code></em>.) The correct ep0 maxpacket size 60 is also reported, as defined by the underlying controller driver. 61</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-struct-usb-configuration.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="composite.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-module-usb-composite-driver.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">struct usb_configuration</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">module_usb_composite_driver</span></td></tr></table></div></body></html> 62