Previous Page
Next Page

3.6. Objective 7: Configure USB Devices

Universal Serial Bus (USB) is a type of interface used to connect various types of peripherals, ranging from keyboards and mice, to hard drives, scanners, digital cameras, and printers. The USB Objective covers the general architecture of USB, USB modules, and configuring USB devices .

3.6.1. USB Topology

USB devices are attached to a host in a tree through some number of hub devices. The lsusb command can be used to see how devices are physically attached to a Linux system.

# lsusb -t
Bus#  4
'-Dev#   1 Vendor 0x0000 Product 0x0000
Bus#  3
'-Dev#   1 Vendor 0x0000 Product 0x0000
  |-Dev#   2 Vendor 0x046d Product 0xc501
  '-Dev#   3 Vendor 0x0781 Product 0x0002
Bus#  2
'-Dev#   1 Vendor 0x0000 Product 0x0000
  |-Dev#   2 Vendor 0x0451 Product 0x2036
  | |-Dev#   5 Vendor 0x04b8 Product 0x0005
  | '-Dev#   6 Vendor 0x04b8 Product 0x0602
  '-Dev#   3 Vendor 0x0451 Product 0x2046
    '-Dev#   4 Vendor 0x056a Product 0x0011
Bus#  1
'-Dev#   1 Vendor 0x0000 Product 0x0000

3.6.2. USB Controllers

There are three types of USB host controllers :

  • Open Host Controller Interface (OHCI)

  • Universal Host Controller Interface (UHCI)

  • Enhanced Host Controller Interface (EHCI)

OHCI and UHCI controllers are both USB 1.1 controllers, which are capable of a maximum of 12 Mbps. EHCI controllers are USB 2.0 controllers, which are capable of a theoretical maximum of 480 Mbps. To get greater than USB 1.1 speeds, you must have a USB 2.0 controller, as well as USB 2.0 devices, hubs, and cables. A USB 2.0 device attached to a USB 1.1 hub will only be able to run at USB 1.1 speeds.

3.6.3. USB Devices

There are several classes of USB devices , including the following:


Human Interface Device (HID)

Input devices (mice, keyboards, etc.)


Communications device

Modems


Mass storage device

Disk devices, flash readers, etc.


Audio

Sound devices


IrDA

Infrared devices


Printer

Printers and USB-to-parallel cables

3.6.4. USB Drivers

USB support was added to the Linux kernel in the 2.3.x development kernel series, then back-ported to 2.2.x, minus support for USB mass storage devices (due to SCSI changes in 2.3.x). The back-port was included in the 2.2.18 kernel release.


Tip: There is no kernel USB support in 2.0.x and earlier.

The Linux kernel USB drivers fall into three categories:


Host controller drivers

The USB host controller drivers include usb-ohci.o (OHCI driver), usb-uhci.o (UHCI driver), uhci.o (old "alternate" UHCI driver), and ehci-hcd.o (EHCI driver).


Class drivers

The USB class drivers include hid.o, usb-storage.o (mass storage driver), acm.o (Automated Control Model [ACM] communications class driver, which deals with modems that emulate the standard serial modem AT command interface), printer.o, and audio.o.


Other device drivers

There are many drivers for devices that either don't fit into one of the standard USB classes or don't work with one of the standard class drivers. Examples include rio500.o (the driver for the Diamond Rio 500 MP3 player) and pwc.o (the driver for various Philips webcams).

The Linux drivers implement USB support in layers. At the bottom is usbcore.o, which provides all of the generic USB support for the higher-level drivers as well as USB hub support. The host controller drivers load in the middle of the stack. On top are the device and class drivers and any modules they require.

The following is an example of what you might see in /proc/modules (or from the output of lsmod) on a system with several USB devices:

Module                  Size  Used by
usb-storage            68628   0
scsi_mod              106168   2  [usb-storage]
evdev                   5696   0  (unused)
printer                 8832   0
wacom                   7896   0  (unused)
keybdev                 2912   0  (unused)
mousedev                5428   1
hid                    21700   0  (unused)
input                   5824   0  [evdev wacom keybdev mousedev hid]
ehci-hcd               19432   0  (unused)
usb-uhci               25964   0  (unused)
usbcore                77760   1  [usb-storage printer wacom hid ehci-hcd \
                                      usb-uhci]

3.6.5. USB Hotplug

Modularized USB drivers are loaded by the generic /sbin/hotplug support in the kernel, which is also used for other hotplug devices such as CardBus cards.


Tip: While not covered on the LPI exams, the Linux IEEE 1394 (also known as FireWire or i.Link) drivers have a similar design. If you understand how to set up USB devices, setting up IEEE 1394 devices should be easy.

Previous Page
Next Page