Linux Device Drivers (3rd Edition) [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Linux Device Drivers (3rd Edition) [Electronic resources] - نسخه متنی

Jonathan Corbet, Greg Kroah-Hartman, Alessandro Rubini

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید








Chapter 13. USB Drivers


The universal serial bus (USB) is a




connection
between a host computer
and a number of peripheral devices. It was originally created to
replace a wide range of slow and different busesthe parallel,
serial, and keyboard connectionswith a single bus type that
all devices could connect to.[1] USB has grown beyond these
slow connections and now supports almost every type of device that
can be connected to a PC. The latest revision of the USB
specification added high-speed connections with a theoretical speed
limit of 480 MBps.

[1] Portions of this
chapter are based on the in-kernel documentation for the Linux kernel
USB code, which were written by the kernel USB developers and
released under the GPL.


Topologically, a USB subsystem is not laid out as a bus; it is rather
a tree built out of several point-to-point links. The links are
four-wire cables (ground, power, and two signal wires) that connect a
device and a hub, just like twisted-pair Ethernet. The USB host
controller is in charge of asking every USB device if it has any data
to send. Because of this topology, a USB device can never start
sending data without first being asked to by the host controller.
This configuration allows for a very easy plug-and-play type of
system, whereby devices can be automatically configured by the host
computer.

The bus is very simple at the technological level, as
it's a single-master implementation in which the
host computer polls the various peripheral devices. Despite this
intrinsic limitation, the bus has some interesting features, such as
the ability for a device to request a fixed bandwidth for its data
transfers in order to reliably support video and audio I/O. Another
important feature of USB is that it acts merely as a communication
channel between the device and the host, without requiring specific
meaning or structure to the data it delivers.[2]

[2] Actually, some structure is there, but it mostly reduces to a
requirement for the communication to fit into one of a few predefined
classes: a keyboard won't allocate bandwidth, for
example, while some video cameras will.


The USB protocol specifications define a set of standards that any
device of a specific type can follow. If a device follows that
standard, then a special driver for that device is not necessary.
These different types are called classes and consist of things like
storage devices, keyboards, mice, joysticks, network devices, and
modems. Other types of devices that do not fit into these classes
require a special vendor-specific driver to be written for that
specific device. Video devices and USB-to-serial devices are a good
example where there is no defined standard, and a driver is needed
for every different device from different manufacturers.

These features, together with the inherent hotplug capability of the
design, make USB a handy, low-cost mechanism to connect (and
disconnect) several devices to the computer without the need to shut
the system down, open the cover, and swear over screws and wires.

The Linux kernel supports two main types of USB drivers: drivers on a
host system and drivers on a device. The USB drivers for a host
system control the USB devices that are plugged into it, from the
host's point of view (a common USB host is a desktop
computer.) The USB drivers in a device, control how that single
device looks to the host computer as a USB device. As the term
"USB device drivers" is very
confusing, the USB developers have created the term
"USB gadget drivers" to describe
the drivers that control a USB device that connects to a computer
(remember that Linux also runs in those tiny embedded devices, too.)
This chapter details how the USB system that runs on a desktop
computer works. USB gadget drivers are outside the realm of this book
at this point in time.

As Chapter 13 shows, USB
drivers live between the different kernel subsytems (block, net,
char, etc.) and the USB hardware controllers. The USB core provides
an interface for USB drivers to use to access and control the USB
hardware, without having to worry about the different types of USB
hardware controllers that are present on the system.


Figure 13-1. USB driver overview


    / 202