/[gentoo]/xml/htdocs/doc/en/usb-guide.xml
Gentoo

Diff of /xml/htdocs/doc/en/usb-guide.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.15 Revision 1.23
1<?xml version='1.0' encoding="UTF-8"?> 1<?xml version='1.0' encoding="UTF-8"?>
2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/usb-guide.xml,v 1.15 2007/03/13 01:04:29 nightmorph Exp $ --> 2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/usb-guide.xml,v 1.23 2013/08/18 17:05:32 swift Exp $ -->
3
4<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> 3<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
5 4
6<guide link="/doc/en/usb-guide.xml"> 5<guide disclaimer="obsolete" redirect="https://wiki.gentoo.org/wiki/USB/HOWTO">
7<title>Gentoo Linux USB Guide</title> 6<title>Gentoo Linux USB Guide</title>
8 7
9<author title="Author"> 8<author title="Author">
10 <mail link="fox2mike@gentoo.org">Shyam Mani</mail> 9 <mail link="fox2mike@gentoo.org">Shyam Mani</mail>
11</author> 10</author>
17 16
18<!-- The content of this document is licensed under the CC-BY-SA license --> 17<!-- The content of this document is licensed under the CC-BY-SA license -->
19<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> 18<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
20<license/> 19<license/>
21 20
22<version>1.12</version> 21<version>2</version>
23<date>2007-03-12</date> 22<date>2011-12-26</date>
24 23
25<chapter> 24<chapter>
26<title>Introduction</title> 25<title>Introduction</title>
27<section> 26<section>
28<title>What is USB?</title> 27<title>What is USB?</title>
53<body> 52<body>
54 53
55<p> 54<p>
56Before we go onto the exact configuration options in the kernel, it would 55Before we go onto the exact configuration options in the kernel, it would
57be apt to look at USB in a little more detail. If you're in a hurry or want 56be apt to look at USB in a little more detail. If you're in a hurry or want
58to skip this section, please go to <uri link="#kernel">Kernel Configuration</uri>. 57to skip this section, please go to <uri link="#kernel">Kernel
58Configuration</uri>.
59</p> 59</p>
60 60
61<p> 61<p>
62A USB system has a host controller, hubs, a <e>root hub</e> amongst others 62A USB system has a host controller, hubs, a <e>root hub</e> amongst others
63and can support up to 127 USB devices including the hubs. The host controller 63and can support up to 127 USB devices including the hubs. The host controller
145<title>Kernel Configuration</title> 145<title>Kernel Configuration</title>
146<section> 146<section>
147<title>Getting the kernel</title> 147<title>Getting the kernel</title>
148<body> 148<body>
149 149
150<note>
151Since the 2005.0 release, Gentoo Linux uses 2.6 as the default kernel. Unless
152you are specifically using the 2.4 profile, <c>gentoo-sources</c> will be a
1532.6 kernel on <e>most</e> architectures. Please check your kernel version and
154then proceed with the configuration accordingly.
155</note>
156
157<p> 150<p>
158First emerge the kernel sources of your choice. Here we'll use the 151First emerge the kernel sources of your choice. Here we'll use the
159<c>gentoo-sources</c>. For more information on the various kernel sources 152<c>gentoo-sources</c>. For more information on the various kernel sources
160available on Portage, please look up the <uri 153available on Portage, please look up the <uri
161link="/doc/en/gentoo-kernel.xml">Gentoo Linux Kernel Guide</uri>. 154link="/doc/en/gentoo-kernel.xml">Gentoo Linux Kernel Guide</uri>.
179the kernel sources you want to use. Please ensure the same before proceeding. 172the kernel sources you want to use. Please ensure the same before proceeding.
180</note> 173</note>
181 174
182</body> 175</body>
183</section> 176</section>
184<section id="newkernelconfig"> 177<section>
185<title>Config options for the 2.6.x kernel</title> 178<title>Config options for the kernel</title>
186<body> 179<body>
187 180
188<p> 181<p>
189Now we will look at some of the options we will have to enable in the 2.6 182Now we will look at some of the options we will have to enable in the kernel to
190kernel to ensure proper USB support for our devices. If you are using a 2.4 183ensure proper USB support for our devices.
191kernel, please proceed with <uri link="#oldkernelconfig">Config options for the
1922.4.x kernel</uri>.
193</p> 184</p>
194 185
195<note> 186<note>
196Examples in this document will show configuration options for basic USB 187Examples in this document will show configuration options for basic USB
197support as well as those needed commonly, for example a USB mass storage 188support as well as those needed commonly, for example a USB mass storage
202have the options compiled into the kernel. If you would like to have a modular 193have the options compiled into the kernel. If you would like to have a modular
203kernel, ensure that you note down the various modules and adjust your config 194kernel, ensure that you note down the various modules and adjust your config
204files accordingly. 195files accordingly.
205</note> 196</note>
206 197
207<pre caption="make menuconfig options for 2.6 kernels"> 198<pre caption="make menuconfig options">
208Device Drivers ---&gt; 199Device Drivers ---&gt;
209 SCSI device support ---&gt; 200 SCSI device support ---&gt;
210 201
211<comment>(Although SCSI will be enabled automatically when selecting USB Mass Storage, 202<comment>(Although SCSI will be enabled automatically when selecting USB Mass Storage,
212we need to enable disk support.)</comment> 203we need to enable disk support.)</comment>
217USB support ---&gt; 208USB support ---&gt;
218 209
219<comment>(This is the root hub and is required for USB support. 210<comment>(This is the root hub and is required for USB support.
220If you'd like to compile this as a module, it will be called usbcore.)</comment> 211If you'd like to compile this as a module, it will be called usbcore.)</comment>
221&lt;*&gt; Support for Host-side USB 212&lt;*&gt; Support for Host-side USB
222
223<comment>(Enable this option to see your USB devices in /proc/bus/usb.
224This is recommended.)</comment>
225 [*] USB device filesystem
226 213
227<comment>(Select at least one of the HCDs. If you are unsure, picking all is fine.)</comment> 214<comment>(Select at least one of the HCDs. If you are unsure, picking all is fine.)</comment>
228--- USB Host Controller Drivers 215--- USB Host Controller Drivers
229&lt;*&gt; EHCI HCD (USB 2.0) support 216&lt;*&gt; EHCI HCD (USB 2.0) support
230&lt; &gt; OHCI HCD support 217&lt; &gt; OHCI HCD support
233<comment>(Moving a little further down, we come to CDC and mass storage.)</comment> 220<comment>(Moving a little further down, we come to CDC and mass storage.)</comment>
234&lt; &gt; USB Modem (CDC ACM) support 221&lt; &gt; USB Modem (CDC ACM) support
235&lt;*&gt; USB Printer support 222&lt;*&gt; USB Printer support
236&lt;*&gt; USB Mass Storage support 223&lt;*&gt; USB Mass Storage support
237 224
238<comment>(Then the HID bits.
239You have to select HID input support if you have a USB keyboard,
240mouse, joystick or any other USB input device)</comment>
241--- USB Input Devices
242&lt;*&gt; USB Human Interface Device (full HID) support
243 [*] HID input layer support
244
245<comment>(If you have a USB Network Card like the RTL8150, you'll need this)</comment> 225<comment>(If you have a USB Network Card like the RTL8150, you'll need this)</comment>
246USB Network Adapters ---> 226USB Network Adapters --->
247 &lt;*&gt; USB RTL8150 based ethernet device support (EXPERIMENTAL) 227 &lt;*&gt; USB RTL8150 based ethernet device support (EXPERIMENTAL)
248 228
249<comment>(If you have a serial to USB converter like the Prolific 2303, you'll need this)</comment> 229<comment>(If you have a serial to USB converter like the Prolific 2303, you'll need this)</comment>
251 &lt;*&gt; USB Serial Converter support 231 &lt;*&gt; USB Serial Converter support
252 &lt;*&gt; USB Prolific 2303 Single Port Serial Driver (NEW) 232 &lt;*&gt; USB Prolific 2303 Single Port Serial Driver (NEW)
253</pre> 233</pre>
254 234
255<p> 235<p>
236If you have a USB keyboard, mouse, joystick, or any other input device, you need
237to enable HID support. Go back one level to "Device drivers" and enable HID
238support as shown:
239</p>
240
241<pre caption="Enabling HID support">
242Device Drivers ---&gt;
243 [*] HID Devices ---&gt;
244 &lt;*&gt; USB Human Interface Device (full HID) support
245</pre>
246
247<p>
256Now that your options are set, you can (re)compile the kernel and USB support 248Now that your options are set, you can (re)compile the kernel and USB support
257should be functional once you reboot into the new kernel. You can now proceed 249should be functional once you reboot into the new kernel. You can now proceed
258to <uri link="#postkern">Seeing USB at work</uri> and see if everything is 250to <uri link="#postkern">Seeing USB at work</uri> and see if everything is
259working as it should. 251working as it should.
260</p>
261
262</body>
263</section>
264<section id="oldkernelconfig">
265<title>Config options for the 2.4.x kernel</title>
266<body>
267
268<p>
269We will look at the options the we will have to enable in the 2.4 kernel to
270ensure proper USB support for our devices. If you are using a 2.6 kernel,
271please look at <uri link="#newkernelconfig">Config options for the 2.6.x
272kernel</uri>.
273</p>
274
275<note>
276Examples in this document will show configuration options for basic USB
277support as well as those needed commonly, for example a USB mass storage
278device (most cameras and USB pen drives). If you have a specific USB device
279that needs to be configured, please look up your device's manual or search
280online to see if that device has support built-in into the kernel or custom
281drivers that you can use. Please note that for the sake of ease, all examples
282have the options compiled into the kernel. If you would like to have a modular
283kernel, ensure that you note down the various modules and adjust your config
284files accordingly.
285</note>
286
287<pre caption="make menuconfig options for 2.4 kernels">
288<comment>(This immediate config is only for those who have USB input devices.
289Input core support is needed by USB HID later.)</comment>
290Input core support ---&gt;
291 &lt;*&gt; Input core support
292 &lt; &gt; Keyboard support
293 &lt; &gt; Mouse support
294 &lt; &gt; Event interface support
295
296USB support ---&gt;
297
298<comment>(This is the root hub and is required for USB support.
299If you'd like to compile this as a module, it will be called usbcore.o)</comment>
300&lt;*&gt; Support for USB
301
302<comment>(Enable this option to see your USB devices in /proc/bus/usb.
303This is recommended.)</comment>
304 [*] Preliminary USB device filesystem
305
306<comment>(Select at least one of the HCDs. If you are unsure, picking all is fine.)</comment>
307--- USB Host Controller Drivers
308&lt;*&gt; UHCI Alternate Driver (JE) support
309&lt; &gt; OHCI (Compaq, iMacs, OPTi, SiS, ALi, ...) support
310
311<comment>(This is the device section. Select only what you need.)</comment>
312--- USB Device Class drivers
313&lt; &gt; USB Audio support
314&lt;*&gt; USB Mass Storage support
315&lt; &gt; USB Modem (CDC ACM) support
316&lt;*&gt; USB Printer support
317
318<comment>(Followed by the HID section. This is needed if you have an USB based input device.)</comment>
319--- USB Human Interface Devices (HID)
320&lt;*&gt; USB Human Interface Device (full HID) support
321 [*] HID input layer support
322
323<comment>(If you have a serial to USB converter like the Prolific 2303, you'll need this)</comment>
324USB Serial Converter support --->
325 &lt;*&gt; USB Serial Converter support
326 &lt;*&gt; USB Prolific 2303 Single Port Serial Driver (NEW)
327</pre>
328
329<p>
330Now that the options are set, you can (re)compile the kernel and USB support
331should be functional once you reboot into the new kernel.
332</p> 252</p>
333 253
334</body> 254</body>
335</section> 255</section>
336</chapter> 256</chapter>
373 293
374<comment>(Now the device information including model number is retrieved)</comment> 294<comment>(Now the device information including model number is retrieved)</comment>
375usb-storage: waiting for device to settle before scanning 295usb-storage: waiting for device to settle before scanning
376 Vendor: JetFlash Model: TS512MJF2A Rev: 1.00 296 Vendor: JetFlash Model: TS512MJF2A Rev: 1.00
377 Type: Direct-Access ANSI SCSI revision: 02 297 Type: Direct-Access ANSI SCSI revision: 02
378SCSI device sda: 1003600 512-byte hdwr sectors (514 MB) 298SCSI device sdb: 1003600 512-byte hdwr sectors (514 MB)
379 299
380<comment>(The write-protect sense is EXPERIMENTAL code in the later kernels)</comment> 300<comment>(The write-protect sense is EXPERIMENTAL code in the later kernels)</comment>
381sda: Write Protect is off 301sdb: Write Protect is off
382sda: Mode Sense: 0b 00 00 08 302sdb: Mode Sense: 0b 00 00 08
383sda: assuming drive cache: write through 303sdb: assuming drive cache: write through
384SCSI device sda: 1003600 512-byte hdwr sectors (514 MB) 304SCSI device sdb: 1003600 512-byte hdwr sectors (514 MB)
385/dev/scsi/host0/bus0/target0/lun0: p1 305/dev/scsi/host0/bus0/target0/lun0: p1
386Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0 306Attached scsi removable disk sdb at scsi0, channel 0, id 0, lun 0
387Attached scsi generic sg0 at scsi0, channel 0, id 0, lun 0, type 0 307Attached scsi generic sg0 at scsi0, channel 0, id 0, lun 0, type 0
388usb-storage: device scan complete 308usb-storage: device scan complete
389<comment>(At this point, the device is generally accessible by mounting /dev/sda1)</comment> 309<comment>(At this point, the device is generally accessible by mounting /dev/sdb1)</comment>
390 310
391<comment>(When the device is disconnected, the system acknowledges the same)</comment> 311<comment>(When the device is disconnected, the system acknowledges the same)</comment>
392usb 1-1: USB disconnect, address 2 312usb 1-1: USB disconnect, address 2
393</pre> 313</pre>
394 314
397disk. Usual operations like <c>cp</c>, <c>mv</c>, <c>rm</c>, etc work fine. You 317disk. Usual operations like <c>cp</c>, <c>mv</c>, <c>rm</c>, etc work fine. You
398could also create a filesystem on the USB stick/format it. 318could also create a filesystem on the USB stick/format it.
399</p> 319</p>
400 320
401<pre caption="Accessing the Memory Stick"> 321<pre caption="Accessing the Memory Stick">
402# <i>mount /dev/sda1 /mnt/usb</i> 322# <i>mount /dev/sdb1 /mnt/usb</i>
403# <i>df -h</i> 323# <i>df -h</i>
404Filesystem Size Used Avail Use% Mounted on 324Filesystem Size Used Avail Use% Mounted on
405/dev/hda8 9.4G 7.5G 1.9G 80% / 325/dev/sda8 9.4G 7.5G 1.9G 80% /
406/dev/hda9 11G 8.1G 2.4G 78% /usr 326/dev/sda9 11G 8.1G 2.4G 78% /usr
407none 189M 0 189M 0% /dev/shm 327none 189M 0 189M 0% /dev/shm
408/dev/sda1 490M 34M 457M 7% /mnt/usb 328/dev/sdb1 490M 34M 457M 7% /mnt/usb
409</pre> 329</pre>
410 330
411<note> 331<note>
412Digital cameras can be accessed the same way as memory sticks. I have a Nikon 332Digital cameras can be accessed the same way as memory sticks. I have a Nikon
413Coolpix 5200 and this is the way I access it. Cameras these days usually have 333Coolpix 5200 and this is the way I access it. Cameras these days usually have
510which helps debugging as well as understanding how USB works. 430which helps debugging as well as understanding how USB works.
511</p> 431</p>
512 432
513</body> 433</body>
514</section> 434</section>
515<section>
516<title>Hotplug</title>
517<body>
518
519<p>
520Gentoo uses <c>sys-apps/hotplug</c> to do some magic with <e>hot-pluggable</e>
521devices. Just like any other magic trick, there is a simple logic behind this
522one too. We shall now see what that is, and in the process hopefully we will be
523able to understand it better.
524</p>
525
526<p>
527Firmware can be defined as the software on a piece of hardware that is loaded
528and executed but can't be modified easily. Many devices have firmware in them
529to ensure that they work properly and often firmware may contain code that is
530critical to ensure that the hardware performs as expected. Firmware is present
531in a wide variety of computer devices ranging from ROM chips to state of the
532art USB and PCMCIA cards. When a device is plugged in, the firmware (which may,
533in some cases, be the driver as well) is read and loaded onto memory after
534which the device can be used by the system.
535</p>
536
537<p>
538To cut the long story short, Gentoo uses <c>sys-apps/hotplug</c> to handle
539the firmware side of things in <e>hot-pluggable</e> devices.
540<c>sys-apps/hotplug</c> will use the required firmware to make that device
541usable. The firmware should be put in the <path>/lib/firmware</path> directory
542and is picked up from there. Getting it is simple; the usual emerge will do.
543</p>
544
545<pre caption="Installing hotplug">
546# <i>emerge hotplug</i>
547</pre>
548
549</body>
550</section>
551</chapter> 435</chapter>
552 436
553<chapter> 437<chapter>
554<title>And thanks to...</title> 438<title>And thanks to...</title>
555<section> 439<section>
556<title>References</title> 440<title>References</title>
557<body> 441<body>
558 442
559<p> 443<p>
560A good number of online documents helped me during the development of this 444A good number of online documents helped me during the development of this
561document and there are some that are highly technical but truly interesting. 445document and there are some that are highly technical but truly interesting.
562I thought they all deserve some credit, so here we go! 446I thought they all deserve some credit, so here we go!
563</p> 447</p>
564 448
565<ul> 449<ul>
566 <li><uri link="http://www.usb.org">The Official USB Website</uri></li> 450 <li><uri link="http://www.usb.org">The Official USB Website</uri></li>
585<section> 469<section>
586<title>Other Interesting Links</title> 470<title>Other Interesting Links</title>
587<body> 471<body>
588 472
589<ul> 473<ul>
590 <li><uri link="/doc/en/liveusb.xml">Gentoo Linux LiveUSB HOWTO</uri></li> 474 <li><uri link="https://wiki.gentoo.org/wiki/LiveUSB/HOWTO">Gentoo Linux LiveUSB HOWTO</uri></li>
591</ul> 475</ul>
592 476
593</body> 477</body>
594</section> 478</section>
595</chapter> 479</chapter>

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.23

  ViewVC Help
Powered by ViewVC 1.1.20