USB Composite Class Device ( USB 复合设备 )

本文介绍了USB复合设备的概念,这类设备可以在单一设备中提供多种独立控制的功能接口,例如结合键盘和鼠标的设备。复合设备在USB规范中定义为设备类(bDeviceClass)和子类(bDeviceSubClass)均为0的设备。文章还详细解释了复合设备如何在系统中被枚举,包括设备标识符的生成及驱动程序的选择过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

USB Composite Class Devices

A USB Composite Device is any device which does more than one job
for example a combined keyboard and mouse.
A USB Composite device is the one with multiple interfaces controlled independently of each other.
When using such device multiple functions are combined into a single device,
for example, a keyboard and mouse, USB hard disk and DVD writer etc.

The USB specification defines a composite class device as a device
whose device-descriptor fields for device class (bDeviceClass)
and device subclass (bDeviceSubClass) both have the value 0.

A composite class device appears to the system as a USB device using a single bus address
that may present multiple interfaces, each of which represents a separate function.

A good example of a composite class device is a multifunction device,
such as a device that performs printing, scanning, and faxing.
In such a device, each function is represented by a separate interface.

Although most multifunction USB devices are composite class devices,
not all composite class devices are multifunction devices.

The manufacturer of a single-function USB device is at liberty
to classify the device as a composite class device as long as the device meets the USB specifications.

 

Enumeration of USB Composite Devices

When a new USB device is connected to a host machine,
the USB bus driver creates a physical device object (PDO)
for the device and generates a PnP event to report the new PDO.

The operating system then queries the bus driver for the hardware IDs associated with the PDO.
For all USB devices, the USB bus driver reports a device ID with the following format:

USB\VID_xxxx&PID_yyyy

Note xxxx and yyyy are taken directly from idVendor and idProduct fields of the device descriptor, respectively.

The bus driver also reports a compatible identifier (ID) of USB\COMPOSITE,
if the device meets the following requirements:

The device class field of the device descriptor (bDeviceClass) must contain a value of zero,
or the class (bDeviceClass), subclass (bDeviceSubClass), and protocol (bDeviceProtocol) fields of the device descriptor
must have the values 0xEF, 0x02 and 0x01 respectively, as explained in USB Interface Association Descriptor.

The device must have a single configuration.

The device must have multiple interfaces.

The bus driver also checks the device class (bDeviceClass), s
ubclass (bDeviceSubClass), and protocol (bDeviceProtocol) fields of the device descriptor.

If these fields are zero, the device is a composite device,
and the bus driver reports an extra compatible identifier (ID) of USB\COMPOSITE for the PDO.

After retrieving the hardware and compatible IDs for the new PDO,
the operating system searches the INF files.

If one of the INF files contains a match for the device ID,
Windows loads the driver that is indicated by that INF file
and the generic parent driver does not come into play.

If no INF file contains the device ID, and the PDO has a compatible ID, Windows searches for the compatible ID.
This produces a match in Usb.inf and causes the operating system to load the USB Generic Parent Driver (Usbccgp.sys).

If you want the generic parent driver to manage your device,
but your device does not have the characteristics necessary
to ensure that the system will generate a compatible ID of USB\COMPOSITE,
you will have to provide an INF file that loads the generic parent driver.
The INF file should contain a needs/includes section that references Usb.inf.

If your composite device has multiple configurations,
the INF file you provide must specify which configuration the generic parent should use in the registry.
The necessary registry keys are described in Configuring Usbccgp.sys to Select a Non-Default USB Configuration.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值