diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-25 15:40:57 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-25 15:40:57 -0400 |
commit | 37b05b17985ecc43a33e2a8cbdaa220115de4703 (patch) | |
tree | 8213bf790182711677018ed322a9ccf61470242e /Documentation | |
parent | ce1d5b23a8d1e19866ab82bdec0dc41fde5273d8 (diff) | |
parent | 4953d141dc5db748475001cfbfdcc42e66cf900e (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (120 commits)
usb: don't update devnum for wusb devices
wusb: make ep0_reinit available for modules
wusb: devices dont use a set address
wusb: teach choose_address() about wireless devices
wusb: add link wusb-usb device
wusb: add authenticathed bit to usb_dev
USB: remove unnecessary type casting of urb->context
usb serial: more fixes and groundwork for tty changes
USB: replace remaining __FUNCTION__ occurrences
USB: usbfs: export the URB_NO_INTERRUPT flag to userspace
USB: fix compile problems in ehci-hcd
USB: ehci: qh_completions cleanup and bugfix
USB: cdc-acm: signedness fix
USB: add documentation about callbacks
USB: don't explicitly reenable root-hub status interrupts
USB: OHCI: turn off RD when remote wakeup is disabled
USB: HCDs use the do_remote_wakeup flag
USB: g_file_storage: ignore bulk-out data after invalid CBW
USB: serial: remove endpoints setting checks from core and header
USB: serial: remove unneeded number endpoints settings
...
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/usb/anchors.txt | 50 | ||||
-rw-r--r-- | Documentation/usb/callbacks.txt | 132 | ||||
-rw-r--r-- | Documentation/usb/persist.txt | 43 | ||||
-rw-r--r-- | Documentation/usb/usb-serial.txt | 7 |
4 files changed, 207 insertions, 25 deletions
diff --git a/Documentation/usb/anchors.txt b/Documentation/usb/anchors.txt new file mode 100644 index 000000000000..7304bcf5a306 --- /dev/null +++ b/Documentation/usb/anchors.txt | |||
@@ -0,0 +1,50 @@ | |||
1 | What is anchor? | ||
2 | =============== | ||
3 | |||
4 | A USB driver needs to support some callbacks requiring | ||
5 | a driver to cease all IO to an interface. To do so, a | ||
6 | driver has to keep track of the URBs it has submitted | ||
7 | to know they've all completed or to call usb_kill_urb | ||
8 | for them. The anchor is a data structure takes care of | ||
9 | keeping track of URBs and provides methods to deal with | ||
10 | multiple URBs. | ||
11 | |||
12 | Allocation and Initialisation | ||
13 | ============================= | ||
14 | |||
15 | There's no API to allocate an anchor. It is simply declared | ||
16 | as struct usb_anchor. init_usb_anchor() must be called to | ||
17 | initialise the data structure. | ||
18 | |||
19 | Deallocation | ||
20 | ============ | ||
21 | |||
22 | Once it has no more URBs associated with it, the anchor can be | ||
23 | freed with normal memory management operations. | ||
24 | |||
25 | Association and disassociation of URBs with anchors | ||
26 | =================================================== | ||
27 | |||
28 | An association of URBs to an anchor is made by an explicit | ||
29 | call to usb_anchor_urb(). The association is maintained until | ||
30 | an URB is finished by (successfull) completion. Thus disassociation | ||
31 | is automatic. A function is provided to forcibly finish (kill) | ||
32 | all URBs associated with an anchor. | ||
33 | Furthermore, disassociation can be made with usb_unanchor_urb() | ||
34 | |||
35 | Operations on multitudes of URBs | ||
36 | ================================ | ||
37 | |||
38 | usb_kill_anchored_urbs() | ||
39 | ------------------------ | ||
40 | |||
41 | This function kills all URBs associated with an anchor. The URBs | ||
42 | are called in the reverse temporal order they were submitted. | ||
43 | This way no data can be reordered. | ||
44 | |||
45 | usb_wait_anchor_empty_timeout() | ||
46 | ------------------------------- | ||
47 | |||
48 | This function waits for all URBs associated with an anchor to finish | ||
49 | or a timeout, whichever comes first. Its return value will tell you | ||
50 | whether the timeout was reached. | ||
diff --git a/Documentation/usb/callbacks.txt b/Documentation/usb/callbacks.txt new file mode 100644 index 000000000000..7c812411945b --- /dev/null +++ b/Documentation/usb/callbacks.txt | |||
@@ -0,0 +1,132 @@ | |||
1 | What callbacks will usbcore do? | ||
2 | =============================== | ||
3 | |||
4 | Usbcore will call into a driver through callbacks defined in the driver | ||
5 | structure and through the completion handler of URBs a driver submits. | ||
6 | Only the former are in the scope of this document. These two kinds of | ||
7 | callbacks are completely independent of each other. Information on the | ||
8 | completion callback can be found in Documentation/usb/URB.txt. | ||
9 | |||
10 | The callbacks defined in the driver structure are: | ||
11 | |||
12 | 1. Hotplugging callbacks: | ||
13 | |||
14 | * @probe: Called to see if the driver is willing to manage a particular | ||
15 | * interface on a device. | ||
16 | * @disconnect: Called when the interface is no longer accessible, usually | ||
17 | * because its device has been (or is being) disconnected or the | ||
18 | * driver module is being unloaded. | ||
19 | |||
20 | 2. Odd backdoor through usbfs: | ||
21 | |||
22 | * @ioctl: Used for drivers that want to talk to userspace through | ||
23 | * the "usbfs" filesystem. This lets devices provide ways to | ||
24 | * expose information to user space regardless of where they | ||
25 | * do (or don't) show up otherwise in the filesystem. | ||
26 | |||
27 | 3. Power management (PM) callbacks: | ||
28 | |||
29 | * @suspend: Called when the device is going to be suspended. | ||
30 | * @resume: Called when the device is being resumed. | ||
31 | * @reset_resume: Called when the suspended device has been reset instead | ||
32 | * of being resumed. | ||
33 | |||
34 | 4. Device level operations: | ||
35 | |||
36 | * @pre_reset: Called when the device is about to be reset. | ||
37 | * @post_reset: Called after the device has been reset | ||
38 | |||
39 | The ioctl interface (2) should be used only if you have a very good | ||
40 | reason. Sysfs is preferred these days. The PM callbacks are covered | ||
41 | separately in Documentation/usb/power-management.txt. | ||
42 | |||
43 | Calling conventions | ||
44 | =================== | ||
45 | |||
46 | All callbacks are mutually exclusive. There's no need for locking | ||
47 | against other USB callbacks. All callbacks are called from a task | ||
48 | context. You may sleep. However, it is important that all sleeps have a | ||
49 | small fixed upper limit in time. In particular you must not call out to | ||
50 | user space and await results. | ||
51 | |||
52 | Hotplugging callbacks | ||
53 | ===================== | ||
54 | |||
55 | These callbacks are intended to associate and disassociate a driver with | ||
56 | an interface. A driver's bond to an interface is exclusive. | ||
57 | |||
58 | The probe() callback | ||
59 | -------------------- | ||
60 | |||
61 | int (*probe) (struct usb_interface *intf, | ||
62 | const struct usb_device_id *id); | ||
63 | |||
64 | Accept or decline an interface. If you accept the device return 0, | ||
65 | otherwise -ENODEV or -ENXIO. Other error codes should be used only if a | ||
66 | genuine error occurred during initialisation which prevented a driver | ||
67 | from accepting a device that would else have been accepted. | ||
68 | You are strongly encouraged to use usbcore'sfacility, | ||
69 | usb_set_intfdata(), to associate a data structure with an interface, so | ||
70 | that you know which internal state and identity you associate with a | ||
71 | particular interface. The device will not be suspended and you may do IO | ||
72 | to the interface you are called for and endpoint 0 of the device. Device | ||
73 | initialisation that doesn't take too long is a good idea here. | ||
74 | |||
75 | The disconnect() callback | ||
76 | ------------------------- | ||
77 | |||
78 | void (*disconnect) (struct usb_interface *intf); | ||
79 | |||
80 | This callback is a signal to break any connection with an interface. | ||
81 | You are not allowed any IO to a device after returning from this | ||
82 | callback. You also may not do any other operation that may interfere | ||
83 | with another driver bound the interface, eg. a power management | ||
84 | operation. | ||
85 | If you are called due to a physical disconnection, all your URBs will be | ||
86 | killed by usbcore. Note that in this case disconnect will be called some | ||
87 | time after the physical disconnection. Thus your driver must be prepared | ||
88 | to deal with failing IO even prior to the callback. | ||
89 | |||
90 | Device level callbacks | ||
91 | ====================== | ||
92 | |||
93 | pre_reset | ||
94 | --------- | ||
95 | |||
96 | int (*pre_reset)(struct usb_interface *intf); | ||
97 | |||
98 | Another driver or user space is triggering a reset on the device which | ||
99 | contains the interface passed as an argument. Cease IO and save any | ||
100 | device state you need to restore. | ||
101 | |||
102 | If you need to allocate memory here, use GFP_NOIO or GFP_ATOMIC, if you | ||
103 | are in atomic context. | ||
104 | |||
105 | post_reset | ||
106 | ---------- | ||
107 | |||
108 | int (*post_reset)(struct usb_interface *intf); | ||
109 | |||
110 | The reset has completed. Restore any saved device state and begin | ||
111 | using the device again. | ||
112 | |||
113 | If you need to allocate memory here, use GFP_NOIO or GFP_ATOMIC, if you | ||
114 | are in atomic context. | ||
115 | |||
116 | Call sequences | ||
117 | ============== | ||
118 | |||
119 | No callbacks other than probe will be invoked for an interface | ||
120 | that isn't bound to your driver. | ||
121 | |||
122 | Probe will never be called for an interface bound to a driver. | ||
123 | Hence following a successful probe, disconnect will be called | ||
124 | before there is another probe for the same interface. | ||
125 | |||
126 | Once your driver is bound to an interface, disconnect can be | ||
127 | called at any time except in between pre_reset and post_reset. | ||
128 | pre_reset is always followed by post_reset, even if the reset | ||
129 | failed or the device has been unplugged. | ||
130 | |||
131 | suspend is always followed by one of: resume, reset_resume, or | ||
132 | disconnect. | ||
diff --git a/Documentation/usb/persist.txt b/Documentation/usb/persist.txt index df54d645cbb5..d56cb1a11550 100644 --- a/Documentation/usb/persist.txt +++ b/Documentation/usb/persist.txt | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | Alan Stern <stern@rowland.harvard.edu> | 3 | Alan Stern <stern@rowland.harvard.edu> |
4 | 4 | ||
5 | September 2, 2006 (Updated May 29, 2007) | 5 | September 2, 2006 (Updated February 25, 2008) |
6 | 6 | ||
7 | 7 | ||
8 | What is the problem? | 8 | What is the problem? |
@@ -65,9 +65,10 @@ much better.) | |||
65 | 65 | ||
66 | What is the solution? | 66 | What is the solution? |
67 | 67 | ||
68 | Setting CONFIG_USB_PERSIST will cause the kernel to work around these | 68 | The kernel includes a feature called USB-persist. It tries to work |
69 | issues. It enables a mode in which the core USB device data | 69 | around these issues by allowing the core USB device data structures to |
70 | structures are allowed to persist across a power-session disruption. | 70 | persist across a power-session disruption. |
71 | |||
71 | It works like this. If the kernel sees that a USB host controller is | 72 | It works like this. If the kernel sees that a USB host controller is |
72 | not in the expected state during resume (i.e., if the controller was | 73 | not in the expected state during resume (i.e., if the controller was |
73 | reset or otherwise had lost power) then it applies a persistence check | 74 | reset or otherwise had lost power) then it applies a persistence check |
@@ -80,28 +81,30 @@ re-enumeration shows that the device now attached to that port has the | |||
80 | same descriptors as before, including the Vendor and Product IDs, then | 81 | same descriptors as before, including the Vendor and Product IDs, then |
81 | the kernel continues to use the same device structure. In effect, the | 82 | the kernel continues to use the same device structure. In effect, the |
82 | kernel treats the device as though it had merely been reset instead of | 83 | kernel treats the device as though it had merely been reset instead of |
83 | unplugged. | 84 | unplugged. The same thing happens if the host controller is in the |
85 | expected state but a USB device was unplugged and then replugged. | ||
84 | 86 | ||
85 | If no device is now attached to the port, or if the descriptors are | 87 | If no device is now attached to the port, or if the descriptors are |
86 | different from what the kernel remembers, then the treatment is what | 88 | different from what the kernel remembers, then the treatment is what |
87 | you would expect. The kernel destroys the old device structure and | 89 | you would expect. The kernel destroys the old device structure and |
88 | behaves as though the old device had been unplugged and a new device | 90 | behaves as though the old device had been unplugged and a new device |
89 | plugged in, just as it would without the CONFIG_USB_PERSIST option. | 91 | plugged in. |
90 | 92 | ||
91 | The end result is that the USB device remains available and usable. | 93 | The end result is that the USB device remains available and usable. |
92 | Filesystem mounts and memory mappings are unaffected, and the world is | 94 | Filesystem mounts and memory mappings are unaffected, and the world is |
93 | now a good and happy place. | 95 | now a good and happy place. |
94 | 96 | ||
95 | Note that even when CONFIG_USB_PERSIST is set, the "persist" feature | 97 | Note that the "USB-persist" feature will be applied only to those |
96 | will be applied only to those devices for which it is enabled. You | 98 | devices for which it is enabled. You can enable the feature by doing |
97 | can enable the feature by doing (as root): | 99 | (as root): |
98 | 100 | ||
99 | echo 1 >/sys/bus/usb/devices/.../power/persist | 101 | echo 1 >/sys/bus/usb/devices/.../power/persist |
100 | 102 | ||
101 | where the "..." should be filled in the with the device's ID. Disable | 103 | where the "..." should be filled in the with the device's ID. Disable |
102 | the feature by writing 0 instead of 1. For hubs the feature is | 104 | the feature by writing 0 instead of 1. For hubs the feature is |
103 | automatically and permanently enabled, so you only have to worry about | 105 | automatically and permanently enabled and the power/persist file |
104 | setting it for devices where it really matters. | 106 | doesn't even exist, so you only have to worry about setting it for |
107 | devices where it really matters. | ||
105 | 108 | ||
106 | 109 | ||
107 | Is this the best solution? | 110 | Is this the best solution? |
@@ -112,19 +115,19 @@ centralized Logical Volume Manager. Such a solution would allow you | |||
112 | to plug in a USB flash device, create a persistent volume associated | 115 | to plug in a USB flash device, create a persistent volume associated |
113 | with it, unplug the flash device, plug it back in later, and still | 116 | with it, unplug the flash device, plug it back in later, and still |
114 | have the same persistent volume associated with the device. As such | 117 | have the same persistent volume associated with the device. As such |
115 | it would be more far-reaching than CONFIG_USB_PERSIST. | 118 | it would be more far-reaching than USB-persist. |
116 | 119 | ||
117 | On the other hand, writing a persistent volume manager would be a big | 120 | On the other hand, writing a persistent volume manager would be a big |
118 | job and using it would require significant input from the user. This | 121 | job and using it would require significant input from the user. This |
119 | solution is much quicker and easier -- and it exists now, a giant | 122 | solution is much quicker and easier -- and it exists now, a giant |
120 | point in its favor! | 123 | point in its favor! |
121 | 124 | ||
122 | Furthermore, the USB_PERSIST option applies to _all_ USB devices, not | 125 | Furthermore, the USB-persist feature applies to _all_ USB devices, not |
123 | just mass-storage devices. It might turn out to be equally useful for | 126 | just mass-storage devices. It might turn out to be equally useful for |
124 | other device types, such as network interfaces. | 127 | other device types, such as network interfaces. |
125 | 128 | ||
126 | 129 | ||
127 | WARNING: Using CONFIG_USB_PERSIST can be dangerous!! | 130 | WARNING: USB-persist can be dangerous!! |
128 | 131 | ||
129 | When recovering an interrupted power session the kernel does its best | 132 | When recovering an interrupted power session the kernel does its best |
130 | to make sure the USB device hasn't been changed; that is, the same | 133 | to make sure the USB device hasn't been changed; that is, the same |
@@ -133,10 +136,10 @@ aren't guaranteed to be 100% accurate. | |||
133 | 136 | ||
134 | If you replace one USB device with another of the same type (same | 137 | If you replace one USB device with another of the same type (same |
135 | manufacturer, same IDs, and so on) there's an excellent chance the | 138 | manufacturer, same IDs, and so on) there's an excellent chance the |
136 | kernel won't detect the change. Serial numbers and other strings are | 139 | kernel won't detect the change. The serial number string and other |
137 | not compared. In many cases it wouldn't help if they were, because | 140 | descriptors are compared with the kernel's stored values, but this |
138 | manufacturers frequently omit serial numbers entirely in their | 141 | might not help since manufacturers frequently omit serial numbers |
139 | devices. | 142 | entirely in their devices. |
140 | 143 | ||
141 | Furthermore it's quite possible to leave a USB device exactly the same | 144 | Furthermore it's quite possible to leave a USB device exactly the same |
142 | while changing its media. If you replace the flash memory card in a | 145 | while changing its media. If you replace the flash memory card in a |
@@ -152,5 +155,5 @@ but yourself. | |||
152 | YOU HAVE BEEN WARNED! USE AT YOUR OWN RISK! | 155 | YOU HAVE BEEN WARNED! USE AT YOUR OWN RISK! |
153 | 156 | ||
154 | That having been said, most of the time there shouldn't be any trouble | 157 | That having been said, most of the time there shouldn't be any trouble |
155 | at all. The "persist" feature can be extremely useful. Make the most | 158 | at all. The USB-persist feature can be extremely useful. Make the |
156 | of it. | 159 | most of it. |
diff --git a/Documentation/usb/usb-serial.txt b/Documentation/usb/usb-serial.txt index 8b077e43eee7..ff2c1ff57ba2 100644 --- a/Documentation/usb/usb-serial.txt +++ b/Documentation/usb/usb-serial.txt | |||
@@ -192,12 +192,9 @@ Keyspan USA-series Serial Adapters | |||
192 | 192 | ||
193 | FTDI Single Port Serial Driver | 193 | FTDI Single Port Serial Driver |
194 | 194 | ||
195 | This is a single port DB-25 serial adapter. More information about this | 195 | This is a single port DB-25 serial adapter. |
196 | device and the Linux driver can be found at: | ||
197 | http://reality.sgi.com/bryder_wellington/ftdi_sio/ | ||
198 | 196 | ||
199 | For any questions or problems with this driver, please contact Bill Ryder | 197 | For any questions or problems with this driver, please contact Bill Ryder. |
200 | at bryder@sgi.com | ||
201 | 198 | ||
202 | 199 | ||
203 | ZyXEL omni.net lcd plus ISDN TA | 200 | ZyXEL omni.net lcd plus ISDN TA |