Наши партнеры








Книги по Linux (с отзывами читателей)

Библиотека сайта rus-linux.net

Enumeration and Device Descriptors

Whenever a USB device is attached to the bus it will be enumerated by the USB subsystem - i.e an unique device number (1-127) is assigned and then the device descriptor is read. The desciptor is a data structure which contains information about the device and its properties. The USB standard defines a hierarchy of descriptors (see Figure 1-2).

Standard Descriptors

  • A Device Descriptor describes general information about a USB device. It includes information that applies globally to the device and all of the device s configurations. A USB device has only one device descriptor.
  • The Configuration Descriptor gives information about a specific device configuration. A USB device has one or more configuration descriptors. Each configuration has one or more interfaces and each interface has zero or more endpoints. An endpoint is not shared among different interfaces within a single configuration, although a single interface can have several alternate settings which may use the same endpoint. Endpoints may be shared among interfaces that are part of different configurations without this restriction. Configurations can only be activated by the standard control transfer set_configuration. Different configurations can be used to change global device settings, such as power consumption.
  • An Interface Descriptor describes a specific interface within a configuration. A configuration provides one or more interfaces, each with zero or more endpoint descriptors describing a unique set of endpoints within the configuration. An interface may include alternate settings that allow the endpoints and/or their characteristics to be varied after the device has been configured. The default setting for an interface is always alternate setting zero. Alternate settings can be selected exclusively by the standard control transfer set_interface. For example a multifunctional device like a video camera with internal microphone could have three alternate settings to change the bandwidth allocation on the bus.

    Camera activated
    Microphone activated
    Camera and microphone activated

  • An Endpoint Descriptor contains information required by the host to determine the bandwidth requirements of each endpoint. An endpoint represents a logical data source or sink of a USB device. The endpoint zero is used for all control transfers and there is never a descriptor for this endpoint. The USB specification uses the terms pipe and endpoint interchangably.
  • String Descriptors are optional and provide additional information in human readable unicode format. They can be used for vendor and device names or serial numbers.

Device Classes

The standard device and interface descriptors contain fields that are related to classification: class, sub-class and protocol. These fields may be used by a host system to associate a device or interface to a driver, depending on how they are specified by the class specification. Valid values for the class fields of the device and interface descriptors are defined by the USB Device Working Group.

Grouping devices or interfaces together in classes and then specifying the characteristics in a Class Specification allows the development of host software which can manage multiple implementations based on that class. Such host software adapts its operation to a specific device or interface using descriptive information presented by the device. A class specification serves as a framework defining the minimum operation of all devices or interfaces which identify themselves as members of the class.

Human Interface Devices (HID)

The HID class consists primarily of devices that are used by humans to control the operation of computer systems. Typical examples of HID class devices include:

Keyboards and pointing devices for example, standard mouse devices, trackballs, and joysticks.
Front-panel controls for example: knobs, switches, buttons, and sliders.
Controls that might be found on devices such as telephones, VCR remote controls, games or simulation devices for example: data gloves, throttles, steering wheels, and rudder pedals.