/[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.5 Revision 1.18
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.5 2005/06/17 10:51:16 fox2mike Exp $ --> 2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/usb-guide.xml,v 1.18 2008/06/22 01:13:02 nightmorph 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 link="/doc/en/usb-guide.xml">
7<title>Gentoo Linux USB Guide</title> 6<title>Gentoo Linux USB Guide</title>
8 7
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.4</version> 21<version>1.14</version>
23<date>2005-06-17</date> 22<date>2008-06-21</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>.
162</p> 155</p>
163 156
164<pre caption="Getting the kernel sources"> 157<pre caption="Getting the kernel sources">
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="2.6.xconfig"> 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="#2.4.xconfig">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>
232 223
233<comment>(Moving a little further down, we come to CDC and mass storage.)</comment> 224<comment>(Moving a little further down, we come to CDC and mass storage.)</comment>
234&lt; &gt; USB Modem (CDC ACM) support 225&lt; &gt; USB Modem (CDC ACM) support
235&lt;*&gt; USB Printer support 226&lt;*&gt; USB Printer support
236&lt;*&gt; USB Mass Storage support 227&lt;*&gt; USB Mass Storage support
237 [*] USB Mass Storage Write-Protected Media Detection (EXPERIMENTAL)
238
239<comment>(Then the HID bits.
240You have to select HID input support if you have a USB keyboard,
241mouse, joystick or any other USB input device)</comment>
242--- USB Input Devices
243&lt;*&gt; USB Human Interface Device (full HID) support
244 [*] HID input layer support
245 228
246<comment>(If you have a USB Network Card like the RTL8150, you'll need this)</comment> 229<comment>(If you have a USB Network Card like the RTL8150, you'll need this)</comment>
247USB Network Adapters ---> 230USB Network Adapters --->
248 &lt;*&gt; USB RTL8150 based ethernet device support (EXPERIMENTAL) 231 &lt;*&gt; USB RTL8150 based ethernet device support (EXPERIMENTAL)
249 232
252 &lt;*&gt; USB Serial Converter support 235 &lt;*&gt; USB Serial Converter support
253 &lt;*&gt; USB Prolific 2303 Single Port Serial Driver (NEW) 236 &lt;*&gt; USB Prolific 2303 Single Port Serial Driver (NEW)
254</pre> 237</pre>
255 238
256<p> 239<p>
240If you have a USB keyboard, mouse, joystick, or any other input device, you need
241to enable HID support. Go back one level to "Device drivers" and enable HID
242support as shown:
243</p>
244
245<pre caption="Enabling HID support">
246Device Drivers ---&gt;
247 [*] HID Devices ---&gt;
248 &lt;*&gt; USB Human Interface Device (full HID) support
249</pre>
250
251<p>
257Now that your options are set, you can (re)compile the kernel and USB support 252Now that your options are set, you can (re)compile the kernel and USB support
258should be functional once you reboot into the new kernel. You can now proceed 253should be functional once you reboot into the new kernel. You can now proceed
259to <uri link="#postkern">Seeing USB at work</uri> and see if everything is 254to <uri link="#postkern">Seeing USB at work</uri> and see if everything is
260working as it should. 255working as it should.
261</p>
262
263</body>
264</section>
265<section id="2.4.xconfig">
266<title>Config options for the 2.4.x kernel</title>
267<body>
268
269<p>
270We will look at the options the we will have to enable in the 2.4 kernel to
271ensure proper USB support for our devices. If you are using a 2.6 kernel,
272please look at <uri link="#2.6.xconfig">Config options for the 2.6.x
273kernel</uri>.
274</p>
275
276<note>
277Examples in this document will show configuration options for basic USB
278support as well as those needed commonly, for example a USB mass storage
279device (most cameras and USB pen drives). If you have a specific USB device
280that needs to be configured, please look up your device's manual or search
281online to see if that device has support built-in into the kernel or custom
282drivers that you can use. Please note that for the sake of ease, all examples
283have the options compiled into the kernel. If you would like to have a modular
284kernel, ensure that you note down the various modules and adjust your config
285files accordingly.
286</note>
287
288<pre caption="make menuconfig options for 2.4 kernels">
289<comment>(This immediate config is only for those who have USB input devices.
290Input core support is needed by USB HID later.)</comment>
291Input core support ---&gt;
292 &lt;*&gt; Input core support
293 &lt; &gt; Keyboard support
294 &lt; &gt; Mouse support
295 &lt; &gt; Event interface support
296
297USB support ---&gt;
298
299<comment>(This is the root hub and is required for USB support.
300If you'd like to compile this as a module, it will be called usbcore.o)</comment>
301&lt;*&gt; Support for USB
302
303<comment>(Enable this option to see your USB devices in /proc/bus/usb.
304This is recommended.)</comment>
305 [*] Preliminary USB device filesystem
306
307<comment>(Select at least one of the HCDs. If you are unsure, picking all is fine.)</comment>
308--- USB Host Controller Drivers
309&lt;*&gt; UHCI Alternate Driver (JE) support
310&lt; &gt; OHCI (Compaq, iMacs, OPTi, SiS, ALi, ...) support
311
312<comment>(This is the device section. Select only what you need.)</comment>
313--- USB Device Class drivers
314&lt; &gt; USB Audio support
315&lt;*&gt; USB Mass Storage support
316&lt; &gt; USB Modem (CDC ACM) support
317&lt;*&gt; USB Printer support
318
319<comment>(Followed by the HID section. This is needed if you have an USB based input device.)</comment>
320--- USB Human Interface Devices (HID)
321&lt;*&gt; USB Human Interface Device (full HID) support
322 [*] HID input layer support
323
324<comment>(If you have a serial to USB converter like the Prolific 2303, you'll need this)</comment>
325USB Serial Converter support --->
326 &lt;*&gt; USB Serial Converter support
327 &lt;*&gt; USB Prolific 2303 Single Port Serial Driver (NEW)
328</pre>
329
330<p>
331Now that the options are set, you can (re)compile the kernel and USB support
332should be functional once you reboot into the new kernel.
333</p> 256</p>
334 257
335</body> 258</body>
336</section> 259</section>
337</chapter> 260</chapter>
393usb 1-1: USB disconnect, address 2 316usb 1-1: USB disconnect, address 2
394</pre> 317</pre>
395 318
396<p> 319<p>
397Once the device is connected and mounted, you can access it like a normal hard 320Once the device is connected and mounted, you can access it like a normal hard
398disk. Usual operations like <c>cp</c>, <c>mv</c>, <c>rm</c> etc work fine. You 321disk. Usual operations like <c>cp</c>, <c>mv</c>, <c>rm</c>, etc work fine. You
399could also create a filesystem on the USB stick/format it. 322could also create a filesystem on the USB stick/format it.
400</p> 323</p>
401 324
402<pre caption="Accessing the Memory Stick"> 325<pre caption="Accessing the Memory Stick">
403# <i>mount /dev/sda1 /mnt/usb</i> 326# <i>mount /dev/sda1 /mnt/usb</i>
409/dev/sda1 490M 34M 457M 7% /mnt/usb 332/dev/sda1 490M 34M 457M 7% /mnt/usb
410</pre> 333</pre>
411 334
412<note> 335<note>
413Digital cameras can be accessed the same way as memory sticks. I have a Nikon 336Digital cameras can be accessed the same way as memory sticks. I have a Nikon
414Coolpix 5200 and this is the way I access it. The camera is set to behave like 337Coolpix 5200 and this is the way I access it. Cameras these days usually have
415a USB mass storage device (as against PTP mode, which most cameras have these 338two modes to transfer pictures; USB mass storage and PTP (Picture Transfer
416days) and the procedure is exactly the same, because of which I have not 339Protocol). The camera is set to USB mass storage mode and hence the procedure is
340exactly the same as that of accessing a memory stick because of which I have not
417explained in detail about the same. Please note that this may NOT work in all 341explained in detail about it. Please note that this may NOT work in all cases
418cases and with all digital cameras that have USB support. 342and with all digital cameras that have USB support.
419</note> 343</note>
420 344
421<p> 345<p>
422How would a USB mouse show up in case you had one? It will show up as an HID 346How would a USB mouse show up in case you had one? It will show up as an HID
423device. 347device.
510which helps debugging as well as understanding how USB works. 434which helps debugging as well as understanding how USB works.
511</p> 435</p>
512 436
513</body> 437</body>
514</section> 438</section>
515<section>
516<title>Hot or Cold plug??</title>
517<body>
518
519<p>
520Gentoo uses two packages, <c>sys-apps/hotplug</c> and <c>sys-apps/coldplug</c>
521to do some magic with <e>hot-pluggable</e> devices. Just like any other magic
522trick, there is a simple logic behind this one too. We shall now see what that
523is, and in the process hopefully we will be able to understand these twins
524better.
525</p>
526
527<p>
528Firmware can be defined as the software on a piece of hardware that is loaded
529and executed but can't be modified easily. Many devices have firmware in them
530to ensure that they work properly and often firmware may contain code that is
531critical to ensure that the hardware performs as expected. Firmware is present
532in a wide variety of computer devices ranging from ROM chips to state of the
533art USB and PCMCIA cards. When a device is plugged in, the firmware (which may
534in some cases be the driver as well) is read and loaded onto memory after
535which the device can be used by the system.
536</p>
537
538<p>
539To cut the long story short, Gentoo uses <c>sys-apps/hotplug</c> to handle
540the firmware side of things in <e>hot-pluggable</e> devices.
541<c>sys-apps/hotplug</c> will use the required firmware to make that device
542usable. The firmware should be put in the <path>/lib/firmware</path> directory
543and is picked up from there. Getting it is simple, the usual emerge will do.
544</p>
545
546<pre caption="Installing hotplug">
547# <i>emerge hotplug</i>
548</pre>
549
550<p>
551Now the obvious question would be, what is coldplug and why is it needed?
552<c>sys-apps/coldplug</c> does what hotplug does, but it does it for
553<e>hot-pluggable</e> devices that are already connected at boot time. A good
554example of this would be a USB Network card. Earlier hotplug was the package
555responsible for handling both but then it was split into hotplug and coldplug,
556each with their distinct purposes. Emerge it if you have <e>hot-pluggable</e>
557devices that you need activated on boot up.
558</p>
559
560<pre caption="Installing coldplug">
561# <i>emerge coldplug</i>
562<comment>(And you can add it to the boot runlevel)</comment>
563# <i>rc-update add coldplug boot</i>
564 * coldplug added to runlevel boot
565 * rc-update complete.
566</pre>
567
568<note>
569The above initscript does what hotplug's initscript used to do (for already
570attached hot-pluggable devices). hotplug does not have an initscript of its
571own as of now.
572</note>
573
574</body>
575</section>
576</chapter> 439</chapter>
577 440
578<chapter> 441<chapter>
579<title>And thanks to...</title> 442<title>And thanks to...</title>
580<section> 443<section>
581<title>References</title> 444<title>References</title>
582<body> 445<body>
583 446
584<p> 447<p>
585A good number of documents online helped me during writing this, and there are 448A good number of online documents helped me during the development of this
586some that are that are highly technical but truly interesting. I thought they 449document and there are some that are highly technical but truly interesting.
587all deserve some credit. So here we go! 450I thought they all deserve some credit, so here we go!
588</p> 451</p>
589 452
590<ul> 453<ul>
591 <li><uri link="http://www.usb.org">The Official USB Website</uri></li> 454 <li><uri link="http://www.usb.org">The Official USB Website</uri></li>
592 <li><uri link="http://www.usb.org/faq">The USB FAQ</uri></li> 455 <li><uri link="http://www.usb.org/about/faq">The USB FAQ</uri></li>
593 <li> 456 <li>
594 <uri 457 <uri
595 link="http://h18000.www1.hp.com/productinfo/development/openhci.html">Compaq's 458 link="http://h18000.www1.hp.com/productinfo/development/openhci.html">Compaq's
596 OHCI Standard</uri> 459 OHCI Standard</uri>
597 </li> 460 </li>
605 </li> 468 </li>
606</ul> 469</ul>
607 470
608</body> 471</body>
609</section> 472</section>
473<section>
474<title>Other Interesting Links</title>
475<body>
476
477<ul>
478 <li><uri link="/doc/en/liveusb.xml">Gentoo Linux LiveUSB HOWTO</uri></li>
479</ul>
480
481</body>
482</section>
610</chapter> 483</chapter>
611</guide> 484</guide>

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.20