目录
什么是UVC
USB VIDEO CLASS
现在即插即用,不需要安装驱动的usb摄像头,基本上都符合这个标准。
windows linux android 主流系统都包含了对UVC的支持。
UVC规范
是USB规范的一部分。
目前USB文档网站上是1,5
https://www.usb.org/documents?search=uvc&type%5B%5D=55&items_per_page=50
UVC设备的枚举过程
主要讲这个
USB设备插入host之后,usb host 会通过control端点,请求设备描述符.
结构如下
- typedef struct _USB_DEVICE_DESCRIPTOR {
- UCHAR bLength; //该描述符结构体大小(18字节)
- UCHAR bDescriptorType; //描述符类型(本结构体中固定为0x01)
- USHORT bcdUSB; //USB版本号
- UCHAR bDeviceClass; //设备类代码(由USB官方分配)
- UCHAR bDeviceSubClass; //子类代码(由USB官方分配)
- UCHAR bDeviceProtocol; //设备协议代码(由USB官方分配)
- UCHAR bMaxPacketSize0; //端点0的最大包大小(有效大小为8,16,32,64)
- USHORT idVendor; //生产厂商编号(由USB官方分配)
- USHORT idProduct; //产品编号(制造厂商分配)
- USHORT bcdDevice; //设备出厂编号
- UCHAR iManufacturer; //设备厂商字符串索引
- UCHAR iProduct; //产品描述字符串索引
- UCHAR iSerialNumber; //设备序列号字符串索引
- UCHAR bNumConfigurations; //当前速度下能支持的配置数量
- } USB_DEVICE_DESCRIPTOR, *PUSB_DEVICE_DESCRIPTOR;
UCHAR bDeviceClass; //设备类代码(由USB官方分配)
UCHAR bDeviceSubClass; //子类代码(由USB官方分配)
UCHAR bDeviceProtocol; //设备协议代码(由USB官方分配)
这三个参数会告诉host自己是什么设备,usbcore 会根据 vid pid 以及设备类型加载驱动调用相对应驱动的probe函数。
比如 usb_storage,usb_hid,uvc
Base Class Descriptor Usage Description
00h Device Use class information in the Interface Descriptors种类信息定义在接口描述符中
01h Interface Audio音频设备
02h Both Communications&CDC通信设备
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