USB UVC协议分析

USB描述符分析软件 USB Device Viewer、USBlyzer、BusHound。

#define USB_DT_DEVICE 0x01

#define USB_DT_CONFIG          0x02

#define USB_DT_STRING          0x03

#define USB_DT_INTERFACE        0x04

#define USB_DT_ENDPOINT        0x05

#define USB_TYPE_CLASS (0x01 << 5)

#define USB_DT_CS_DEVICE        (USB_TYPE_CLASS | USB_DT_DEVICE)

#define USB_DT_CS_CONFIG        (USB_TYPE_CLASS | USB_DT_CONFIG)

#define USB_DT_CS_STRING        (USB_TYPE_CLASS | USB_DT_STRING)

#define USB_DT_CS_INTERFACE    (USB_TYPE_CLASS | USB_DT_INTERFACE) //0x24

#define USB_DT_CS_ENDPOINT      (USB_TYPE_CLASS | USB_DT_ENDPOINT) //0x25

UVC_VC_DESCRIPTOR_UNDEFINED 0x00

UVC_VC_HEADER 0x01

UVC_VC_INPUT_TERMINAL 0x02

UVC_VC_OUTPUT_TERMINAL 0x03

UVC_VC_SELECTOR_UNIT 0x04

UVC_VC_PROCESSING_UNIT 0x05

UVC_VC_EXTENSION_UNIT 0x06

UVC_VS_UNDEFINED                0x00

UVC_VS_INPUT_HEADER            0x01

UVC_VS_OUTPUT_HEADER                0x02

UVC_VS_STILL_IMAGE_FRAME            0x03

UVC_VS_FORMAT_UNCOMPRESSED          0x04

UVC_VS_FRAME_UNCOMPRESSED          0x05

UVC_VS_FORMAT_MJPEG            0x06

UVC_VS_FRAME_MJPEG              0x07

UVC_VS_FORMAT_MPEG2TS              0x0a

UVC_VS_FORMAT_DV                0x0c

UVC_VS_COLORFORMAT              0x0d

UVC_VS_FORMAT_FRAME_BASED          0x10

UVC_VS_FRAME_FRAME_BASED            0x11

UVC_VS_FORMAT_STREAM_BASED          0x12

SC_UNDEFINED 0x00

SC_VIDEOCONTROL 0x01

SC_VIDEOSTREAMING 0x02

SC_VIDEO_INTERFACE_COLLECTION 0x03

USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */

USB_CLASS_AUDIO        1

USB_CLASS_COMM          2

USB_CLASS_HID          3

USB_CLASS_PHYSICAL      5

USB_CLASS_STILL_IMAGE      6

USB_CLASS_PRINTER      7

USB_CLASS_MASS_STORAGE      8

USB_CLASS_HUB          9

USB_CLASS_CDC_DATA      0x0a

USB_CLASS_CSCID        0x0b    /* chip+ smart card */

USB_CLASS_CONTENT_SEC      0x0d    /* content security */

USB_CLASS_VIDEO        0x0e

USB_CLASS_WIRELESS_CONTROLLER  0xe0

USB_CLASS_MISC          0xef

USB_CLASS_APP_SPEC      0xfe

USB_CLASS_VENDOR_SPEC      0xff

USB_SUBCLASS_VENDOR_SPEC    0xff

UVC1.0 Device Phase Data

以下为UVC1.0设备枚举过程中采集的描述符:

09 02 09 01 02 01 04 c0 fa Configuration Descriptor

08 0b 00 02 0e 03 00 05 Standard Video Interface Collection IAD

09 04 00 00 01 0e 01 00 05 Interface Descriptor(VC)

0d 24 01 00 01 33 00 00 6c dc 02 01 01 <<< Class-specific VC Interface Header Descriptor(total 0x33)

12 24 02 01 01 02 00 00 00 00 00 00 00 00 03 02 00 00 InputTerminal Descriptor

0b 24 05 02 01 00 40 02 01 00 00 Processing Unit Descriptor

09 24 03 03 01 01 00 02 00 Output Terminal Descriptor >>>

07 05 84 03 10 00 08 Endpoint Descriptor

05 25 03 10 00 Class-specific VC Interrupt Endpoint Descriptor

09 04 01 00 00 0e 02 00 06 Interface Descriptor(VS)

0e 24 01 01 97 00 83 00 03 00 00 00 01 00 <<< Class-specific VS Interface Input Header Descriptor(total 0x97, 1 format)

0b 24 06 01 04 00 01 00 00 00 00 Motion-JPEG Video Format Descriptor

1e 24 07 01 00 80 07 38 04 00 00 5e 1a 00 00 5e 1a 00 48 3f 00 15 16 05 00 01 15 16 05 00 Motion-JPEG Video Frame Descriptor

1e 24 07 01 00 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 Motion-JPEG Video Frame Descriptor

1e 24 07 01 00 80 02 e0 01 00 00 5e 1a 00 00 5e 1a 00 60 09 00 15 16 05 00 01 15 16 05 00 Motion-JPEG Video Frame Descriptor

1e 24 07 01 00 80 02 68 01 00 00 5e 1a 00 00 5e 1a 00 46 05 00 15 16 05 00 01 15 16 05 00 Motion-JPEG Video Frame Descriptor

06 24 0d 01 01 04 Color Matching Descriptor >>>

09 04 01 01 01 0e 02 00 06 Interface Descriptor

07 05 83 05 00 04 01 Endpoint Descriptor


UVC1.1 Device Phase Data 

09 02 43 02 02 01 04 c0 01 Configuration Descriptor

09 04 00 00 01 0e 01 00 05 Interface Descriptor(VC)

0d 24 01 10 01 6a 00 00 6c dc 02 01 01 <<< Class-specific VC Interface Header Descriptor(total 0x6a, till output terminal)

12 24 02 01 01 02 00 00 00 00 00 00 00 00 03 00 00 00 InputTerminal Descriptor

0c 24 05 02 01 00 40 02 df 14 00 09 Processing Unit Descriptor

1b 24 06 0a 41 76 9e a2 04 de e3 47 8b 2b f4 34 1a ff 00 3b 0f 01 02 02 ff ff 00 Extension Unit Descriptor

1b 24 06 11 91 72 1e 9a 43 68 83 46 6d 92 39 bc 79 06 ee 49 0f 01 0a 02 ff ff 00 Extension Unit Descriptor

09 24 03 03 01 01 00 11 00 Output Terminal Descriptor >>>

07 05 83 03 10 00 08 Endpoint Descriptor(Interrupt)

05 25 03 10 00 Class-specific VC Interrupt Endpoint Descriptor

09 04 01 00 00 0e 02 00 06 Interface Descriptor(VS)

10 24 01 03 a2 01 81 00 03 00 00 00 01 00 00 00 <<<  Class-specific VS Interface Input Header Descriptor(OutTerminalId 03, total 0x01a2, till color macthing)

0b 24 06 01 04 00 01 00 00 00 00 UNCOMPRESSED Video Format Descriptor

1e 24 07 01 00 80 07 38 04 00 00 71 02 00 00 71 02 00 48 3f 00 15 16 05 00 01 15 16 05 00 UNCOMPRESSED Video Frame Descriptor

1e 24 07 02 00 00 05 d0 02 00 80 38 01 00 80 38 01 00 20 1c 00 15 16 05 00 01 15 16 05 00 UNCOMPRESSED Video Frame Descriptor

1e 24 07 03 00 80 02 e0 01 00 40 9c 00 00 40 9c 00 00 60 09 00 15 16 05 00 01 15 16 05 00 UNCOMPRESSED Video Frame Descriptor

1e 24 07 04 00 80 02 68 01 00 40 9c 00 00 40 9c 00 00 08 07 00 15 16 05 00 01 15 16 05 00 UNCOMPRESSED Video Frame Descriptor

1b 24 04 02 03 59 55 59 32 00 00 10 00 80 00 00 aa 00 38 9b 71 10 01 00 00 00 00 MJPEG Video Format Descriptor

1e 24 05 01 00 00 05 d0 02 00 00 c2 01 00 00 c2 01 00 20 1c 00 40 42 0f 00 01 40 42 0f 00 MJPEG Video Frame Descriptor

1e 24 05 02 00 80 02 e0 01 00 c0 4b 03 00 c0 4b 03 00 60 09 00 15 16 05 00 01 15 16 05 00 MJPEG Video Frame Descriptor

1e 24 05 03 00 80 02 68 01 00 c0 4b 03 00 c0 4b 03 00 08 07 00 15 16 05 00 01 15 16 05 00 MJPEG Video Frame Descriptor

1c 24 10 03 04 48 32 36 34 00 00 10 00 80 00 00 aa 00 38 9b 71 10 01 00 00 00 00 01 FRAME_BASED Video Format Descriptor

1e 24 11 01 00 80 07 38 04 00 60 ea 00 00 60 ea 00 15 16 05 00 01 00 00 00 00 15 16 05 00 FRAME_BASED Video Frame Descriptor

1e 24 11 02 00 00 05 d0 02 00 40 9c 00 00 40 9c 00 15 16 05 00 01 00 00 00 00 15 16 05 00 FRAME_BASED Video Frame Descriptor

1e 24 11 03 00 80 02 e0 01 00 00 7d 00 00 00 7d 00 15 16 05 00 01 00 00 00 00 15 16 05 00 FRAME_BASED Video Frame Descriptor

1e 24 11 04 00 80 02 68 01 00 00 7d 00 00 00 7d 00 15 16 05 00 01 00 00 00 00 15 16 05 00 FRAME_BASED Video Frame Descriptor

06 24 0d 01 01 04 Color Matching Descriptor >>>

09 04 01 01 01 0e 02 00 06 Interface Descriptor

07 05 81 05 00 14 01 Endpoint Descriptor(ISO)


#define UVC_PU_CONTROL_UNDEFINED 0x00

#define UVC_PU_BACKLIGHT_COMPENSATION_CONTROL      0x01

#define UVC_PU_BRIGHTNESS_CONTROL          0x02

#define UVC_PU_CONTRAST_CONTROL            0x03

#define UVC_PU_GAIN_CONTROL            0x04

#define UVC_PU_POWER_LINE_FREQUENCY_CONTROL    0x05

#define UVC_PU_HUE_CONTROL              0x06

#define UVC_PU_SATURATION_CONTROL          0x07

#define UVC_PU_SHARPNESS_CONTROL            0x08

#define UVC_PU_GAMMA_CONTROL                0x09

#define UVC_PU_WHITE_BALANCE_TEMPERATURE_CONTROL    0x0a

#define UVC_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL  0x0b

#define UVC_PU_WHITE_BALANCE_COMPONENT_CONTROL      0x0c

#define UVC_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL 0x0d

#define UVC_PU_DIGITAL_MULTIPLIER_CONTROL      0x0e

#define UVC_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL    0x0f

#define UVC_PU_HUE_AUTO_CONTROL            0x10

#define UVC_PU_ANALOG_VIDEO_STANDARD_CONTROL        0x11

#define UVC_PU_ANALOG_LOCK_STATUS_CONTROL      0x12


GET_INFO请求用于获取设备支持的特定请求。

GET_INFO的具体使用,可参见:处理单元特定类请求示例一节。

使用此请求获取设备支持的特定请求属性时,wLength字段为1,其返回值各位代表的含义见下表:

位描述位状态

D0  1=Supports GET value requestsCapability

D1  1=Supports SET value requestsCapability

D2  1=Disabled due to automatic mode(under device control)State

D3  1=Autoupdate ControlCapability

D4  1=Asynchronous ControlCapability

D5  1=Disabled due to incompatibility with Commit state.State

D7..D6保留,置为0


USB UVC协议分析_第1张图片

你可能感兴趣的:(USB UVC协议分析)