struct usb_gadget_driver {
char * function;
enum usb_device_speed speed;
int (* bind (struct usb_gadget *);
void (* unbind (struct usb_gadget *);
int (* setup (struct usb_gadget *,const struct usb_ctrlrequest *);
void (* disconnect (struct usb_gadget *);
void (* suspend (struct usb_gadget *);
void (* resume (struct usb_gadget *);
};
Devices are disabled till a gadget driver successfully binds, which means the driver will handle setup requests needed to enumerate (and meet ``chapter 9'' requirements) then do some useful work.
Drivers use hardware-specific knowledge to configure the usb hardware. endpoint addressing is only one of several hardware characteristics that are in descriptors the ep0 implementation returns from setup calls.
Except for ep0 implementation, most driver code shouldn't need change to run on top of different usb controllers. It'll use endpoints set up by that ep0 implementation.
The usb controller driver handles a few standard usb requests. Those include set_address, and feature flags for devices, interfaces, and endpoints (the get_status, set_feature, and clear_feature requests).
Accordingly, the driver's setup callback must always implement all get_descriptor requests, returning at least a device descriptor and a configuration descriptor. Drivers must make sure the endpoint descriptors match any hardware constraints. Some hardware also constrains other descriptors. (The pxa250 allows only configurations 1, 2, or 3).
The driver's setup callback must also implement set_configuration, and should also implement set_interface, get_configuration, and get_interface. Setting a configuration (or interface) is where endpoints should be activated or (config 0) shut down.
(Note that only the default control endpoint is supported. Neither hosts nor devices generally support control traffic except to ep0.)
Most devices will ignore USB suspend/resume operations, and so will not provide those callbacks. However, some may need to change modes when the host is not longer directing those activities. For example, local controls (buttons, dials, etc) may need to be re-enabled since the (remote) host can't do that any longer.
This documentation is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For more details see the file COPYING in the source distribution of Linux.
If you have comments on the formatting of this manpage, then please contact Michael Still (mikal@stillhq.com).
This documentation was generated with kernel version 2.6.0.