]> Pileus Git - ~andy/linux/blobdiff - Documentation/DocBook/usb.tmpl
Merge branch 'master' into 83xx
[~andy/linux] / Documentation / DocBook / usb.tmpl
index 8a28f76b935958028d84c5ec8f167e02a16299a0..a2ebd651b05a8d241dc529ae29c3ee05fd7459ac 100644 (file)
 
 <chapter><title>USB-Standard Types</title>
 
-    <para>In <filename>&lt;linux/usb_ch9.h&gt;</filename> you will find
+    <para>In <filename>&lt;linux/usb/ch9.h&gt;</filename> you will find
     the USB data types defined in chapter 9 of the USB specification.
     These data types are used throughout USB, and in APIs including
     this host side API, gadget APIs, and usbfs.
     </para>
 
-!Iinclude/linux/usb_ch9.h
+!Iinclude/linux/usb/ch9.h
 
     </chapter>
 
        <emphasis>usbdevfs</emphasis> although it wasn't solving what
        <emphasis>devfs</emphasis> was.
        Every USB device will appear in usbfs, regardless of whether or
-       not it has a kernel driver; but only devices with kernel drivers
-       show up in devfs.
+       not it has a kernel driver.
        </para>
 
        <sect1>
            file in your Linux kernel sources.
            </para>
 
-           <para>Otherwise the main use for this file from programs
-           is to poll() it to get notifications of usb devices
-           as they're plugged or unplugged.
-           To see what changed, you'd need to read the file and
-           compare "before" and "after" contents, scan the filesystem,
-           or see its hotplug event.
+           <para>This file, in combination with the poll() system call, can
+           also be used to detect when devices are added or removed:
+<programlisting>int fd;
+struct pollfd pfd;
+
+fd = open("/proc/bus/usb/devices", O_RDONLY);
+pfd = { fd, POLLIN, 0 };
+for (;;) {
+       /* The first time through, this call will return immediately. */
+       poll(&amp;pfd, 1, -1);
+
+       /* To see what's changed, compare the file's previous and current
+          contents or scan the filesystem.  (Scanning is more precise.) */
+}</programlisting>
+           Note that this behavior is intended to be used for informational
+           and debug purposes.  It would be more appropriate to use programs
+           such as udev or HAL to initialize a device or start a user-mode
+           helper program, for instance.
            </para>
-
        </sect1>
 
        <sect1>
 #include &lt;asm/byteorder.h&gt;</programlisting>
            The standard USB device model requests, from "Chapter 9" of
            the USB 2.0 specification, are automatically included from
-           the <filename>&lt;linux/usb_ch9.h&gt;</filename> header.
+           the <filename>&lt;linux/usb/ch9.h&gt;</filename> header.
            </para>
 
            <para>Unless noted otherwise, the ioctl requests
@@ -730,7 +740,7 @@ usbdev_ioctl (int fd, int ifno, unsigned request, void *param)
                <title>Synchronous I/O Support</title>
 
                <para>Synchronous requests involve the kernel blocking
-               until until the user mode request completes, either by
+               until the user mode request completes, either by
                finishing successfully or by reporting an error.
                In most cases this is the simplest way to use usbfs,
                although as noted above it does prevent performing I/O