1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Chapter 5. Gadget Drivers</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="index.html" title="USB Gadget API for Linux"><link rel="prev" href="controllers.html" title="Chapter 4. Peripheral Controller Drivers"><link rel="next" href="otg.html" title="Chapter 6. USB On-The-GO (OTG)"></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">Chapter 5. Gadget Drivers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="controllers.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="otg.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="gadget"></a>Chapter 5. Gadget Drivers</h1></div></div></div><p>In addition to <span class="emphasis"><em>Gadget Zero</em></span> 2(used primarily for testing and development with drivers 3for usb controller hardware), other gadget drivers exist. 4</p><p>There's an <span class="emphasis"><em>ethernet</em></span> gadget 5driver, which implements one of the most useful 6<span class="emphasis"><em>Communications Device Class</em></span> (CDC) models. 7One of the standards for cable modem interoperability even 8specifies the use of this ethernet model as one of two 9mandatory options. 10Gadgets using this code look to a USB host as if they're 11an Ethernet adapter. 12It provides access to a network where the gadget's CPU is one host, 13which could easily be bridging, routing, or firewalling 14access to other networks. 15Since some hardware can't fully implement the CDC Ethernet 16requirements, this driver also implements a "good parts only" 17subset of CDC Ethernet. 18(That subset doesn't advertise itself as CDC Ethernet, 19to avoid creating problems.) 20</p><p>Support for Microsoft's <span class="emphasis"><em>RNDIS</em></span> 21protocol has been contributed by Pengutronix and Auerswald GmbH. 22This is like CDC Ethernet, but it runs on more slightly USB hardware 23(but less than the CDC subset). 24However, its main claim to fame is being able to connect directly to 25recent versions of Windows, using drivers that Microsoft bundles 26and supports, making it much simpler to network with Windows. 27</p><p>There is also support for user mode gadget drivers, 28using <span class="emphasis"><em>gadgetfs</em></span>. 29This provides a <span class="emphasis"><em>User Mode API</em></span> that presents 30each endpoint as a single file descriptor. I/O is done using 31normal <span class="emphasis"><em>read()</em></span> and <span class="emphasis"><em>read()</em></span> calls. 32Familiar tools like GDB and pthreads can be used to 33develop and debug user mode drivers, so that once a robust 34controller driver is available many applications for it 35won't require new kernel mode software. 36Linux 2.6 <span class="emphasis"><em>Async I/O (AIO)</em></span> 37support is available, so that user mode software 38can stream data with only slightly more overhead 39than a kernel driver. 40</p><p>There's a USB Mass Storage class driver, which provides 41a different solution for interoperability with systems such 42as MS-Windows and MacOS. 43That <span class="emphasis"><em>Mass Storage</em></span> driver uses a 44file or block device as backing store for a drive, 45like the <code class="filename">loop</code> driver. 46The USB host uses the BBB, CB, or CBI versions of the mass 47storage class specification, using transparent SCSI commands 48to access the data from the backing store. 49</p><p>There's a "serial line" driver, useful for TTY style 50operation over USB. 51The latest version of that driver supports CDC ACM style 52operation, like a USB modem, and so on most hardware it can 53interoperate easily with MS-Windows. 54One interesting use of that driver is in boot firmware (like a BIOS), 55which can sometimes use that model with very small systems without 56real serial lines. 57</p><p>Support for other kinds of gadget is expected to 58be developed and contributed 59over time, as this driver framework evolves. 60</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="controllers.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="otg.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 4. Peripheral Controller Drivers </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 6. USB On-The-GO (OTG)</td></tr></table></div></body></html> 61