UVC 描述符实例

UVC学习笔记是以最新的UVC1.5为基础,带你学习和了解最新的UVC规范和协议。

通过BUSBOUND抓取USB摄像头插入电脑时的数据信息,这里只是选报设备描述符和接口描述符信息

Device  Phase  Data                      Description       Cmd.Phase.Ofs(rep)
------  -----  ------------------------  ----------------  ------------------
  29.0  CTL    80 06 00 01  00 00 12 00  GET DESCRIPTOR           1.1.0        
  29.0  IN     12 01 20 03  ef 02 01 09  .. .....                 1.2.0        
               d9 2b 21 00  01 02 01 02  .+!.....                 1.2.8        
               03 01                     ..                       1.2.16       
  29.0  CTL    80 06 00 02  00 00 09 00  GET DESCRIPTOR           2.1.0        
  29.0  IN     09 02 02 01  02 01 00 80  ........                 2.2.0        
               70                        p                        2.2.8        
  29.0  CTL    80 06 00 02  00 00 02 01  GET DESCRIPTOR           3.1.0        
  29.0  IN     09 02 02 01  02 01 00 80  ........                 3.2.0        
               70 09 04 00  00 00 0e 01  p.......                 3.2.8        
               00 00 0d 24  01 10 01 51  ...$...Q                 3.2.16       
               00 e8 03 00  00 01 01 12  ........                 3.2.24       
               24 02 02 01  02 00 00 00  $.......                 3.2.32       
               00 00 00 00  00 03 0a 0a  ........                 3.2.40       
               00 0d 24 05  03 02 00 00  ..$.....                 3.2.48       
               03 09 06 00  00 00 1c 24  .......$                 3.2.56       
               06 04 29 c8  ac f6 db ac  ..).....                 3.2.64       
               11 e5 84 24  f3 90 68 f7  ...$..h.                 3.2.72       
               55 11 14 01  03 03 1f 00  U.......                 3.2.80       
               0d 00 09 24  03 05 01 01  ...$....                 3.2.88       
               00 04 00 09  04 01 00 01  ........                 3.2.96       
               0e 02 00 00  0e 24 01 01  .....$..                 3.2.104      
               89 00 81 00  05 00 00 00  ........                 3.2.112      
               01 00 1b 24  04 01 03 59  ...$...Y                 3.2.120      
               55 59 32 00  00 10 00 80  UY2.....                 3.2.128      
               00 00 aa 00  38 9b 71 10  ....8.q.                 3.2.136      
               01 00 00 00  00 1e 24 05  ......$.                 3.2.144      
               01 02 80 07  38 04 00 80  ....8...                 3.2.152      
               53 3b 00 80  53 3b 00 48  S;..S;.H                 3.2.160      
               3f 00 15 16  05 00 01 15  ?.......                 3.2.168      
               16 05 00 1e  24 05 02 02  ....$...                 3.2.176      
               00 05 d0 02  00 00 5e 1a  ......^.                 3.2.184      
               00 00 5e 1a  00 20 1c 00  ..^.. ..                 3.2.192      
               15 16 05 00  01 15 16 05  ........                 3.2.200      
               00 1e 24 05  03 02 80 02  ..$.....                 3.2.208      
               68 01 00 80  97 06 00 80  h.......                 3.2.216      
               97 06 00 08  07 00 15 16  ........                 3.2.224      
               05 00 01 15  16 05 00 06  ........                 3.2.232      
               24 0d 01 07  04 07 05 81  $.......                 3.2.240      
               02 00 04 00  06 30 0f 00  .....0..                 3.2.248      
               00 00                     ..                       3.2.256

设备描述符

12 01 20 03  ef 02 01 09  d9 2b 21 00  01 02 01 02  03 01

对其数据时行结构分析

bLength                  : 0x12 (18 bytes)
bDescriptorType          : 0x01 (Device Descriptor)
bcdUSB                   : 0x320 (USB Version 3.20)
bDeviceClass             : 0xEF (Miscellaneous)
bDeviceSubClass          : 0x02
bDeviceProtocol          : 0x01 (IAD - Interface Association Descriptor)
bMaxPacketSize0          : 0x09 (9 bytes)
idVendor                 : 0x2BD9
idProduct                : 0x0021
bcdDevice                : 0x0201
iManufacturer            : 0x01 (String Descriptor 1)
 Language 0x0409         : "xxx"//这里隐去厂
iProduct                 : 0x02 (String Descriptor 2)
 Language 0x0409         : "xxx x"//这里隐去
iSerialNumber            : 0x03 (String Descriptor 3)
 Language 0x0409         : "B41A01004"
bNumConfigurations       : 0x01 (1 Configuration)
Data (HexDump)           : 12 01 20 03 EF 02 01 09 D9 2B 21 00 01 02 01 02   .. ......+!.....
                           03 01

可以看到是视频类0xef,有1个配置

配置描述符

------------------ Configuration Descriptor -------------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x02 (Configuration Descriptor)
wTotalLength             : 0x019F (415 bytes)
bNumInterfaces           : 0x05 (5 Interfaces)
bConfigurationValue      : 0x01 (Configuration 1)
iConfiguration           : 0x00 (No String Descriptor)
bmAttributes             : 0x80
 D7: Reserved, set 1     : 0x01
 D6: Self Powered        : 0x00 (no)
 D5: Remote Wakeup       : 0x00 (no)
 D4..0: Reserved, set 0  : 0x00
MaxPower                 : 0x70 (896 mA)

这里有5个接口描述符。

接口描述符

接口描述符中不光含有接口描述符相关内容,后面也有其它描述符信息,所以是个变长数据结构。USB驱动在获取时是通过2次获取的。

 ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x00
bAlternateSetting        : 0x00
bNumEndpoints            : 0x00 (Default Control Pipe only)
bInterfaceClass          : 0x0E (Video)
bInterfaceSubClass       : 0x01 (Video Control)
bInterfaceProtocol       : 0x00
iInterface               : 0x00 (No String Descriptor)
Data (HexDump)           : 09 04 00 00 00 0E 01 00 00                        .........

注意:

真实在配置固件时应该有个IAD的,不过这里没有,由USBCCGP过滤掉。

控制接口头描述符头

  ------- Video Control Interface Header Descriptor -----
bLength                  : 0x0D (13 bytes)
bDescriptorType          : 0x24 (Video Control Interface)
bDescriptorSubtype       : 0x01 (Video Control Header)
bcdUVC                   : 0x0110 (UVC Version 1.10)
wTotalLength             : 0x0051 (81 bytes)
dwClockFreq              : 0x000003E8 (1000 Hz)
bInCollection            : 0x01 (1 VideoStreaming interface)
baInterfaceNr[1]         : 0x01
Data (HexDump)           : 0D 24 01 10 01 51 00 E8 03 00 00 01 01            .$...Q.......

VC输入端点描述符(第一个接口)

     -------- Video Control Input Terminal Descriptor ------
bLength                  : 0x12 (18 bytes)
bDescriptorType          : 0x24 (Video Control Interface)
bDescriptorSubtype       : 0x02 (Input Terminal)
bTerminalID              : 0x02
wTerminalType            : 0x0201 (ITT_CAMERA)
bAssocTerminal           : 0x00 (Not associated with an Output Terminal)
iTerminal                : 0x00
Camera Input Terminal Data:
wObjectiveFocalLengthMin : 0x0000
wObjectiveFocalLengthMax : 0x0000
wOcularFocalLength       : 0x0000
bControlSize             : 0x03
bmControls               : 0x0A, 0x0A, 0x00
 D00                     : 0   no -  Scanning Mode
 D01                     : 1  yes -  Auto-Exposure Mode
 D02                     : 0   no -  Auto-Exposure Priority
 D03                     : 1  yes -  Exposure Time (Absolute)
 D04                     : 0   no -  Exposure Time (Relative)
 D05                     : 0   no -  Focus (Absolute)
 D06                     : 0   no -  Focus (Relative)
 D07                     : 0   no -  Iris (Absolute)
 D08                     : 0   no -  Iris (Relative)
 D09                     : 1  yes -  Zoom (Absolute)
 D10                     : 0   no -  Zoom (Relative)
 D11                     : 1  yes -  Pan (Absolute)
 D12                     : 0   no -  Pan (Relative)
 D13                     : 0   no -  Roll (Absolute)
 D14                     : 0   no -  Roll (Relative)
 D15                     : 0   no -  Tilt (Absolute)
 D16                     : 0   no -  Tilt (Relative)
 D17                     : 0   no -  Focus Auto
 D18                     : 0   no -  Reserved
 D19                     : 0   no -  Reserved
 D20                     : 0   no -  Reserved
 D21                     : 0   no -  Reserved
 D22                     : 0   no -  Reserved
 D23                     : 0   no -  Reserved
Data (HexDump)           : 12 24 02 02 01 02 00 00 00 00 00 00 00 00 03 0A   .$..............
                           0A 00                                             ..
Data (HexDump)           : 12 24 02 02 01 02 00 00 00 00 00 00 00 00 03 0A   .$..............
                           0A 00

控制单元描述符

       -------- Video Control Processing Unit Descriptor -----
bLength                  : 0x0D (13 bytes)
bDescriptorType          : 0x24 (Video Control Interface)
bDescriptorSubtype       : 0x05 (Processing Unit)
bUnitID                  : 0x03
bSourceID                : 0x02
wMaxMultiplier           : 0x0000
bControlSize             : 0x03
bmControls               : 0x09, 0x06, 0x00
 D00                     : 1  yes -  Brightness
 D01                     : 0   no -  Contrast
 D02                     : 0   no -  Hue
 D03                     : 1  yes -  Saturation
 D04                     : 0   no -  Sharpness
 D05                     : 0   no -  Gamma
 D06                     : 0   no -  White Balance Temperature
 D07                     : 0   no -  White Balance Component
 D08                     : 0   no -  Backlight Compensation
 D09                     : 1  yes -  Gain
 D10                     : 1  yes -  Power Line Frequency
 D11                     : 0   no -  Hue, Auto
 D12                     : 0   no -  White Balance Temperature, Auto
 D13                     : 0   no -  White Balance Component, Auto
 D14                     : 0   no -  Digital Multiplier
 D15                     : 0   no -  Digital Multiplier Limit
 D16                     : 0   no -  Analog Video Standard
 D17                     : 0   no -  Analog Video Lock Status
 D18                     : 0   no -  Contrast, Auto
 D19                     : 0   no -  Reserved
 D20                     : 0   no -  Reserved
 D21                     : 0   no -  Reserved
 D22                     : 0   no -  Reserved
 D23                     : 0   no -  Reserved
iProcessing              : 0x00
bmVideoStandards         : 0x00
 D00                   : 0   no -  None
 D01                   : 0   no -  NTSC  - 525/60
 D02                   : 0   no -  PAL   - 625/50
 D03                   : 0   no -  SECAM - 625/50
 D04                   : 0   no -  NTSC  - 625/50
 D05                   : 0   no -  PAL   - 525/60
 D06                   : 0   no -  Reserved
 D07                   : 0   no -  Reserved
Data (HexDump)           : 0D 24 05 03 02 00 00 03 09 06 00 00 00            .$...........

扩展单元描述符

 --------- Video Control Extension Unit Descriptor -----
bLength                  : 0x1C (28 bytes)
bDescriptorType          : 0x24 (Video Control Interface)
bDescriptorSubtype       : 0x06 (Extension Unit)
bUnitID                  : 0x04
guidExtensionCode        : {F6ACC829-ACDB-E511-8424-F39068F75511}
bNumControls             : 0x14
bNrInPins                : 0x01 (1 pins)
baSourceID[1]            : 0x03
bControlSize             : 0x03
bmControls               : 0x1F, 0x00, 0x0D
 D00                     : 1  yes -  Vendor-Specific (Optional)
 D01                     : 1  yes -  Vendor-Specific (Optional)
 D02                     : 1  yes -  Vendor-Specific (Optional)
 D03                     : 1  yes -  Vendor-Specific (Optional)
 D04                     : 1  yes -  Vendor-Specific (Optional)
 D05                     : 0   no -  Vendor-Specific (Optional)
 D06                     : 0   no -  Vendor-Specific (Optional)
 D07                     : 0   no -  Vendor-Specific (Optional)
 D08                     : 0   no -  Vendor-Specific (Optional)
 D09                     : 0   no -  Vendor-Specific (Optional)
 D10                     : 0   no -  Vendor-Specific (Optional)
 D11                     : 0   no -  Vendor-Specific (Optional)
 D12                     : 0   no -  Vendor-Specific (Optional)
 D13                     : 0   no -  Vendor-Specific (Optional)
 D14                     : 0   no -  Vendor-Specific (Optional)
 D15                     : 0   no -  Vendor-Specific (Optional)
 D16                     : 1  yes -  Vendor-Specific (Optional)
 D17                     : 0   no -  Vendor-Specific (Optional)
 D18                     : 1  yes -  Vendor-Specific (Optional)
 D19                     : 1  yes -  Vendor-Specific (Optional)
 D20                     : 0   no -  Vendor-Specific (Optional)
 D21                     : 0   no -  Vendor-Specific (Optional)
 D22                     : 0   no -  Vendor-Specific (Optional)
 D23                     : 0   no -  Vendor-Specific (Optional)
iExtension               : 0x00
Data (HexDump)           : 1C 24 06 04 29 C8 AC F6 DB AC 11 E5 84 24 F3 90   .$..)........$..
                           68 F7 55 11 14 01 03 03 1F 00 0D 00               h.U.........

输出终端描述符

    ------- Video Control Output Terminal Descriptor ------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x24 (Video Control Interface)
bDescriptorSubtype       : 0x03 (Output Terminal)
bTerminalID              : 0x05
wTerminalType            : 0x0101 (TT_STREAMING)
bAssocTerminal           : 0x00 (Not associated with an Input Terminal)
bSourceID                : 0x04
iTerminal                : 0x00
Data (HexDump)           : 09 24 03 05 01 01 00 04 00                        .$.......

接口描述符(第二个接口)

      ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x01
bAlternateSetting        : 0x00
bNumEndpoints            : 0x01 (1 Endpoint)
bInterfaceClass          : 0x0E (Video)
bInterfaceSubClass       : 0x02 (Video Streaming)
bInterfaceProtocol       : 0x00
iInterface               : 0x00 (No String Descriptor)
Data (HexDump)           : 09 04 01 00 01 0E 02 00 00                        .........

输入头描述符

---- VC-Specific VS Video Input Header Descriptor -----
bLength                  : 0x0E (14 bytes)
bDescriptorType          : 0x24 (Video Streaming Interface)
bDescriptorSubtype       : 0x01 (Input Header)
bNumFormats              : 0x01
wTotalLength             : 0x0089 (137 bytes)
bEndpointAddress         : 0x81 (Direction=IN  EndpointID=1)
bmInfo                   : 0x00 (Dynamic Format Change not supported)
bTerminalLink            : 0x05
bStillCaptureMethod      : 0x00 (No Still Capture)
nbTriggerSupport         : 0x00 (Hardware Triggering not supported)
bTriggerUsage            : 0x00 (Host will initiate still image capture)
nbControlSize            : 0x01
Video Payload Format 1   : 0x00
 D0                      : 0   no -  Key Frame Rate
 D1                      : 0   no -  P Frame Rate
 D2                      : 0   no -  Compression Quality
 D3                      : 0   no -  Compression Window Size
 D4                      : 0   no -  Generate Key Frame
 D5                      : 0   no -  Update Frame Segment
 D6                      : 0   no -  Reserved
 D7                      : 0   no -  Reserved
Data (HexDump)           : 0E 24 01 01 89 00 81 00 05 00 00 00 01 00         .$............
        ------- VS Uncompressed Format Type Descriptor --------
bLength                  : 0x1B (27 bytes)
bDescriptorType          : 0x24 (Video Streaming Interface)
bDescriptorSubtype       : 0x04 (Uncompressed Format Type)
bFormatIndex             : 0x01 (1)
bNumFrameDescriptors     : 0x03 (3)
guidFormat               : {32595559-0000-0010-8000-00AA00389B71} (YUY2)
bBitsPerPixel            : 0x10 (16 bits)
bDefaultFrameIndex       : 0x01 (1)
bAspectRatioX            : 0x00
bAspectRatioY            : 0x00
bmInterlaceFlags         : 0x00
 D0 IL stream or variable: 0 (no)
 D1 Fields per frame     : 0 (2 fields)
 D2 Field 1 first        : 0 (no)
 D3 Reserved             : 0
 D4..5 Field pattern     : 0 (Field 1 only)
 D6..7 Display Mode      : 0 (Bob only)
bCopyProtect             : 0x00 (No restrictions)
Data (HexDump)           : 1B 24 04 01 03 59 55 59 32 00 00 10 00 80 00 00   .$...YUY2.......
                           AA 00 38 9B 71 10 01 00 00 00 00                  ..8.q......
   -------- VS Uncompressed Frame Type Descriptor --------
        ---> This is the Default (optimum) Frame index
bLength                  : 0x1E (30 bytes)
bDescriptorType          : 0x24 (Video Streaming Interface)
bDescriptorSubtype       : 0x05 (Uncompressed Frame Type)
bFrameIndex              : 0x01
bmCapabilities           : 0x02
wWidth                   : 0x0780 (1920)
wHeight                  : 0x0438 (1080)
dwMinBitRate             : 0x3B538000 (995328000 bps -> 124.4 MB/s)
dwMaxBitRate             : 0x3B538000 (995328000 bps -> 124.4 MB/s)
dwMaxVideoFrameBufferSize: 0x003F4800 (4147200 bytes)
dwDefaultFrameInterval   : 0x00051615 (33.3333 ms -> 30.000 fps)
bFrameIntervalType       : 0x01 (1 discrete frame interval supported)
adwFrameInterval[1]      : 0x00051615 (33.3333 ms -> 30.000 fps)
Data (HexDump)           : 1E 24 05 01 02 80 07 38 04 00 80 53 3B 00 80 53   .$.....8...S;..S
                           3B 00 48 3F 00 15 16 05 00 01 15 16 05 00         ;.H?..........
        -------- VS Uncompressed Frame Type Descriptor --------
bLength                  : 0x1E (30 bytes)
bDescriptorType          : 0x24 (Video Streaming Interface)
bDescriptorSubtype       : 0x05 (Uncompressed Frame Type)
bFrameIndex              : 0x02
bmCapabilities           : 0x02
wWidth                   : 0x0500 (1280)
wHeight                  : 0x02D0 (720)
dwMinBitRate             : 0x1A5E0000 (442368000 bps -> 55.2 MB/s)
dwMaxBitRate             : 0x1A5E0000 (442368000 bps -> 55.2 MB/s)
dwMaxVideoFrameBufferSize: 0x001C2000 (1843200 bytes)
dwDefaultFrameInterval   : 0x00051615 (33.3333 ms -> 30.000 fps)
bFrameIntervalType       : 0x01 (1 discrete frame interval supported)
adwFrameInterval[1]      : 0x00051615 (33.3333 ms -> 30.000 fps)
Data (HexDump)           : 1E 24 05 02 02 00 05 D0 02 00 00 5E 1A 00 00 5E   .$.........^...^
                           1A 00 20 1C 00 15 16 05 00 01 15 16 05 00         .. ...........
        -------- VS Uncompressed Frame Type Descriptor --------
bLength                  : 0x1E (30 bytes)
bDescriptorType          : 0x24 (Video Streaming Interface)
bDescriptorSubtype       : 0x05 (Uncompressed Frame Type)
bFrameIndex              : 0x03
bmCapabilities           : 0x02
wWidth                   : 0x0280 (640)
wHeight                  : 0x0168 (360)
dwMinBitRate             : 0x06978000 (110592000 bps -> 13.8 MB/s)
dwMaxBitRate             : 0x06978000 (110592000 bps -> 13.8 MB/s)
dwMaxVideoFrameBufferSize: 0x00070800 (460800 bytes)
dwDefaultFrameInterval   : 0x00051615 (33.3333 ms -> 30.000 fps)
bFrameIntervalType       : 0x01 (1 discrete frame interval supported)
adwFrameInterval[1]      : 0x00051615 (33.3333 ms -> 30.000 fps)
Data (HexDump)           : 1E 24 05 03 02 80 02 68 01 00 80 97 06 00 80 97   .$.....h........
                           06 00 08 07 00 15 16 05 00 01 15 16 05 00         ..............
        ------- VS Color Matching Descriptor Descriptor -------
bLength                  : 0x06 (6 bytes)
bDescriptorType          : 0x24 (Video Streaming Interface)
bDescriptorSubtype       : 0x0D (Color Matching)
bColorPrimaries          : 0x01 (BT.709, sRGB)
bTransferCharacteristics : 0x07 (sRGB)
bMatrixCoefficients      : 0x04 (SMPTE 170M)
Data (HexDump)           : 06 24 0D 01 07 04                                 .$....
        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x81 (Direction=IN EndpointID=1)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0400 (max 1024 bytes)
bInterval                : 0x00 (never NAKs)
Data (HexDump)           : 07 05 81 02 00 04 00                              .......
       ------ SuperSpeed Endpoint Companion Descriptor -------
bLength                  : 0x06 (6 bytes)
bDescriptorType          : 0x30 (SuperSpeed Endpoint Companion Descriptor)
bMaxBurst                : 0x0F (up to 16 packets per burst)
bmAttributes             : 0x00 (The bulk endpoint does not define streams)
wBytesPerInterval        : 0x0000
Data (HexDump)           : 06 30 0F 00 00 00                                 .0....
作者使用windows开发UVC摄像头驱动,欢迎加入字节流官方QQ群:952873936或联系站长进行技术交流。
字节流是站长多年来的工作经验和技术总结,和站长一起学习,每天都有进步。
微信公众号
字节流公众号  字节流QQ群:952873936
取消
感谢您的支持,我会继续努力的!
扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

Powered by bytekits.com,汇天下文字,成非凡梦想!!!