Commit 9a3c8b35 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Jonathan Corbet

usb.rst: Enrich its ReST representation

- use the proper warning and note markups;
- add references for parts of the document that will be
  cross-referenced on other USB docs;
- some minor adjustments to make it better to read in
  text mode and in html.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent 4ad4b21b
...@@ -102,6 +102,8 @@ disconnect testing (while the device is active) with each different host ...@@ -102,6 +102,8 @@ disconnect testing (while the device is active) with each different host
controller driver, to make sure drivers don't have bugs of their own as controller driver, to make sure drivers don't have bugs of their own as
well as to make sure they aren't relying on some HCD-specific behavior. well as to make sure they aren't relying on some HCD-specific behavior.
.. _usb_chapter9:
USB-Standard Types USB-Standard Types
================== ==================
...@@ -112,6 +114,8 @@ USB, and in APIs including this host side API, gadget APIs, and usbfs. ...@@ -112,6 +114,8 @@ USB, and in APIs including this host side API, gadget APIs, and usbfs.
.. kernel-doc:: include/linux/usb/ch9.h .. kernel-doc:: include/linux/usb/ch9.h
:internal: :internal:
.. _usb_header:
Host-Side Data Types and Macros Host-Side Data Types and Macros
=============================== ===============================
...@@ -209,7 +213,7 @@ library that wraps it. Such libraries include ...@@ -209,7 +213,7 @@ library that wraps it. Such libraries include
`libusb <http://libusb.sourceforge.net>`__ for C/C++, and `libusb <http://libusb.sourceforge.net>`__ for C/C++, and
`jUSB <http://jUSB.sourceforge.net>`__ for Java. `jUSB <http://jUSB.sourceforge.net>`__ for Java.
**Note** .. note::
This particular documentation is incomplete, especially with respect This particular documentation is incomplete, especially with respect
to the asynchronous mode. As of kernel 2.5.66 the code and this to the asynchronous mode. As of kernel 2.5.66 the code and this
...@@ -319,9 +323,7 @@ files. For information about the current format of this file, see the ...@@ -319,9 +323,7 @@ files. For information about the current format of this file, see the
sources. sources.
This file, in combination with the poll() system call, can also be used This file, in combination with the poll() system call, can also be used
to detect when devices are added or removed: to detect when devices are added or removed::
::
int fd; int fd;
struct pollfd pfd; struct pollfd pfd;
...@@ -407,9 +409,7 @@ The ioctl() Requests ...@@ -407,9 +409,7 @@ The ioctl() Requests
-------------------- --------------------
To use these ioctls, you need to include the following headers in your To use these ioctls, you need to include the following headers in your
userspace program: userspace program::
::
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/usbdevice_fs.h> #include <linux/usbdevice_fs.h>
...@@ -458,9 +458,7 @@ USBDEVFS_CLAIMINTERFACE ...@@ -458,9 +458,7 @@ USBDEVFS_CLAIMINTERFACE
USBDEVFS_CONNECTINFO USBDEVFS_CONNECTINFO
Says whether the device is lowspeed. The ioctl parameter points to a Says whether the device is lowspeed. The ioctl parameter points to a
structure like this: structure like this::
::
struct usbdevfs_connectinfo { struct usbdevfs_connectinfo {
unsigned int devnum; unsigned int devnum;
...@@ -477,9 +475,7 @@ USBDEVFS_CONNECTINFO ...@@ -477,9 +475,7 @@ USBDEVFS_CONNECTINFO
USBDEVFS_GETDRIVER USBDEVFS_GETDRIVER
Returns the name of the kernel driver bound to a given interface (a Returns the name of the kernel driver bound to a given interface (a
string). Parameter is a pointer to this structure, which is string). Parameter is a pointer to this structure, which is
modified: modified::
::
struct usbdevfs_getdriver { struct usbdevfs_getdriver {
unsigned int interface; unsigned int interface;
...@@ -490,9 +486,7 @@ USBDEVFS_GETDRIVER ...@@ -490,9 +486,7 @@ USBDEVFS_GETDRIVER
USBDEVFS_IOCTL USBDEVFS_IOCTL
Passes a request from userspace through to a kernel driver that has Passes a request from userspace through to a kernel driver that has
an ioctl entry in the *struct usb_driver* it registered. an ioctl entry in the *struct usb_driver* it registered::
::
struct usbdevfs_ioctl { struct usbdevfs_ioctl {
int ifno; int ifno;
...@@ -534,7 +528,7 @@ USBDEVFS_RELEASEINTERFACE ...@@ -534,7 +528,7 @@ USBDEVFS_RELEASEINTERFACE
the number of the interface (bInterfaceNumber from descriptor); File the number of the interface (bInterfaceNumber from descriptor); File
modification time is not updated by this request. modification time is not updated by this request.
**Warning** .. warning::
*No security check is made to ensure that the task which made *No security check is made to ensure that the task which made
the claim is the one which is releasing it. This means that user the claim is the one which is releasing it. This means that user
...@@ -574,9 +568,7 @@ a time. ...@@ -574,9 +568,7 @@ a time.
USBDEVFS_BULK USBDEVFS_BULK
Issues a bulk read or write request to the device. The ioctl Issues a bulk read or write request to the device. The ioctl
parameter is a pointer to this structure: parameter is a pointer to this structure::
::
struct usbdevfs_bulktransfer { struct usbdevfs_bulktransfer {
unsigned int ep; unsigned int ep;
...@@ -606,9 +598,7 @@ USBDEVFS_CLEAR_HALT ...@@ -606,9 +598,7 @@ USBDEVFS_CLEAR_HALT
USBDEVFS_CONTROL USBDEVFS_CONTROL
Issues a control request to the device. The ioctl parameter points Issues a control request to the device. The ioctl parameter points
to a structure like this: to a structure like this::
::
struct usbdevfs_ctrltransfer { struct usbdevfs_ctrltransfer {
__u8 bRequestType; __u8 bRequestType;
...@@ -638,7 +628,7 @@ USBDEVFS_RESET ...@@ -638,7 +628,7 @@ USBDEVFS_RESET
the reset, this rebinds all device interfaces. File modification the reset, this rebinds all device interfaces. File modification
time is not updated by this request. time is not updated by this request.
**Warning** .. warning::
*Avoid using this call* until some usbcore bugs get fixed, since *Avoid using this call* until some usbcore bugs get fixed, since
it does not fully synchronize device, interface, and driver (not it does not fully synchronize device, interface, and driver (not
...@@ -646,9 +636,7 @@ USBDEVFS_RESET ...@@ -646,9 +636,7 @@ USBDEVFS_RESET
USBDEVFS_SETINTERFACE USBDEVFS_SETINTERFACE
Sets the alternate setting for an interface. The ioctl parameter is Sets the alternate setting for an interface. The ioctl parameter is
a pointer to a structure like this: a pointer to a structure like this::
::
struct usbdevfs_setinterface { struct usbdevfs_setinterface {
unsigned int interface; unsigned int interface;
...@@ -669,7 +657,7 @@ USBDEVFS_SETCONFIGURATION ...@@ -669,7 +657,7 @@ USBDEVFS_SETCONFIGURATION
configuration (bConfigurationValue from descriptor). File configuration (bConfigurationValue from descriptor). File
modification time is not updated by this request. modification time is not updated by this request.
**Warning** .. warning::
*Avoid using this call* until some usbcore bugs get fixed, since *Avoid using this call* until some usbcore bugs get fixed, since
it does not fully synchronize device, interface, and driver (not it does not fully synchronize device, interface, and driver (not
...@@ -702,9 +690,7 @@ When usbfs returns these urbs, the status value is updated, and the ...@@ -702,9 +690,7 @@ When usbfs returns these urbs, the status value is updated, and the
buffer may have been modified. Except for isochronous transfers, the buffer may have been modified. Except for isochronous transfers, the
actual_length is updated to say how many bytes were transferred; if the actual_length is updated to say how many bytes were transferred; if the
USBDEVFS_URB_DISABLE_SPD flag is set ("short packets are not OK"), if USBDEVFS_URB_DISABLE_SPD flag is set ("short packets are not OK"), if
fewer bytes were read than were requested then you get an error report. fewer bytes were read than were requested then you get an error report::
::
struct usbdevfs_iso_packet_desc { struct usbdevfs_iso_packet_desc {
unsigned int length; unsigned int length;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment