从零开始学USB(十八、USB的class)

关于USB的Class,对于学习USB协议的人,估计早就听到过此名词了。
而对于USB的Class的分类,此处先列出那个最基本的分类表:

Base Class

Descriptor Usage

Description

00h

Device

Use class information in the Interface Descriptors

01h

Interface

Audio  

02h

Both

Communications and CDC Control

03h

Interface

HID (Human Interface Device)

05h

Interface

Physical

06h

Interface

Image

07h

Interface

Printer

08h

Interface

Mass Storage

09h

Device

Hub

0Ah

Interface

CDC-Data

0Bh

Interface

Smart Card

0Dh

Interface

Content Security

0Eh

Interface

Video

0Fh

Interface

Personal Healthcare

10h

Interface

Audio/Video Devices

11h

Device

Billboard Device Class

12h

Interface

USB Type-C Bridge Class

DCh

Both

Diagnostic Device

E0h

Interface

Wireless Controller

EFh

Both

Miscellaneous

FEh

Interface

Application Specific

FFh

Both

Vendor Specific

下面给出USB官方给出的USB类表

https://www.usb.org/defined-class-codes

一、为何要搞这么多USB的Class


其实,看到上表中的一堆的Class分类,一般人,都会晕的。所以,就要简单解释一下,为何会有这么多USB的Class分类。
首先我们要知道,USB协议设计的目的,就是为了基础知识1 “为何要有USB”中所提到的,用单一的USB接口,取代之前种类繁多的各种其他接口。而为了取代其他各种接口,那意味着就要实现,或者是支持,之前别的接口,所对应的各种功能。
因此,USB协议设计的时候,就是要把鼠标,键盘,大容量存储,图像等,这些之前是通过其他接口所实现的,各种的功能,都囊括进来。并且在协议中有对应的规范定义,支持这些功能。因此,才有了如此多的各种USB的Clas,即分类,根据功能而分出的各种类别。不同的Class分类,用于实现对应的功能,适用于相应的设备。

二、类设备的区分

首先我们需要知道怎么知道一个设备怎么分类

Base Class

SubClass

Protocol

Meaning

xxh

xxh

xxh

Use class code info from Interface Descriptors

USB官方给出的是用三种级别区分,分别是

-子类-协议码
其中,类用来区分大类比如本文最前面的,人机机交互类,图像类,无线类等等

子类则是比如音频类( Audio),中的音频控制(进度),音频流(数据),数字乐器

协议类则比如人机接口类(HID)中的鼠标、键盘、触摸屏等

当然子类和协议类并不是区分的特别详细,因为有些分类其实两类就足够了。为了考虑将来这类设备出现新的事务,而做出了预留。

三、常见的USB类设备

1. 类设备(音频)

此基类是针对符合USB-IF网站上的音频设备类规范的支持音频的设备定义的。 该规范定义了可用的SubClass和Protocol值集。 超出该定义规范的值是保留的。 这些类代码只能在接口描述符中使用。包含的内容可能包括,放大器,接收器,乐器,录音和回放设备等设备

2.类设备(通信设备)

此基类是为符合USB-IF网站上的通信设备类规范的设备定义的。 该规范定义了可用的SubClass和Protocol值集。 超出该定义规范的值是保留的。 请注意,通信设备类规范要求在设备描述符中使用一些类代码值(三元组),并在接口描述符中使用一些类代码值。

3.类设备(人机接口设备)

此基类是为符合USB-IF网站上的HID设备类规范的设备定义的。 该规范定义了可用的SubClass和Protocol值集。 超出该定义规范的值是保留的。 这些类代码只能在接口描述符中使用。

5.类设备(物理设备)

此基类是为符合USB-IF网站上的物理设备类规范的设备定义的。 该规范定义了可用的SubClass和Protocol值集。 超出该定义规范的值是保留的。 这些类代码只能在接口描述符中使用。

6.类设备(图片)

此基类是为符合“成像设备类特定”的设备定义的

7.类设备(打印机设备)

此基类是为符合USB-IF网站上的打印机设备类规范的设备定义的。 该规范定义了可用的SubClass和Protocol值集。 超出该定义规范的值是保留的。 这些类代码只能在接口描述符中使用。

8.类设备(大容量存储)

此基类是为符合USB-IF网站上的大容量存储设备类规范的设备定义的。 该规范定义了可用的SubClass和Protocol值集。 超出该定义规范的值是保留的。 这些类代码只能在接口描述符中使用。

9.类设备(集线器类)

此基类是为USB集线器设备定义的,并且符合USB规范中的定义。 该规范定义了完整的三元组,如下所示。 保留所有其他值。 这些类代码只能在设备描述符中使用。

10.类设备(数据接口类)-0x0A

此类包含可用于流数据的各种设备,例如网络摄像头。 此类中存在许多不同的协议和传输模式。 不幸的是,大多数数据流设备使用供应商特定类。

11类设备(芯片卡/智能卡)-0x0B

此基类是为符合USB-IF网站上的智能卡设备类规范的设备定义的。 该规范定义了SubClass和Protocol值的可用集合。保留了该定义规范之外的值。 这些类代码只能在接口描述符中使用。

13 类设备(内容安全)-0x0D

此基类是为符合USB-IF网站上的内容安全设备类规范的设备定义的。 该规范定义了可用的SubClass和Protocol值集。 超出该定义规范的值是保留的。 这些类代码只能在接口描述符中使用。

14.类设备(视频)-0x0E

此基类是为符合USB-IF网站上的视频设备类规范的设备定义的。 该规范定义了可用的SubClass和Protocol值集。 超出该定义规范的值是保留的。 这些类代码只能在接口描述符中使用。

15.类设备(个人医疗保健)-0xF

此基类是为符合USB-IF网站上的个人医疗保健设备类规范的设备定义的。 该规范定义了可用的SubClass和Protocol值集。 超出该定义规范的值是保留的。 这些类代码只能在接口描述符中使用。

16.类设备(音频/视频)-0x10

USB音频/视频(AV)设备类定义描述了用于与复合设备中嵌入的设备或功能通信的方法,这些设备或功能用于处理音频,视频,语音以及所有与图像和声音相关的功能。 该规范定义了可用的SubClass和Protocol值集。 超出该定义规范的值是保留的。 这些类代码只能在接口描述符中使用。

17.类设备(广告牌设备)-0x11

此基类是为符合USB-IF网站上的Billboard Device Class Specification的设备定义的。 该规范定义了可用的SubClass和Protocol值集。 超出该定义规范的值是保留的。 这些类代码只能在设备描述符中使用。

18.类设备(Type-C桥接器件)

此基类是为符合USB-IF网站上的USB Type-C桥接器件类规范的器件定义的。 该规范定义了可用的SubClass和Protocol值集。 超出该定义规范的值是保留的。 这些类代码只能在接口描述符中使用。

Base Class

SubClass

Protocol

Meaning

12h

00h

00h

USB Type-C Bridge Device

 220.类设备(诊断设备)-0xDC

此基类是为诊断设备定义的设备。 此类代码可用于设备或接口描述符。
跟踪是一种调试形式,其中处理器或系统活动在外部可见,实时或存储,然后由应用程序开发人员,应用程序或专门观察系统活动的外部设备检索。
调试或测试设计(Dfx)。 这是指提供调试或测试支持的逻辑块(例如,通过测试访问端口(TAP))。
DvC:USB设备的调试功能(设备功能)

Base Class

SubClass

Protocol

Meaning

DCh

01h

01h

USB2 Compliance Device.  Definition for this device can be found at http://www.intel.com/technology/usb/spec.htm

02h

00h

Debug Target vendor defined. Please see http://www.intel.com/content/www/us/en/io/universal-serial-bus/extensible-host-controler-interface-usb-xhci.html for more info.

01h

GNU Remote Debug Command Set. Please see http://www.intel.com/content/www/us/en/io/universal-serial-bus/extensible-host-controler-interface-usb-xhci.html for more info.

03h

00h

Undefined

01h

Vendor defined Trace protocol on DbC.

04h

00h

Undefined

01h

Vendor defined Dfx protocol on DbC.

05h

00h

Vendor defined Trace protocol over General Purpose (GP) endpoint on DvC.

01h

GNU Protocol protocol over General Purpose (GP) endpoint on DvC.

		<p style="margin-left:0px;"><span style="color:#000000;"><a href="http://www.gnu.org/software/gdb/" rel="nofollow">http://www.gnu.org/software/gdb/</a></span></p>
		</td>
	</tr><tr><td rowspan="2" style="width:65.5pt;">
		<p style="margin-left:0px;"><span style="color:#000000;">06h</span></p>
		</td>
		<td style="width:61.35pt;">
		<p style="margin-left:0px;"><span style="color:#000000;">00h</span></p>
		</td>
		<td style="vertical-align:top;width:290.95pt;">
		<p style="margin-left:0px;"><span style="color:#000000;">Undefined</span></p>
		</td>
	</tr><tr><td style="width:61.35pt;">
		<p style="margin-left:0px;"><span style="color:#000000;">01h</span></p>
		</td>
		<td style="vertical-align:top;width:290.95pt;">
		<p style="margin-left:0px;"><span style="color:#000000;">Vendor defined Dfx protocol on DvC.</span></p>
		</td>
	</tr><tr><td rowspan="2" style="width:65.5pt;">
		<p style="margin-left:0px;"><span style="color:#000000;">07h</span></p>
		</td>
		<td style="width:61.35pt;">
		<p style="margin-left:0px;"><span style="color:#000000;">00h</span></p>
		</td>
		<td style="vertical-align:top;width:290.95pt;">
		<p style="margin-left:0px;"><span style="color:#000000;">Undefined</span></p>
		</td>
	</tr><tr><td style="width:61.35pt;">
		<p style="margin-left:0px;"><span style="color:#000000;">01h</span></p>
		</td>
		<td style="vertical-align:top;width:290.95pt;">
		<p style="margin-left:0px;"><span style="color:#000000;">Vendor defined Trace protocol on DvC.</span></p>
		</td>
	</tr><tr><td style="width:65.5pt;">
		<p style="margin-left:0px;"><span style="color:#000000;">08h</span></p>
		</td>
		<td style="width:61.35pt;">
		<p style="margin-left:0px;"><span style="color:#000000;">00h</span></p>
		</td>
		<td style="vertical-align:top;width:290.95pt;">
		<p style="margin-left:0px;"><span style="color:#000000;">Undefined</span></p>
		</td>
	</tr></tbody></table></div><p>&nbsp;</p>

224.类设备(无线控制类)-0xE0

此基类是为无线控制器设备定义的。 保留了下表中未显示的值。 这些类代码将在接口描述符中使用,但蓝牙类代码除外,它也可以在设备描述符中使用。

Base Class

SubClass

Protocol

Meaning

		<p style="margin-left:0px;">E0h</p>
		</td>
		<td rowspan="4" style="width:65.5pt;">
		<p style="margin-left:0px;">01h</p>
		</td>
		<td style="vertical-align:top;width:59.5pt;">
		<p style="margin-left:0px;">01h</p>
		</td>
		<td style="vertical-align:top;width:390.3pt;">
		<p style="margin-left:0px;">Bluetooth Programming Interface.&nbsp; Get specific information from&nbsp;<a href="http://www.bluetooth.com/" rel="nofollow">www.bluetooth.com</a>.</p>
		</td>
	</tr><tr><td style="vertical-align:top;width:59.5pt;">
		<p style="margin-left:0px;">02h</p>
		</td>
		<td style="vertical-align:top;width:390.3pt;">
		<p style="margin-left:0px;">UWB Radio Control Interface.&nbsp; Definition for this is found in the Wireless USB Specification in Chapter 8.</p>
		</td>
	</tr><tr><td style="vertical-align:top;width:59.5pt;">
		<p style="margin-left:0px;">03h</p>
		</td>
		<td style="vertical-align:top;width:390.3pt;">
		<p style="margin-left:0px;">Remote NDIS.&nbsp; Information can be found at:&nbsp;<a href="http://www.microsoft.com/windowsmobile/mobileoperators/default.mspx" rel="nofollow">http://www.microsoft.com/windowsmobile/mobileoperators/default.mspx</a></p>
		</td>
	</tr><tr><td style="vertical-align:top;width:59.5pt;">
		<p style="margin-left:0px;"><span style="color:#000000;">04h</span></p>

		<p style="margin-left:0px;">&nbsp;</p>
		</td>
		<td style="vertical-align:top;width:390.3pt;">
		<p style="margin-left:0px;"><span style="color:#000000;">Bluetooth AMP Controller. Get specific information from&nbsp;<a href="http://www.bluetooth.com/" rel="nofollow">www.bluetooth.com</a>.</span></p>
		</td>
	</tr><tr><td rowspan="3" style="width:65.5pt;">
		<p style="margin-left:0px;">2h</p>
		</td>
		<td style="vertical-align:top;width:59.5pt;">
		<p style="margin-left:0px;">01h</p>
		</td>
		<td style="vertical-align:top;width:390.3pt;">
		<p style="margin-left:0px;">Host Wire Adapter Control/Data interface.&nbsp; Definition can be found in the Wireless USB Specification in Chapter 8.</p>
		</td>
	</tr><tr><td style="vertical-align:top;width:59.5pt;">
		<p style="margin-left:0px;">02h</p>
		</td>
		<td style="vertical-align:top;width:390.3pt;">
		<p style="margin-left:0px;">Device Wire Adapter Control/Data interface.&nbsp; Definition can be found in the Wireless USB Specification in Chapter 8.</p>
		</td>
	</tr><tr><td style="vertical-align:top;width:59.5pt;">
		<p style="margin-left:0px;">03h</p>
		</td>
		<td style="vertical-align:top;width:390.3pt;">
		<p style="margin-left:0px;">Device Wire Adapter Isochronous interface.&nbsp;&nbsp;Definition can be found in the Wireless USB Specification in Chapter 8.</p>
		</td>
	</tr></tbody></table></div><p>&nbsp;</p>

239.类设备(杂类)-0xEF

此基类是为其他设备定义定义的。 保留了下表中未显示的值。 这些类代码(设备或接口描述符)的使用在下面的每个条目中具体注释。

Base Class

SubClass

Protocol

Meaning

EFh

01h

01h

Active Sync device. This class code can be used in either Device or Interface Descriptors. Contact Microsoft for more information on this class.

02h

Palm Sync. This class code can be used in either Device or Interface Descriptors.

02h

01h

Interface Association Descriptor. The usage of this class code triple is defined in the Interface Association Descriptor ECN that is provided on www.usb.org . This class code may only be used in Device Descriptors.

02h

Wire Adapter Multifunction Peripheral programming interface. Definition can be found in the Wireless USB Specification in Chapter 8. This class code may only be used in Device Descriptors

03h

01h

Cable Based Association Framework. This is defined in the Association Model addendum to the Wireless USB specification. This class code may only be used in Interface Descriptors.

04h

01h

RNDIS over Ethernet.

		<p>Connecting a host to the Internet via Ethernet mobile device. The device appears to the host as an Ethernet gateway device.</p>

		<p>This class code may only be used in Interface Descriptors.</p>
		</td>
	</tr><tr><td>
		<p>02h</p>
		</td>
		<td colspan="2" style="vertical-align:top;">
		<p>RNDIS over WiFi.</p>

		<p>Connecting a host to the Internet via WiFi enabled mobile device.&nbsp;&nbsp;The device represents itself to the host as an 802.11 compliant network device.</p>

		<p>This class code may only be used in Interface Descriptors.</p>
		</td>
	</tr><tr><td>
		<p>03h</p>
		</td>
		<td colspan="2" style="vertical-align:top;">
		<p>RNDIS over WiMAX</p>

		<p>Connecting a host to the Internet via WiMAX enabled mobile device.&nbsp;&nbsp;The device is represented to the host as an 802.16 network device.</p>

		<p>This class code may only be used in Interface Descriptors.</p>
		</td>
	</tr><tr><td>
		<p>04h</p>
		</td>
		<td colspan="2" style="vertical-align:top;">
		<p>RNDIS over WWAN</p>

		<p>Connecting a host to the Internet via a device using mobile broadband, i.e. WWAN (GSM/CDMA).</p>

		<p>This class code may only be used in Interface Descriptors.</p>
		</td>
	</tr><tr><td>
		<p>05h</p>
		</td>
		<td colspan="2" style="vertical-align:top;">
		<p>RNDIS for Raw IPv4</p>

		<p>Connecting a host to the Internet using raw IPv4 via non-Ethernet mobile device.&nbsp;&nbsp;Devices that provide raw IPv4, not in an Ethernet packet, may use this form to in lieu of other stock types.</p>

		<p>This class code may only be used in Interface Descriptors.</p>
		</td>
	</tr><tr><td>
		<p>06h</p>
		</td>
		<td colspan="2" style="vertical-align:top;">
		<p>RNDIS for Raw IPv6</p>

		<p>Connecting a host to the Internet using raw IPv6 via non-Ethernet mobile device.&nbsp;&nbsp;Devices that provide raw IPv6, not in an Ethernet packet, may use this form to in lieu of other stock types.</p>

		<p>This class code may only be used in Interface Descriptors.</p>
		</td>
	</tr><tr><td>
		<p>07h</p>
		</td>
		<td colspan="2" style="vertical-align:top;">
		<p>RNDIS for GPRS</p>

		<p>Connecting a host to the Internet over GPRS mobile device using the device’s cellular radio</p>
		</td>
	</tr><tr><td rowspan="3">
		<p>05h</p>
		</td>
		<td>
		<p>00h</p>
		</td>
		<td style="vertical-align:top;">
		<p>USB3 Vision Control Interface</p>
		</td>
		<td rowspan="3" style="vertical-align:top;">
		<p>Machine Vision Device conforming to the USB3 Vision specification. This standard covers cameras and other related devices that are typically used in machine vision, industrial, and embedded applications.</p>

		<p>Reference:&nbsp;<a href="http://visiononline.org/" rel="nofollow">http://visiononline.org/</a></p>

		<p>This class code may only be used in Interface Descriptors.</p>
		</td>
	</tr><tr><td>
		<p>01h</p>
		</td>
		<td style="vertical-align:top;">
		<p>USB3 Vision Event Interface</p>
		</td>
	</tr><tr><td>
		<p>02h</p>
		</td>
		<td style="vertical-align:top;">
		<p>USB3 Vision Streaming Interface</p>
		</td>
	</tr><tr><td rowspan="2">
		<p>06h</p>
		</td>
		<td>
		<p>01h</p>
		</td>
		<td colspan="2" style="vertical-align:top;">
		<p>STEP. Stream Transport Efficient Protocol for content protection.</p>
		</td>
	</tr><tr><td>
		<p>02h</p>
		</td>
		<td colspan="2" style="vertical-align:top;">
		<p>STEP RAW. Stream Transport Efficient Protocol for Raw content protection.</p>
		</td>
	</tr><tr><td rowspan="3">
		<p>07h</p>
		</td>
		<td>
		<p>01h</p>
		</td>
		<td style="vertical-align:top;">
		<p>Command Interface in IAD</p>
		</td>
		<td rowspan="3" style="vertical-align:top;">
		<p>The DVB Common Interface (DVB-CI) specification describes a system whereby a removable CI Conditional Access Module (CICAM), given the appropriate usage rights, unscrambles protected pay-TV content and routes it over the same interface back to a TV receiver for display. An interface association for a DVB-CI function will contain a DVB-CI Command Interface for command, control, and status information, it may contain a DVB-CI Media Interface for audiovisual data streams, and it may also contain a CDC EEM interface to provide bridged networking to the CICAM.</p>

		<p>Reference: https://www.dvb.org/standards/dvb-ci-plus</p>
		</td>
	</tr><tr><td>
		<p>01h</p>
		</td>
		<td style="vertical-align:top;">
		<p>Command Interface in Interface Descriptor</p>
		</td>
	</tr><tr><td>
		<p>02h</p>
		</td>
		<td style="vertical-align:top;">
		<p>Media Interface in Interface Descriptor</p>
		</td>
	</tr></tbody></table></div><p>&nbsp;</p>

254.类设备(特定应用)

此基类是为符合USB-IF网站上的几个类规范的设备定义的。 该规范定义了可用的SubClass和Protocol值集。 超出该定义规范的值是保留的。 这些类代码只能在接口描述符中使用。

Base Class

SubClass

Protocol

Meaning

FEh

01h

01h

Device Firmware Upgrade.  Device class definition provided on www.usb.org .

02h

00h

IRDA Bridge device.  Device class definition provided on www.usb.org .

03h

00h

USB Test and Measurement Device.  Definition provided in the USB Test and Measurement Class spec found on www.usb.org .

01h

USB Test and Measurement Device conforming to the USBTMC USB488 Subclass Specification found on www.usb.org.

255.类设备(厂商自定义)-0xFF

此类包含不属于任何其他类的设备和具有特定于供应商的接口和/或协议的设备。

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/qq_16777851/article/details/86103430

发布了47 篇原创文章 · 获赞 9 · 访问量 1万+

关于USB的Class,对于学习USB协议的人,估计早就听到过此名词了。
而对于USB的Class的分类,此处先列出那个最基本的分类表:

猜你喜欢

转载自blog.csdn.net/u013836909/article/details/104902425
今日推荐