云服务器

商务合作:179001057@qq.com

UVC 摄像头驱动(二)描述符分析

xiaoxiao2021-11-25  6


某平台价值19860元的编程课程资料免费领取【点我领取】


 

UVC 摄像头驱动(二)描述符分析

http://blog.csdn.net/lizuobin2/ https://blog.csdn.net/lizuobin2/article/details/53149583

  当一个 usb 设备接入时,usb 主机控制器会与设备交互,读取出设备的所有的描述符,并且调用相应 usb_driver 的 probe 函数,同时传入一个接口的指针,因为一个接口代表一个逻辑上的 usb 设备。如果 usb 设备含有多个接口,同时都被这个 usb_driver 支持的话,probe 函数就会被调用多次。    对于一个 usb 设备来说,首先它有一个设备描述符,一个设备可能会拥有多个配置,每一个配置都拥有一个配置描述符,配置可以理解成多个接口的组合。那么一个配置会拥有多个接口,每一个接口会拥有一个接口描述符,同时一个接口又会有多个设置,设置可以理解成多个端点的组合,每一个端点拥有一个端点描述符。关于详细的设备、配置、接口、设置、端点之间的关系请参考我之前的文章《USB驱动——设备、配置、接口、设置、端点之前的关系以及它们的获取过程分析》那么对于 usb video class 它在标准的 usb 协议上进行了扩展,扩展的部分称为 class specific ,完整的关系如下图所示: 

  在 UVC 1.5 Class specification 的第三章,有专门对 UVC 的描述符进行解释,在第 3.1 节,给出了一个完整uvc设备描述符的布局如下图所示: 

其中,Device 等白色的描述符为标准描述符,灰色是 class specific 描述符。

 

IAD Interface Association Descriptor

  一个设备需要用一个联合接口描述符(IAD)来描述一个视频接口集合,对于每一个设备功能需要一个视频控制接口(VideoControl Interface)和一个或者多个视频流接口(VideoStreaming Interface)。标准的视频接口联合描述符和标准接口联合描述符定义相同。在代码中,它体现在“配置”中。

struct usb_host_config { struct usb_config_descriptor desc; // 配置描述符 char *string; struct usb_interface_assoc_descriptor *intf_assoc[USB_MAXIADS];//IAD struct usb_interface *interface[USB_MAXINTERFACES]; // 接口 struct usb_interface_cache *intf_cache[USB_MAXINTERFACES]; unsigned char *extra; int extralen; }; 12345678910

那么这个联合接口描述符(IAD)有什么含义呢? 

举例:

 

Interface Association: bLength 8 bDescriptorType 11 bFirstInterface 0 bInterfaceCount 2 bFunctionClass 14 Video bFunctionSubClass 3 Video Interface Collection bFunctionProtocol 0 iFunction 123456789

该接口联合描述符中表明了,它是两个接口的集合,起始接口为 0 ,其实没啥意义。大致可以知道是一个控制接口和一个流接口。

VideoControl Interface Descriptors

 

  它包含两部分,一个是白色标准视频控制接口描述符,其余的灰色是UVC类特殊的视频控制接口描述符。

 

Standard VC Interface Descriptor

  标准 VC 接口描述符和标准接口描述符的定义是一样的,定义在 section 9.6.5 “Interface” of USB Specification Revision 2.0 。代码中,它包含在接口的设置里。

struct usb_host_interface { struct usb_interface_descriptor desc; // 接口描述符 struct usb_host_endpoint *endpoint; char *string; /* iInterface string, if present */ unsigned char *extra; /* Class-Specific VC Interface Descriptor */ int extralen; }; 1234567

 

举例:

 

Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 14 Video bInterfaceSubClass 1 Video Control bInterfaceProtocol 0 iInterface 2 12345678910

主要信息:这是第0号接口,是一个 video_control 接口。

Class-Specific VC Interface Descriptor

  UVC 类特殊接口描述符是一连串的描述符,它包含了所有用来描述设备功能的描述符,比如 unit 和 terminal 描述符。它和标准接口描述符为与同一个结构体里。

struct usb_host_interface { struct usb_interface_descriptor desc; // 接口描述符 struct usb_host_endpoint *endpoint; char *string; /* iInterface string, if present */ unsigned char *extra; /* Class-Specific VC Interface Descriptor */ int extralen; /* lenth of Class-Specific VC Interface Descriptor */ }; 1234567

举例:

VideoControl Interface Descriptor: bLength 13 bDescriptorType 36 bDescriptorSubtype 1 (HEADER) bcdUVC 1.00 wTotalLength 109 dwClockFrequency 48.000000MHz bInCollection 1 baInterfaceNr( 0) 1 VideoControl Interface Descriptor: bLength 18 bDescriptorType 36 bDescriptorSubtype 2 (INPUT_TERMINAL) bTerminalID 1 wTerminalType 0x0201 Camera Sensor bAssocTerminal 0 iTerminal 0 wObjectiveFocalLengthMin 0 wObjectiveFocalLengthMax 0 wOcularFocalLength 0 bControlSize 3 bmControls 0x00000006 Auto-Exposure Mode Auto-Exposure Priority VideoControl Interface Descriptor: bLength 11 bDescriptorType 36 bDescriptorSubtype 5 (PROCESSING_UNIT) Warning: Descriptor too short bUnitID 2 bSourceID 1 wMaxMultiplier 16384 bControlSize 2 bmControls 0x0000153f Brightness Contrast Hue Saturation Sharpness Gamma Backlight Compensation Power Line Frequency White Balance Temperature, Auto iProcessing 0 bmVideoStandards 0x1d None PAL - 625/50 SECAM - 625/50 NTSC - 625/50 VideoControl Interface Descriptor: bLength 29 bDescriptorType 36 bDescriptorSubtype 6 (EXTENSION_UNIT) bUnitID 3 guidExtensionCode {82066163-7050-ab49-b8cc-b3855e8d221d} bNumControl 0 bNrPins 1 baSourceID( 0) 2 bControlSize 4 bmControls( 0) 0xff bmControls( 1) 0xff bmControls( 2) 0x1d bmControls( 3) 0x00 iExtension 0 VideoControl Interface Descriptor: bLength 29 bDescriptorType 36 bDescriptorSubtype 6 (EXTENSION_UNIT) bUnitID 4 guidExtensionCode {64e7c624-515f-7e43-9089-28ffa487bdca} bNumControl 0 bNrPins 1 baSourceID( 0) 3 bControlSize 4 bmControls( 0) 0x0f bmControls( 1) 0x00 bmControls( 2) 0x00 bmControls( 3) 0x00 iExtension 0 VideoControl Interface Descriptor: bLength 9 bDescriptorType 36 bDescriptorSubtype 3 (OUTPUT_TERMINAL) bTerminalID 5 wTerminalType 0x0101 USB Streaming bAssocTerminal 0 bSourceID 4 iTerminal 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x87 EP 7 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0010 1x 16 bytes bInterval 8 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798

  根据上面的信息,控制接口描述符有很多子类,前面在摄像头硬件描述中,我们说在控制接口中抽象出了两个概念,一个是 unit 另一个 terminal ,unit 和 terminal 的信息就包含在这些描述符信息中了。它们直连的链接关系可以通过描述符中的 bSourceID 或者 baSourceID 来分析,比如这款摄像头,它的硬件模型就是:    IT -> PU ->EU -> EU ->OT 具体的描述符含义,参考 UVC 1.5 Class specification Table 3-3 到 3-10 .这里只分析一下 header 描述符。 

  在 header 描述符的第11位,bInCollection 指出了该设备拥有的VS接口的数量,从第12位起,是每一个 VS 接口的接口号。

 

VC Interrupt Endpoint Descriptors

中断端点描述符也分为标准中断端点描述符和UVC类特殊的中断端点描述符

Standard VC Interrupt Endpoint DescriptorClass-specific VC Interrupt Endpoint Descriptor

它们在代码中位于 “端点”中:

struct usb_host_endpoint { struct usb_endpoint_descriptor desc; // 端点描述符 struct list_head urb_list; // 该端点的 urb 队列 void *hcpriv; struct ep_device *ep_dev; /* For sysfs info */ struct usb_host_ss_ep_comp *ss_ep_comp; /* For SS devices */ unsigned char *extra;/* Class-specific VC Interrupt Endpoint Descriptor */ int extralen;/* lenth of Class-specific VC Interrupt Endpoint Descriptor */ int enabled; }; 12345678910

具体的定义与说明参考:    UVC 1.5 Class specification Table 3-11    UVC 1.5 Class specification Table 3-12

VideoStreaming Interface Descriptors

 

视频流接口描述符包含了所有用来描述视频流接口特性的相关信息。

 

Standard VS Interface Descriptor

  标准视频流接口描述符和标准接口描述符的定义相同,在section 9.6.5 “Interface” of USB Specification Revision 2.0 or USB Specification Revision 3.0 中定义. 

举例:

 

Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 0 bNumEndpoints 0 bInterfaceClass 14 Video bInterfaceSubClass 2 Video Streaming bInterfaceProtocol 0 iInterface 0 12345678910

主要信息,它是第1号接口,接口类型是 video_streaming

Class-Specific VS Interface Descriptors

  UVC 类特殊视频流接口由 input header 、oupt header 、format 和 frame 描述符组成,每一个视频流接口都有一个单独的 input 或者 output header 描述符,对于它支持的每一个 format 都有一个单独的 format 描述符,对于每一个 format 描述符如果需要的话会包含多个 frame 描述符。format 和 frame 描述符仅仅会定义在接口的第0号设置中。  定义参考:    Table 3-14 Class-specific VS Interface Input Header Descriptor    USB_Video_Payload_Uncompressed_1.5    USB_Video_Payload_MJPEG_1.5    USB_Video_Payload_Frame_Based_1.5  举例:

VideoStreaming Interface Descriptor: bLength 15 bDescriptorType 36 bDescriptorSubtype 1 (INPUT_HEADER) bNumFormats 2 wTotalLength 525 bEndPointAddress 129 bmInfo 0 bTerminalLink 5 bStillCaptureMethod 1 bTriggerSupport 1 bTriggerUsage 0 bControlSize 1 bmaControls( 0) 27 bmaControls( 1) 27 VideoStreaming Interface Descriptor: bLength 27 bDescriptorType 36 bDescriptorSubtype 4 (FORMAT_UNCOMPRESSED) bFormatIndex 1 bNumFrameDescriptors 7 guidFormat {59555932-0000-1000-8000-00aa00389b71} bBitsPerPixel 16 bDefaultFrameIndex 1 bAspectRatioX 0 bAspectRatioY 0 bmInterlaceFlags 0x00 Interlaced stream or variable: No Fields per frame: 2 fields Field 1 first: No Field pattern: Field 1 only bCopyProtect 0 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 5 (FRAME_UNCOMPRESSED) bFrameIndex 1 bmCapabilities 0x01 Still image supported wWidth 640 wHeight 480 dwMinBitRate 73728000 dwMaxBitRate 147456000 dwMaxVideoFrameBufferSize 614400 dwDefaultFrameInterval 333333 bFrameIntervalType 2 dwFrameInterval( 0) 333333 dwFrameInterval( 1) 666666 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 5 (FRAME_UNCOMPRESSED) bFrameIndex 2 bmCapabilities 0x01 Still image supported wWidth 160 wHeight 120 dwMinBitRate 4608000 dwMaxBitRate 9216000 dwMaxVideoFrameBufferSize 38400 dwDefaultFrameInterval 333333 bFrameIntervalType 2 dwFrameInterval( 0) 333333 dwFrameInterval( 1) 666666 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 5 (FRAME_UNCOMPRESSED) bFrameIndex 3 bmCapabilities 0x01 Still image supported wWidth 176 wHeight 144 dwMinBitRate 6082560 dwMaxBitRate 12165120 dwMaxVideoFrameBufferSize 50688 dwDefaultFrameInterval 333333 bFrameIntervalType 2 dwFrameInterval( 0) 333333 dwFrameInterval( 1) 666666 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 5 (FRAME_UNCOMPRESSED) bFrameIndex 4 bmCapabilities 0x01 Still image supported wWidth 320 wHeight 240 dwMinBitRate 18432000 dwMaxBitRate 36864000 dwMaxVideoFrameBufferSize 153600 dwDefaultFrameInterval 333333 bFrameIntervalType 2 dwFrameInterval( 0) 333333 dwFrameInterval( 1) 666666 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 5 (FRAME_UNCOMPRESSED) bFrameIndex 5 bmCapabilities 0x01 Still image supported wWidth 352 wHeight 288 dwMinBitRate 24330240 dwMaxBitRate 48660480 dwMaxVideoFrameBufferSize 202752 dwDefaultFrameInterval 333333 bFrameIntervalType 2 dwFrameInterval( 0) 333333 dwFrameInterval( 1) 666666 VideoStreaming Interface Descriptor: bLength 30 bDescriptorType 36 bDescriptorSubtype 5 (FRAME_UNCOMPRESSED) bFrameIndex 6 bmCapabilities 0x01 Still image supported wWidth 1280 wHeight 720 dwMinBitRate 147456000 dwMaxBitRate 147456000 dwMaxVideoFrameBufferSize 1843200 dwDefaultFrameInterval 1000000 bFrameIntervalType 1 dwFrameInterval( 0) 1000000 VideoStreaming Interface Descriptor: bLength 30 bDescriptorType 36 bDescriptorSubtype 5 (FRAME_UNCOMPRESSED) bFrameIndex 7 bmCapabilities 0x01 Still image supported wWidth 1280 wHeight 800 dwMinBitRate 163840000 dwMaxBitRate 163840000 dwMaxVideoFrameBufferSize 2048000 dwDefaultFrameInterval 1000000 bFrameIntervalType 1 dwFrameInterval( 0) 1000000 VideoStreaming Interface Descriptor: bLength 6 bDescriptorType 36 bDescriptorSubtype 13 (COLORFORMAT) bColorPrimaries 1 (BT.709,sRGB) bTransferCharacteristics 1 (BT.709) bMatrixCoefficients 4 (SMPTE 170M (BT.601)) VideoStreaming Interface Descriptor: bLength 11 bDescriptorType 36 bDescriptorSubtype 6 (FORMAT_MJPEG) bFormatIndex 2 bNumFrameDescriptors 7 bFlags 1 Fixed-size samples: Yes bDefaultFrameIndex 1 bAspectRatioX 0 bAspectRatioY 0 bmInterlaceFlags 0x00 Interlaced stream or variable: No Fields per frame: 1 fields Field 1 first: No Field pattern: Field 1 only bCopyProtect 0 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 7 (FRAME_MJPEG) bFrameIndex 1 bmCapabilities 0x01 Still image supported wWidth 640 wHeight 480 dwMinBitRate 73728000 dwMaxBitRate 147456000 dwMaxVideoFrameBufferSize 614400 dwDefaultFrameInterval 333333 bFrameIntervalType 2 dwFrameInterval( 0) 333333 dwFrameInterval( 1) 666666 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 7 (FRAME_MJPEG) bFrameIndex 2 bmCapabilities 0x01 Still image supported wWidth 160 wHeight 120 dwMinBitRate 4608000 dwMaxBitRate 9216000 dwMaxVideoFrameBufferSize 38400 dwDefaultFrameInterval 333333 bFrameIntervalType 2 dwFrameInterval( 0) 333333 dwFrameInterval( 1) 666666 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 7 (FRAME_MJPEG) bFrameIndex 3 bmCapabilities 0x01 Still image supported wWidth 176 wHeight 144 dwMinBitRate 6082560 dwMaxBitRate 12165120 dwMaxVideoFrameBufferSize 50688 dwDefaultFrameInterval 333333 bFrameIntervalType 2 dwFrameInterval( 0) 333333 dwFrameInterval( 1) 666666 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 7 (FRAME_MJPEG) bFrameIndex 4 bmCapabilities 0x01 Still image supported wWidth 320 wHeight 240 dwMinBitRate 18432000 dwMaxBitRate 36864000 dwMaxVideoFrameBufferSize 153600 dwDefaultFrameInterval 333333 bFrameIntervalType 2 dwFrameInterval( 0) 333333 dwFrameInterval( 1) 666666 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 7 (FRAME_MJPEG) bFrameIndex 5 bmCapabilities 0x01 Still image supported wWidth 352 wHeight 288 dwMinBitRate 24330240 dwMaxBitRate 48660480 dwMaxVideoFrameBufferSize 202752 dwDefaultFrameInterval 333333 bFrameIntervalType 2 dwFrameInterval( 0) 333333 dwFrameInterval( 1) 666666 VideoStreaming Interface Descriptor: bLength 30 bDescriptorType 36 bDescriptorSubtype 7 (FRAME_MJPEG) bFrameIndex 6 bmCapabilities 0x01 Still image supported wWidth 1280 wHeight 720 dwMinBitRate 442368000 dwMaxBitRate 442368000 dwMaxVideoFrameBufferSize 1843200 dwDefaultFrameInterval 333333 bFrameIntervalType 1 dwFrameInterval( 0) 333333 VideoStreaming Interface Descriptor: bLength 30 bDescriptorType 36 bDescriptorSubtype 7 (FRAME_MJPEG) bFrameIndex 7 bmCapabilities 0x01 Still image supported wWidth 1280 wHeight 800 dwMinBitRate 491520000 dwMaxBitRate 491520000 dwMaxVideoFrameBufferSize 2048000 dwDefaultFrameInterval 333333 bFrameIntervalType 1 dwFrameInterval( 0) 333333 VideoStreaming Interface Descriptor: bLength 6 bDescriptorType 36 bDescriptorSubtype 13 (COLORFORMAT) bColorPrimaries 1 (BT.709,sRGB) bTransferCharacteristics 1 (BT.709) bMatrixCoefficients 4 (SMPTE 170M (BT.601)) 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283

  可以看到,这款摄像头支持两种 format 一种是未压缩的,另一种是压缩的 MJPEG ,对于每一个 format 下面又有多个 frame ,frame 的区别比如像素大小。

VideoStreaming Endpoint Descriptors

  The following sections describe all possible endpoint-related descriptors for the VideoStreaming  interface.

VS Video Data Endpoint Descriptors

Standard VS Isochronous Video Data Endpoint Descriptor

  Table 3-20 Standard VS Isochronous Video Data Endpoint Descriptor

Standard VS Bulk Video Data Endpoint Descriptor

  Table 3-21 Standard VS Bulk Video Data Endpoint Descriptor

VS Bulk Still Image Data Endpoint Descriptors

Standard VS Bulk Still Image Data Endpoint Descriptor

  Table 3-22 Standard VS Bulk Still Image Data Endpoint Descriptor

打印描述符

  根据上述的分析过程,我们可以把所有的描述符信息打印出来,前面举例是lsusb 打印出来的信息,那么,为了方便,我们可以参考 lsusb 的源码来写打印程序。

#include <linux/kernel.h> #include <linux/list.h> #include <linux/module.h> #include <linux/usb.h> #include <linux/videodev2.h> #include <linux/vmalloc.h> #include <linux/wait.h> #include <asm/atomic.h> #include <asm/unaligned.h> #include <media/v4l2-common.h> static const char *get_guid(const unsigned char *buf) { static char guid[39]; /* NOTE: see RFC 4122 for more information about GUID/UUID * structure. The first fields fields are historically big * endian numbers, dating from Apollo mc68000 workstations. */ sprintf(guid, "{xxxx" "-xx" "-xx" "-xx" "-xxxxxx}", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7], buf[8], buf[9], buf[10], buf[11], buf[12], buf[13], buf[14], buf[15]); return guid; } static void parse_videocontrol_interface(struct usb_interface *intf, unsigned char *buf, int buflen) { static const char * const ctrlnames[] = { "Brightness", "Contrast", "Hue", "Saturation", "Sharpness", "Gamma", "White Balance Temperature", "White Balance Component", "Backlight Compensation", "Gain", "Power Line Frequency", "Hue, Auto", "White Balance Temperature, Auto", "White Balance Component, Auto", "Digital Multiplier", "Digital Multiplier Limit", "Analog Video Standard", "Analog Video Lock Status" }; static const char * const camctrlnames[] = { "Scanning Mode", "Auto-Exposure Mode", "Auto-Exposure Priority", "Exposure Time (Absolute)", "Exposure Time (Relative)", "Focus (Absolute)", "Focus (Relative)", "Iris (Absolute)", "Iris (Relative)", "Zoom (Absolute)", "Zoom (Relative)", "PanTilt (Absolute)", "PanTilt (Relative)", "Roll (Absolute)", "Roll (Relative)", "Reserved", "Reserved", "Focus, Auto", "Privacy" }; static const char * const stdnames[] = { "None", "NTSC - 525/60", "PAL - 625/50", "SECAM - 625/50", "NTSC - 625/50", "PAL - 525/60" }; unsigned int i, ctrls, stds, n, p, termt, freq; while (buflen > 0) { if (buf[1] != USB_DT_CS_INTERFACE) printk(" Warning: Invalid descriptor\n"); else if (buf[0] < 3) printk(" Warning: Descriptor too short\n"); printk(" VideoControl Interface Descriptor:\n" " bLength %5u\n" " bDescriptorType %5u\n" " bDescriptorSubtype %5u ", buf[0], buf[1], buf[2]); switch (buf[2]) { case 0x01: /* HEADER */ printk("(HEADER)\n"); n = buf[11]; if (buf[0] < 12+n) printk(" Warning: Descriptor too short\n"); freq = buf[7] | (buf[8] << 8) | (buf[9] << 16) | (buf[10] << 24); printk(" bcdUVC %2x.x\n" " wTotalLength %5u\n" " dwClockFrequency %5u.uMHz\n" " bInCollection %5u\n", buf[4], buf[3], buf[5] | (buf[6] << 8), freq / 1000000, freq % 1000000, n); for (i = 0; i < n; i++) printk(" baInterfaceNr(%2u) %5u\n", i, buf[12+i]); break; case 0x02: /* INPUT_TERMINAL */ printk("(INPUT_TERMINAL)\n"); termt = buf[4] | (buf[5] << 8); n = termt == 0x0201 ? 7 : 0; if (buf[0] < 8 + n) printk(" Warning: Descriptor too short\n"); printk(" bTerminalID %5u\n" " wTerminalType 0xx\n" " bAssocTerminal %5u\n", buf[3], termt, buf[6]); printk(" iTerminal %5u\n", buf[7]); if (termt == 0x0201) { n += buf[14]; printk(" wObjectiveFocalLengthMin %5u\n" " wObjectiveFocalLengthMax %5u\n" " wOcularFocalLength %5u\n" " bControlSize %5u\n", buf[8] | (buf[9] << 8), buf[10] | (buf[11] << 8), buf[12] | (buf[13] << 8), buf[14]); ctrls = 0; for (i = 0; i < 3 && i < buf[14]; i++) ctrls = (ctrls << 8) | buf[8+n-i-1]; printk(" bmControls 0xx\n", ctrls); for (i = 0; i < 19; i++) if ((ctrls >> i) & 1) printk(" %s\n", camctrlnames[i]); } break; case 0x03: /* OUTPUT_TERMINAL */ printk("(OUTPUT_TERMINAL)\n"); termt = buf[4] | (buf[5] << 8); if (buf[0] < 9) printk(" Warning: Descriptor too short\n"); printk(" bTerminalID %5u\n" " wTerminalType 0xx\n" " bAssocTerminal %5u\n" " bSourceID %5u\n" " iTerminal %5u\n", buf[3], termt, buf[6], buf[7], buf[8]); break; case 0x04: /* SELECTOR_UNIT */ printk("(SELECTOR_UNIT)\n"); p = buf[4]; if (buf[0] < 6+p) printk(" Warning: Descriptor too short\n"); printk(" bUnitID %5u\n" " bNrInPins %5u\n", buf[3], p); for (i = 0; i < p; i++) printk(" baSource(%2u) %5u\n", i, buf[5+i]); printk(" iSelector %5u\n", buf[5+p]); break; case 0x05: /* PROCESSING_UNIT */ printk("(PROCESSING_UNIT)\n"); n = buf[7]; if (buf[0] < 10+n) printk(" Warning: Descriptor too short\n"); printk(" bUnitID %5u\n" " bSourceID %5u\n" " wMaxMultiplier %5u\n" " bControlSize %5u\n", buf[3], buf[4], buf[5] | (buf[6] << 8), n); ctrls = 0; for (i = 0; i < 3 && i < n; i++) ctrls = (ctrls << 8) | buf[8+n-i-1]; printk(" bmControls 0xx\n", ctrls); for (i = 0; i < 18; i++) if ((ctrls >> i) & 1) printk(" %s\n", ctrlnames[i]); stds = buf[9+n]; printk(" iProcessing %5u\n" " bmVideoStandards 0x%2x\n", buf[8+n], stds); for (i = 0; i < 6; i++) if ((stds >> i) & 1) printk(" %s\n", stdnames[i]); break; case 0x06: /* EXTENSION_UNIT */ printk("(EXTENSION_UNIT)\n"); p = buf[21]; n = buf[22+p]; if (buf[0] < 24+p+n) printk(" Warning: Descriptor too short\n"); printk(" bUnitID %5u\n" " guidExtensionCode %s\n" " bNumControl %5u\n" " bNrPins %5u\n", buf[3], get_guid(&buf[4]), buf[20], buf[21]); for (i = 0; i < p; i++) printk(" baSourceID(%2u) %5u\n", i, buf[22+i]); printk(" bControlSize %5u\n", buf[22+p]); for (i = 0; i < n; i++) printk(" bmControls(%2u) 0xx\n", i, buf[23+p+i]); printk(" iExtension %5u\n", buf[23+p+n]); break; default: printk("(unknown)\n" " Invalid desc subtype:"); break; } buflen -= buf[0]; buf += buf[0]; } } static void parse_videostreaming_interface(struct usb_interface *intf, unsigned char *buf, int buflen) { static const char * const colorPrims[] = { "Unspecified", "BT.709,sRGB", "BT.470-2 (M)", "BT.470-2 (B,G)", "SMPTE 170M", "SMPTE 240M" }; static const char * const transferChars[] = { "Unspecified", "BT.709", "BT.470-2 (M)", "BT.470-2 (B,G)", "SMPTE 170M", "SMPTE 240M", "Linear", "sRGB"}; static const char * const matrixCoeffs[] = { "Unspecified", "BT.709", "FCC", "BT.470-2 (B,G)", "SMPTE 170M (BT.601)", "SMPTE 240M" }; unsigned int i, m, n, p, flags, len; while (buflen > 0) { if (buf[1] != USB_DT_CS_INTERFACE) printk(" Warning: Invalid descriptor\n"); else if (buf[0] < 3) printk(" Warning: Descriptor too short\n"); printk(" VideoStreaming Interface Descriptor:\n" " bLength %5u\n" " bDescriptorType %5u\n" " bDescriptorSubtype %5u ", buf[0], buf[1], buf[2]); switch (buf[2]) { case 0x01: /* INPUT_HEADER */ printk("(INPUT_HEADER)\n"); p = buf[3]; n = buf[12]; if (buf[0] < 13+p*n) printk(" Warning: Descriptor too short\n"); printk(" bNumFormats %5u\n" " wTotalLength %5u\n" " bEndPointAddress %5u\n" " bmInfo %5u\n" " bTerminalLink %5u\n" " bStillCaptureMethod %5u\n" " bTriggerSupport %5u\n" " bTriggerUsage %5u\n" " bControlSize %5u\n", p, buf[4] | (buf[5] << 8), buf[6], buf[7], buf[8], buf[9], buf[10], buf[11], n); for (i = 0; i < p; i++) printk( " bmaControls(%2u) %5u\n", i, buf[13+p*n]); break; case 0x02: /* OUTPUT_HEADER */ printk("(OUTPUT_HEADER)\n"); p = buf[3]; n = buf[8]; if (buf[0] < 9+p*n) printk(" Warning: Descriptor too short\n"); printk(" bNumFormats %5u\n" " wTotalLength %5u\n" " bEndpointAddress %5u\n" " bTerminalLink %5u\n" " bControlSize %5u\n", p, buf[4] | (buf[5] << 8), buf[6], buf[7], n); for (i = 0; i < p; i++) printk( " bmaControls(%2u) %5u\n", i, buf[9+p*n]); break; case 0x03: /* STILL_IMAGE_FRAME */ printk("(STILL_IMAGE_FRAME)\n"); n = buf[4]; m = buf[5+4*n]; if (buf[0] < 6+4*n+m) printk(" Warning: Descriptor too short\n"); printk(" bEndpointAddress %5u\n" " bNumImageSizePatterns %3u\n", buf[3], n); for (i = 0; i < n; i++) printk(" wWidth(%2u) %5u\n" " wHeight(%2u) %5u\n", i, buf[5+4*i] | (buf[6+4*i] << 8), i, buf[7+4*i] | (buf[8+4*i] << 8)); printk(" bNumCompressionPatterns %3u\n", n); for (i = 0; i < m; i++) printk(" bCompression(%2u) %5u\n", i, buf[6+4*n+i]); break; case 0x04: /* FORMAT_UNCOMPRESSED */ case 0x10: /* FORMAT_FRAME_BASED */ if (buf[2] == 0x04) { printk("(FORMAT_UNCOMPRESSED)\n"); len = 27; } else { printk("(FORMAT_FRAME_BASED)\n"); len = 28; } if (buf[0] < len) printk(" Warning: Descriptor too short\n"); flags = buf[25]; printk(" bFormatIndex %5u\n" " bNumFrameDescriptors %5u\n" " guidFormat %s\n" " bBitsPerPixel %5u\n" " bDefaultFrameIndex %5u\n" " bAspectRatioX %5u\n" " bAspectRatioY %5u\n" " bmInterlaceFlags 0xx\n", buf[3], buf[4], get_guid(&buf[5]), buf[21], buf[22], buf[23], buf[24], flags); printk(" Interlaced stream or variable: %s\n", (flags & (1 << 0)) ? "Yes" : "No"); printk(" Fields per frame: %u fields\n", (flags & (1 << 1)) ? 1 : 2); printk(" Field 1 first: %s\n", (flags & (1 << 2)) ? "Yes" : "No"); printk(" Field pattern: "); switch ((flags >> 4) & 0x03) { case 0: printk("Field 1 only\n"); break; case 1: printk("Field 2 only\n"); break; case 2: printk("Regular pattern of fields 1 and 2\n"); break; case 3: printk("Random pattern of fields 1 and 2\n"); break; } printk(" bCopyProtect %5u\n", buf[26]); if (buf[2] == 0x10) printk(" bVariableSize %5u\n", buf[27]); break; case 0x05: /* FRAME UNCOMPRESSED */ case 0x07: /* FRAME_MJPEG */ case 0x11: /* FRAME_FRAME_BASED */ if (buf[2] == 0x05) { printk("(FRAME_UNCOMPRESSED)\n"); n = 25; } else if (buf[2] == 0x07) { printk("(FRAME_MJPEG)\n"); n = 25; } else { printk("(FRAME_FRAME_BASED)\n"); n = 21; } len = (buf[n] != 0) ? (26+buf[n]*4) : 38; if (buf[0] < len) printk(" Warning: Descriptor too short\n"); flags = buf[4]; printk(" bFrameIndex %5u\n" " bmCapabilities 0xx\n", buf[3], flags); printk(" Still image %ssupported\n", (flags & (1 << 0)) ? "" : "un"); if (flags & (1 << 1)) printk(" Fixed frame-rate\n"); printk(" wWidth %5u\n" " wHeight %5u\n" " dwMinBitRate %9u\n" " dwMaxBitRate %9u\n", buf[5] | (buf[6] << 8), buf[7] | (buf[8] << 8), buf[9] | (buf[10] << 8) | (buf[11] << 16) | (buf[12] << 24), buf[13] | (buf[14] << 8) | (buf[15] << 16) | (buf[16] << 24)); if (buf[2] == 0x11) printk(" dwDefaultFrameInterval %9u\n" " bFrameIntervalType %5u\n" " dwBytesPerLine %9u\n", buf[17] | (buf[18] << 8) | (buf[19] << 16) | (buf[20] << 24), buf[21], buf[22] | (buf[23] << 8) | (buf[24] << 16) | (buf[25] << 24)); else printk(" dwMaxVideoFrameBufferSize %9u\n" " dwDefaultFrameInterval %9u\n" " bFrameIntervalType %5u\n", buf[17] | (buf[18] << 8) | (buf[19] << 16) | (buf[20] << 24), buf[21] | (buf[22] << 8) | (buf[23] << 16) | (buf[24] << 24), buf[25]); if (buf[n] == 0) printk(" dwMinFrameInterval %9u\n" " dwMaxFrameInterval %9u\n" " dwFrameIntervalStep %9u\n", buf[26] | (buf[27] << 8) | (buf[28] << 16) | (buf[29] << 24), buf[30] | (buf[31] << 8) | (buf[32] << 16) | (buf[33] << 24), buf[34] | (buf[35] << 8) | (buf[36] << 16) | (buf[37] << 24)); else for (i = 0; i < buf[n]; i++) printk(" dwFrameInterval(%2u) %9u\n", i, buf[26+4*i] | (buf[27+4*i] << 8) | (buf[28+4*i] << 16) | (buf[29+4*i] << 24)); break; case 0x06: /* FORMAT_MJPEG */ printk("(FORMAT_MJPEG)\n"); if (buf[0] < 11) printk(" Warning: Descriptor too short\n"); flags = buf[5]; printk(" bFormatIndex %5u\n" " bNumFrameDescriptors %5u\n" " bFlags %5u\n", buf[3], buf[4], flags); printk(" Fixed-size samples: %s\n", (flags & (1 << 0)) ? "Yes" : "No"); flags = buf[9]; printk(" bDefaultFrameIndex %5u\n" " bAspectRatioX %5u\n" " bAspectRatioY %5u\n" " bmInterlaceFlags 0xx\n", buf[6], buf[7], buf[8], flags); printk(" Interlaced stream or variable: %s\n", (flags & (1 << 0)) ? "Yes" : "No"); printk(" Fields per frame: %u fields\n", (flags & (1 << 1)) ? 2 : 1); printk(" Field 1 first: %s\n", (flags & (1 << 2)) ? "Yes" : "No"); printk(" Field pattern: "); switch ((flags >> 4) & 0x03) { case 0: printk("Field 1 only\n"); break; case 1: printk("Field 2 only\n"); break; case 2: printk("Regular pattern of fields 1 and 2\n"); break; case 3: printk("Random pattern of fields 1 and 2\n"); break; } printk(" bCopyProtect %5u\n", buf[10]); break; case 0x0a: /* FORMAT_MPEG2TS */ printk("(FORMAT_MPEG2TS)\n"); len = buf[0] < 23 ? 7 : 23; if (buf[0] < len) printk(" Warning: Descriptor too short\n"); printk(" bFormatIndex %5u\n" " bDataOffset %5u\n" " bPacketLength %5u\n" " bStrideLength %5u\n", buf[3], buf[4], buf[5], buf[6]); if (len > 7) printk(" guidStrideFormat %s\n", get_guid(&buf[7])); break; case 0x0d: /* COLORFORMAT */ printk("(COLORFORMAT)\n"); if (buf[0] < 6) printk(" Warning: Descriptor too short\n"); printk(" bColorPrimaries %5u (%s)\n", buf[3], (buf[3] <= 5) ? colorPrims[buf[3]] : "Unknown"); printk(" bTransferCharacteristics %5u (%s)\n", buf[4], (buf[4] <= 7) ? transferChars[buf[4]] : "Unknown"); printk(" bMatrixCoefficients %5u (%s)\n", buf[5], (buf[5] <= 5) ? matrixCoeffs[buf[5]] : "Unknown"); break; default: printk(" Invalid desc subtype:"); break; } buflen -= buf[0]; buf += buf[0]; } } static void dump_endpoint(const struct usb_endpoint_descriptor *endpoint) { static const char * const typeattr[] = { "Control", "Isochronous", "Bulk", "Interrupt" }; static const char * const syncattr[] = { "None", "Asynchronous", "Adaptive", "Synchronous" }; static const char * const usage[] = { "Data", "Feedback", "Implicit feedback Data", "(reserved)" }; static const char * const hb[] = { "1x", "2x", "3x", "(?\?)" }; unsigned wmax = le16_to_cpu(endpoint->wMaxPacketSize); printk(" Standard Endpoint Descriptor:\n" " bLength %5u\n" " bDescriptorType %5u\n" " bEndpointAddress 0xx EP %u %s\n" " bmAttributes %5u\n" " Transfer Type %s\n" " Synch Type %s\n" " Usage Type %s\n" " wMaxPacketSize 0xx %s %d bytes\n" " bInterval %5u\n", endpoint->bLength, endpoint->bDescriptorType, endpoint->bEndpointAddress, endpoint->bEndpointAddress & 0x0f, (endpoint->bEndpointAddress & 0x80) ? "IN" : "OUT", endpoint->bmAttributes, typeattr[endpoint->bmAttributes & 3], syncattr[(endpoint->bmAttributes >> 2) & 3], usage[(endpoint->bmAttributes >> 4) & 3], wmax, hb[(wmax >> 11) & 3], wmax & 0x7ff, endpoint->bInterval); /* only for audio endpoints */ if (endpoint->bLength == 9) printk(" bRefresh %5u\n" " bSynchAddress %5u\n", endpoint->bRefresh, endpoint->bSynchAddress); } static int myuvc_probe(struct usb_interface *intf, const struct usb_device_id *id) { static int cnt = 0; struct usb_device *dev = interface_to_usbdev(intf); struct usb_device_descriptor *descriptor = &dev->descriptor; struct usb_host_config *hostconfig; struct usb_config_descriptor *config; struct usb_interface_assoc_descriptor *assoc_desc; struct usb_interface_descriptor *interface; struct usb_endpoint_descriptor *endpoint; int i, j, k, l, m; unsigned char *buffer; int buflen; int desc_len; int desc_cnt; printk("myuvc_probe : cnt = %d\n", cnt++); /* 打印设备描述符 */ printk("Device Descriptor:\n" " bLength %5u\n" " bDescriptorType %5u\n" " bcdUSB %2x.x\n" " bDeviceClass %5u \n" " bDeviceSubClass %5u \n" " bDeviceProtocol %5u \n" " bMaxPacketSize0 %5u\n" " idVendor 0xx \n" " idProduct 0xx \n" " bcdDevice %2x.x\n" " iManufacturer %5u\n" " iProduct %5u\n" " iSerial %5u\n" " bNumConfigurations %5u\n", descriptor->bLength, descriptor->bDescriptorType, descriptor->bcdUSB >> 8, descriptor->bcdUSB & 0xff, descriptor->bDeviceClass, descriptor->bDeviceSubClass, descriptor->bDeviceProtocol, descriptor->bMaxPacketSize0, descriptor->idVendor, descriptor->idProduct, descriptor->bcdDevice >> 8, descriptor->bcdDevice & 0xff, descriptor->iManufacturer, descriptor->iProduct, descriptor->iSerialNumber, descriptor->bNumConfigurations); for (i = 0; i < descriptor->bNumConfigurations; i++) { hostconfig = &dev->config[i]; config = &hostconfig->desc; // 配置描述符 printk(" Configuration Descriptor %d:\n" " bLength %5u\n" " bDescriptorType %5u\n" " wTotalLength %5u\n" " bNumInterfaces %5u\n" " bConfigurationValue %5u\n" " iConfiguration %5u\n" " bmAttributes 0xx\n", i, config->bLength, config->bDescriptorType, le16_to_cpu(config->wTotalLength), config->bNumInterfaces, config->bConfigurationValue, config->iConfiguration, config->bmAttributes); // 接口联合描述符 assoc_desc = hostconfig->intf_assoc[0]; printk(" Interface Association Descriptor:\n" " bLength %5u\n" " bDescriptorType %5u\n" " bFirstInterface %5u\n" " bInterfaceCount %5u\n" " bFunctionClass %5u\n" " bFunctionSubClass %5u\n" " bFunctionProtocol %5u\n" " iFunction %5u\n", assoc_desc->bLength, assoc_desc->bDescriptorType, assoc_desc->bFirstInterface, assoc_desc->bInterfaceCount, assoc_desc->bFunctionClass, assoc_desc->bFunctionSubClass, assoc_desc->bFunctionProtocol, assoc_desc->iFunction); // 打印当前 probe 传进来接口的每一个设置的接口描述符 for (j = 0; j < intf->num_altsetting; j++) { interface = &intf->altsetting[j].desc; // Standard Interface Descriptor printk(" Standard Interface Descriptor -> altsetting %d:\n" " bLength %5u\n" " bDescriptorType %5u\n" " bInterfaceNumber %5u\n" " bAlternateSetting %5u\n" " bNumEndpoints %5u\n" " bInterfaceClass %5u\n" " bInterfaceSubClass %5u\n" " bInterfaceProtocol %5u\n" " iInterface %5u\n", j, interface->bLength, interface->bDescriptorType, interface->bInterfaceNumber, interface->bAlternateSetting, interface->bNumEndpoints, interface->bInterfaceClass, interface->bInterfaceSubClass, interface->bInterfaceProtocol, interface->iInterface); /* 打印端点描述符 */ for (m = 0; m < interface->bNumEndpoints; m++) { endpoint = &intf->altsetting[j].endpoint[m].desc; dump_endpoint(endpoint); /* class specific endpoint Descriptor */ buffer = &intf->altsetting[j].endpoint[m].extra; buflen = intf->altsetting[j].endpoint[m].enabled; printk(" Class-specific Endpoint Descriptor:\n"); k = 0; desc_cnt = 0; while (k < buflen) { desc_len = buffer[k]; printk("extra desc %d: ", desc_cnt); for (l = 0; l < desc_len; l++, k++) { printk("x ", buffer[k]); } desc_cnt++; printk("\n"); } } } // 只打印当前设置的 class specific Descriptor buffer = intf->cur_altsetting->extra; // Class-specific Interface Descriptor printk(" Class-specific Interface Descriptor\n"); buflen = intf->cur_altsetting->extralen; printk("extra buffer of interface %d:\n", cnt-1); k = 0; desc_cnt = 0; while (k < buflen) { desc_len = buffer[k]; printk("extra desc %d: ", desc_cnt); for (l = 0; l < desc_len; l++, k++) { printk("x ", buffer[k]); } desc_cnt++; printk("\n"); } // 解析 Class-specific Interface Descriptor interface = &intf->cur_altsetting->desc; if ((buffer[1] == USB_DT_CS_INTERFACE) && (interface->bInterfaceSubClass == 1)) { parse_videocontrol_interface(intf, buffer, buflen); } if ((buffer[1] == USB_DT_CS_INTERFACE) && (interface->bInterfaceSubClass == 2)) { parse_videostreaming_interface(intf, buffer, buflen); } } return 0; } static void myuvc_disconnect(struct usb_interface *intf) { static int cnt = 0; printk("myuvc_disconnect : cnt = %d\n", cnt++); } static struct usb_device_id myuvc_ids[] = { /* Generic USB Video Class */ { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, 0) }, /* VideoControl Interface */ { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 2, 0) }, /* VideoStreaming Interface */ {} }; /* 1. 分配usb_driver */ /* 2. 设置 */ static struct usb_driver myuvc_driver = { .name = "myuvc", .probe = myuvc_probe, .disconnect = myuvc_disconnect, .id_table = myuvc_ids, }; static int myuvc_init(void) { /* 3. 注册 */ usb_register(&myuvc_driver); return 0; } static void myuvc_exit(void) { usb_deregister(&myuvc_driver); } module_init(myuvc_init); module_exit(myuvc_exit); MODULE_LICENSE("GPL"); 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726

描述符打印信息

myuvc_probe : cnt = 0 Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 239 bDeviceSubClass 2 bDeviceProtocol 1 bMaxPacketSize0 64 idVendor 0x04f2 idProduct 0xb26a bcdDevice 52.68 iManufacturer 1 iProduct 2 iSerial 0 bNumConfigurations 1 Configuration Descriptor 0: bLength 9 bDescriptorType 2 wTotalLength 857 bNumInterfaces 2 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x80 Interface Association Descriptor: bLength 8 bDescriptorType 11 bFirstInterface 0 bInterfaceCount 2 bFunctionClass 14 bFunctionSubClass 3 bFunctionProtocol 0 iFunction 2 Standard Interface Descriptor -> altsetting 0: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 14 bInterfaceSubClass 1 bInterfaceProtocol 0 iInterface 2 Standard Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x87 EP 7 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0010 1x 16 bytes bInterval 8 Class-specific Endpoint Descriptor: extra desc 0: 05 25 03 10 00 Class-specific Interface Descriptor extra buffer of interface 0: extra desc 0: 0d 24 01 00 01 6d 00 00 6c dc 02 01 01 extra desc 1: 12 24 02 01 01 02 00 00 00 00 00 00 00 00 03 06 00 00 extra desc 2: 0b 24 05 02 01 00 40 02 3f 15 00 extra desc 3: 1d 24 06 03 82 06 61 63 70 50 ab 49 b8 cc b3 85 5e 8d 22 1d 00 01 02 04 ff ff 1d 00 00 extra desc 4: 1d 24 06 04 64 e7 c6 24 51 5f 7e 43 90 89 28 ff a4 87 bd ca 00 01 03 04 0f 00 00 00 00 extra desc 5: 09 24 03 05 01 01 00 04 00 VideoControl Interface Descriptor: bLength 13 bDescriptorType 36 bDescriptorSubtype 1 (HEADER) bcdUVC 1.00 wTotalLength 109 dwClockFrequency 48.000000MHz bInCollection 1 baInterfaceNr( 0) 1 VideoControl Interface Descriptor: bLength 18 bDescriptorType 36 bDescriptorSubtype 2 (INPUT_TERMINAL) bTerminalID 1 wTerminalType 0x0201 bAssocTerminal 0 iTerminal 0 wObjectiveFocalLengthMin 0 wObjectiveFocalLengthMax 0 wOcularFocalLength 0 bControlSize 3 bmControls 0x00000006 Auto-Exposure Mode Auto-Exposure Priority VideoControl Interface Descriptor: bLength 11 bDescriptorType 36 bDescriptorSubtype 5 (PROCESSING_UNIT) Warning: Descriptor too short bUnitID 2 bSourceID 1 wMaxMultiplier 16384 bControlSize 2 bmControls 0x0000153f Brightness Contrast Hue Saturation Sharpness Gamma Backlight Compensation Power Line Frequency White Balance Temperature, Auto iProcessing 0 bmVideoStandards 0x1d None PAL - 625/50 SECAM - 625/50 NTSC - 625/50 VideoControl Interface Descriptor: bLength 29 bDescriptorType 36 bDescriptorSubtype 6 (EXTENSION_UNIT) bUnitID 3 guidExtensionCode {82066163-7050-ab49-b8cc-b3855e8d221d} bNumControl 0 bNrPins 1 baSourceID( 0) 2 bControlSize 4 bmControls( 0) 0xff bmControls( 1) 0xff bmControls( 2) 0x1d bmControls( 3) 0x00 iExtension 0 VideoControl Interface Descriptor: bLength 29 bDescriptorType 36 bDescriptorSubtype 6 (EXTENSION_UNIT) bUnitID 4 guidExtensionCode {64e7c624-515f-7e43-9089-28ffa487bdca} bNumControl 0 bNrPins 1 baSourceID( 0) 3 bControlSize 4 bmControls( 0) 0x0f bmControls( 1) 0x00 bmControls( 2) 0x00 bmControls( 3) 0x00 iExtension 0 VideoControl Interface Descriptor: bLength 9 bDescriptorType 36 bDescriptorSubtype 3 (OUTPUT_TERMINAL) bTerminalID 5 wTerminalType 0x0101 bAssocTerminal 0 bSourceID 4 iTerminal 0 myuvc_probe : cnt = 1 Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 239 bDeviceSubClass 2 bDeviceProtocol 1 bMaxPacketSize0 64 idVendor 0x04f2 idProduct 0xb26a bcdDevice 52.68 iManufacturer 1 iProduct 2 iSerial 0 bNumConfigurations 1 Configuration Descriptor 0: bLength 9 bDescriptorType 2 wTotalLength 857 bNumInterfaces 2 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x80 Interface Association Descriptor: bLength 8 bDescriptorType 11 bFirstInterface 0 bInterfaceCount 2 bFunctionClass 14 bFunctionSubClass 3 bFunctionProtocol 0 iFunction 2 Standard Interface Descriptor -> altsetting 0: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 0 bNumEndpoints 0 bInterfaceClass 14 bInterfaceSubClass 2 bInterfaceProtocol 0 iInterface 0 Standard Interface Descriptor -> altsetting 1: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 1 bNumEndpoints 1 bInterfaceClass 14 bInterfaceSubClass 2 bInterfaceProtocol 0 iInterface 0 Standard Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 5 Transfer Type Isochronous Synch Type Asynchronous Usage Type Data wMaxPacketSize 0x00c0 1x 192 bytes bInterval 1 Class-specific Endpoint Descriptor: Standard Interface Descriptor -> altsetting 2: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 2 bNumEndpoints 1 bInterfaceClass 14 bInterfaceSubClass 2 bInterfaceProtocol 0 iInterface 0 Standard Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 5 Transfer Type Isochronous Synch Type Asynchronous Usage Type Data wMaxPacketSize 0x0180 1x 384 bytes bInterval 1 Class-specific Endpoint Descriptor: Standard Interface Descriptor -> altsetting 3: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 3 bNumEndpoints 1 bInterfaceClass 14 bInterfaceSubClass 2 bInterfaceProtocol 0 iInterface 0 Standard Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 5 Transfer Type Isochronous Synch Type Asynchronous Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 1 Class-specific Endpoint Descriptor: Standard Interface Descriptor -> altsetting 4: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 4 bNumEndpoints 1 bInterfaceClass 14 bInterfaceSubClass 2 bInterfaceProtocol 0 iInterface 0 Standard Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 5 Transfer Type Isochronous Synch Type Asynchronous Usage Type Data wMaxPacketSize 0x0280 1x 640 bytes bInterval 1 Class-specific Endpoint Descriptor: Standard Interface Descriptor -> altsetting 5: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 5 bNumEndpoints 1 bInterfaceClass 14 bInterfaceSubClass 2 bInterfaceProtocol 0 iInterface 0 Standard Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 5 Transfer Type Isochronous Synch Type Asynchronous Usage Type Data wMaxPacketSize 0x0320 1x 800 bytes bInterval 1 Class-specific Endpoint Descriptor: Standard Interface Descriptor -> altsetting 6: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 6 bNumEndpoints 1 bInterfaceClass 14 bInterfaceSubClass 2 bInterfaceProtocol 0 iInterface 0 Standard Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 5 Transfer Type Isochronous Synch Type Asynchronous Usage Type Data wMaxPacketSize 0x03b0 1x 944 bytes bInterval 1 Class-specific Endpoint Descriptor: Standard Interface Descriptor -> altsetting 7: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 7 bNumEndpoints 1 bInterfaceClass 14 bInterfaceSubClass 2 bInterfaceProtocol 0 iInterface 0 Standard Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 5 Transfer Type Isochronous Synch Type Asynchronous Usage Type Data wMaxPacketSize 0x0a80 2x 640 bytes bInterval 1 Class-specific Endpoint Descriptor: Standard Interface Descriptor -> altsetting 8: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 8 bNumEndpoints 1 bInterfaceClass 14 bInterfaceSubClass 2 bInterfaceProtocol 0 iInterface 0 Standard Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 5 Transfer Type Isochronous Synch Type Asynchronous Usage Type Data wMaxPacketSize 0x0b20 2x 800 bytes bInterval 1 Class-specific Endpoint Descriptor: Standard Interface Descriptor -> altsetting 9: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 9 bNumEndpoints 1 bInterfaceClass 14 bInterfaceSubClass 2 bInterfaceProtocol 0 iInterface 0 Standard Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 5 Transfer Type Isochronous Synch Type Asynchronous Usage Type Data wMaxPacketSize 0x0be0 2x 992 bytes bInterval 1 Class-specific Endpoint Descriptor: Standard Interface Descriptor -> altsetting 10: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 10 bNumEndpoints 1 bInterfaceClass 14 bInterfaceSubClass 2 bInterfaceProtocol 0 iInterface 0 Standard Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 5 Transfer Type Isochronous Synch Type Asynchronous Usage Type Data wMaxPacketSize 0x1380 3x 896 bytes bInterval 1 Class-specific Endpoint Descriptor: Standard Interface Descriptor -> altsetting 11: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 11 bNumEndpoints 1 bInterfaceClass 14 bInterfaceSubClass 2 bInterfaceProtocol 0 iInterface 0 Standard Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 5 Transfer Type Isochronous Synch Type Asynchronous Usage Type Data wMaxPacketSize 0x13fc 3x 1020 bytes bInterval 1 Class-specific Endpoint Descriptor: Class-specific Interface Descriptor extra buffer of interface 1: extra desc 0: 0f 24 01 02 0d 02 81 00 05 01 01 00 01 00 04 extra desc 1: 1b 24 04 01 07 59 55 59 32 00 00 10 00 80 00 00 aa 00 38 9b 71 10 01 00 00 00 00 extra desc 2: 22 24 05 01 01 80 02 e0 01 00 00 65 04 00 00 ca 08 00 60 09 00 15 16 05 00 02 15 16 05 00 2a 2c 0a 00 extra desc 3: 22 24 05 02 01 a0 00 78 00 00 50 46 00 00 a0 8c 00 00 96 00 00 15 16 05 00 02 15 16 05 00 2a 2c 0a 00 extra desc 4: 22 24 05 03 01 b0 00 90 00 00 d0 5c 00 00 a0 b9 00 00 c6 00 00 15 16 05 00 02 15 16 05 00 2a 2c 0a 00 extra desc 5: 22 24 05 04 01 40 01 f0 00 00 40 19 01 00 80 32 02 00 58 02 00 15 16 05 00 02 15 16 05 00 2a 2c 0a 00 extra desc 6: 22 24 05 05 01 60 01 20 01 00 40 73 01 00 80 e6 02 00 18 03 00 15 16 05 00 02 15 16 05 00 2a 2c 0a 00 extra desc 7: 1e 24 05 06 01 00 05 d0 02 00 00 ca 08 00 00 ca 08 00 20 1c 00 40 42 0f 00 01 40 42 0f 00 extra desc 8: 1e 24 05 07 01 00 05 20 03 00 00 c4 09 00 00 c4 09 00 40 1f 00 40 42 0f 00 01 40 42 0f 00 extra desc 9: 06 24 0d 01 01 04 extra desc 10: 0b 24 06 02 07 01 01 00 00 00 00 extra desc 11: 22 24 07 01 01 80 02 e0 01 00 00 65 04 00 00 ca 08 00 60 09 00 15 16 05 00 02 15 16 05 00 2a 2c 0a 00 extra desc 12: 22 24 07 02 01 a0 00 78 00 00 50 46 00 00 a0 8c 00 00 96 00 00 15 16 05 00 02 15 16 05 00 2a 2c 0a 00 extra desc 13: 22 24 07 03 01 b0 00 90 00 00 d0 5c 00 00 a0 b9 00 00 c6 00 00 15 16 05 00 02 15 16 05 00 2a 2c 0a 00 extra desc 14: 22 24 07 04 01 40 01 f0 00 00 40 19 01 00 80 32 02 00 58 02 00 15 16 05 00 02 15 16 05 00 2a 2c 0a 00 extra desc 15: 22 24 07 05 01 60 01 20 01 00 40 73 01 00 80 e6 02 00 18 03 00 15 16 05 00 02 15 16 05 00 2a 2c 0a 00 extra desc 16: 1e 24 07 06 01 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 extra desc 17: 1e 24 07 07 01 00 05 20 03 00 00 4c 1d 00 00 4c 1d 00 40 1f 00 15 16 05 00 01 15 16 05 00 extra desc 18: 06 24 0d 01 01 04 VideoStreaming Interface Descriptor: bLength 15 bDescriptorType 36 bDescriptorSubtype 1 (INPUT_HEADER) bNumFormats 2 wTotalLength 525 bEndPointAddress 129 bmInfo 0 bTerminalLink 5 bStillCaptureMethod 1 bTriggerSupport 1 bTriggerUsage 0 bControlSize 1 bmaControls( 0) 27 bmaControls( 1) 27 VideoStreaming Interface Descriptor: bLength 27 bDescriptorType 36 bDescriptorSubtype 4 (FORMAT_UNCOMPRESSED) bFormatIndex 1 bNumFrameDescriptors 7 guidFormat {59555932-0000-1000-8000-00aa00389b71} bBitsPerPixel 16 bDefaultFrameIndex 1 bAspectRatioX 0 bAspectRatioY 0 bmInterlaceFlags 0x00 Interlaced stream or variable: No Fields per frame: 2 fields Field 1 first: No Field pattern: Field 1 only bCopyProtect 0 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 5 (FRAME_UNCOMPRESSED) bFrameIndex 1 bmCapabilities 0x01 Still image supported wWidth 640 wHeight 480 dwMinBitRate 73728000 dwMaxBitRate 147456000 dwMaxVideoFrameBufferSize 614400 dwDefaultFrameInterval 333333 bFrameIntervalType 2 dwFrameInterval( 0) 333333 dwFrameInterval( 1) 666666 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 5 (FRAME_UNCOMPRESSED) bFrameIndex 2 bmCapabilities 0x01 Still image supported wWidth 160 wHeight 120 dwMinBitRate 4608000 dwMaxBitRate 9216000 dwMaxVideoFrameBufferSize 38400 dwDefaultFrameInterval 333333 bFrameIntervalType 2 dwFrameInterval( 0) 333333 dwFrameInterval( 1) 666666 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 5 (FRAME_UNCOMPRESSED) bFrameIndex 3 bmCapabilities 0x01 Still image supported wWidth 176 wHeight 144 dwMinBitRate 6082560 dwMaxBitRate 12165120 dwMaxVideoFrameBufferSize 50688 dwDefaultFrameInterval 333333 bFrameIntervalType 2 dwFrameInterval( 0) 333333 dwFrameInterval( 1) 666666 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 5 (FRAME_UNCOMPRESSED) bFrameIndex 4 bmCapabilities 0x01 Still image supported wWidth 320 wHeight 240 dwMinBitRate 18432000 dwMaxBitRate 36864000 dwMaxVideoFrameBufferSize 153600 dwDefaultFrameInterval 333333 bFrameIntervalType 2 dwFrameInterval( 0) 333333 dwFrameInterval( 1) 666666 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 5 (FRAME_UNCOMPRESSED) bFrameIndex 5 bmCapabilities 0x01 Still image supported wWidth 352 wHeight 288 dwMinBitRate 24330240 dwMaxBitRate 48660480 dwMaxVideoFrameBufferSize 202752 dwDefaultFrameInterval 333333 bFrameIntervalType 2 dwFrameInterval( 0) 333333 dwFrameInterval( 1) 666666 VideoStreaming Interface Descriptor: bLength 30 bDescriptorType 36 bDescriptorSubtype 5 (FRAME_UNCOMPRESSED) bFrameIndex 6 bmCapabilities 0x01 Still image supported wWidth 1280 wHeight 720 dwMinBitRate 147456000 dwMaxBitRate 147456000 dwMaxVideoFrameBufferSize 1843200 dwDefaultFrameInterval 1000000 bFrameIntervalType 1 dwFrameInterval( 0) 1000000 VideoStreaming Interface Descriptor: bLength 30 bDescriptorType 36 bDescriptorSubtype 5 (FRAME_UNCOMPRESSED) bFrameIndex 7 bmCapabilities 0x01 Still image supported wWidth 1280 wHeight 800 dwMinBitRate 163840000 dwMaxBitRate 163840000 dwMaxVideoFrameBufferSize 2048000 dwDefaultFrameInterval 1000000 bFrameIntervalType 1 dwFrameInterval( 0) 1000000 VideoStreaming Interface Descriptor: bLength 6 bDescriptorType 36 bDescriptorSubtype 13 (COLORFORMAT) bColorPrimaries 1 (BT.709,sRGB) bTransferCharacteristics 1 (BT.709) bMatrixCoefficients 4 (SMPTE 170M (BT.601)) VideoStreaming Interface Descriptor: bLength 11 bDescriptorType 36 bDescriptorSubtype 6 (FORMAT_MJPEG) bFormatIndex 2 bNumFrameDescriptors 7 bFlags 1 Fixed-size samples: Yes bDefaultFrameIndex 1 bAspectRatioX 0 bAspectRatioY 0 bmInterlaceFlags 0x00 Interlaced stream or variable: No Fields per frame: 1 fields Field 1 first: No Field pattern: Field 1 only bCopyProtect 0 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 7 (FRAME_MJPEG) bFrameIndex 1 bmCapabilities 0x01 Still image supported wWidth 640 wHeight 480 dwMinBitRate 73728000 dwMaxBitRate 147456000 dwMaxVideoFrameBufferSize 614400 dwDefaultFrameInterval 333333 bFrameIntervalType 2 dwFrameInterval( 0) 333333 dwFrameInterval( 1) 666666 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 7 (FRAME_MJPEG) bFrameIndex 2 bmCapabilities 0x01 Still image supported wWidth 160 wHeight 120 dwMinBitRate 4608000 dwMaxBitRate 9216000 dwMaxVideoFrameBufferSize 38400 dwDefaultFrameInterval 333333 bFrameIntervalType 2 dwFrameInterval( 0) 333333 dwFrameInterval( 1) 666666 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 7 (FRAME_MJPEG) bFrameIndex 3 bmCapabilities 0x01 Still image supported wWidth 176 wHeight 144 dwMinBitRate 6082560 dwMaxBitRate 12165120 dwMaxVideoFrameBufferSize 50688 dwDefaultFrameInterval 333333 bFrameIntervalType 2 dwFrameInterval( 0) 333333 dwFrameInterval( 1) 666666 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 7 (FRAME_MJPEG) bFrameIndex 4 bmCapabilities 0x01 Still image supported wWidth 320 wHeight 240 dwMinBitRate 18432000 dwMaxBitRate 36864000 dwMaxVideoFrameBufferSize 153600 dwDefaultFrameInterval 333333 bFrameIntervalType 2 dwFrameInterval( 0) 333333 dwFrameInterval( 1) 666666 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 7 (FRAME_MJPEG) bFrameIndex 5 bmCapabilities 0x01 Still image supported wWidth 352 wHeight 288 dwMinBitRate 24330240 dwMaxBitRate 48660480 dwMaxVideoFrameBufferSize 202752 dwDefaultFrameInterval 333333 bFrameIntervalType 2 dwFrameInterval( 0) 333333 dwFrameInterval( 1) 666666 VideoStreaming Interface Descriptor: bLength 30 bDescriptorType 36 bDescriptorSubtype 7 (FRAME_MJPEG) bFrameIndex 6 bmCapabilities 0x01 Still image supported wWidth 1280 wHeight 720 dwMinBitRate 442368000 dwMaxBitRate 442368000 dwMaxVideoFrameBufferSize 1843200 dwDefaultFrameInterval 333333 bFrameIntervalType 1 dwFrameInterval( 0) 333333 VideoStreaming Interface Descriptor: bLength 30 bDescriptorType 36 bDescriptorSubtype 7 (FRAME_MJPEG) bFrameIndex 7 bmCapabilities 0x01 Still image supported wWidth 1280 wHeight 800 dwMinBitRate 491520000 dwMaxBitRate 491520000 dwMaxVideoFrameBufferSize 2048000 dwDefaultFrameInterval 333333 bFrameIntervalType 1 dwFrameInterval( 0) 333333 VideoStreaming Interface Descriptor: bLength 6 bDescriptorType 36 bDescriptorSubtype 13 (COLORFORMAT) bColorPrimaries 1 (BT.709,sRGB) bTransferCharacteristics 1 (BT.709) bMatrixCoefficients 4 (SMPTE 170M (BT.601)) 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729