2 * uvc_driver.c -- USB Video Class driver
4 * Copyright (C) 2005-2010
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
14 #include <linux/atomic.h>
15 #include <linux/kernel.h>
16 #include <linux/list.h>
17 #include <linux/module.h>
18 #include <linux/slab.h>
19 #include <linux/usb.h>
20 #include <linux/videodev2.h>
21 #include <linux/vmalloc.h>
22 #include <linux/wait.h>
23 #include <linux/version.h>
24 #include <asm/unaligned.h>
26 #include <media/v4l2-common.h>
27 #include <media/v4l2-ioctl.h>
31 #define DRIVER_AUTHOR "Laurent Pinchart " \
33 #define DRIVER_DESC "USB Video Class driver"
35 unsigned int uvc_clock_param = CLOCK_MONOTONIC;
36 unsigned int uvc_hw_timestamps_param;
37 unsigned int uvc_no_drop_param;
38 static unsigned int uvc_quirks_param = -1;
39 unsigned int uvc_trace_param;
40 unsigned int uvc_timeout_param = UVC_CTRL_STREAMING_TIMEOUT;
42 /* ------------------------------------------------------------------------
46 static struct uvc_format_desc uvc_fmts[] = {
48 .name = "YUV 4:2:2 (YUYV)",
49 .guid = UVC_GUID_FORMAT_YUY2,
50 .fcc = V4L2_PIX_FMT_YUYV,
53 .name = "YUV 4:2:2 (YUYV)",
54 .guid = UVC_GUID_FORMAT_YUY2_ISIGHT,
55 .fcc = V4L2_PIX_FMT_YUYV,
58 .name = "YUV 4:2:0 (NV12)",
59 .guid = UVC_GUID_FORMAT_NV12,
60 .fcc = V4L2_PIX_FMT_NV12,
64 .guid = UVC_GUID_FORMAT_MJPEG,
65 .fcc = V4L2_PIX_FMT_MJPEG,
68 .name = "YVU 4:2:0 (YV12)",
69 .guid = UVC_GUID_FORMAT_YV12,
70 .fcc = V4L2_PIX_FMT_YVU420,
73 .name = "YUV 4:2:0 (I420)",
74 .guid = UVC_GUID_FORMAT_I420,
75 .fcc = V4L2_PIX_FMT_YUV420,
78 .name = "YUV 4:2:0 (M420)",
79 .guid = UVC_GUID_FORMAT_M420,
80 .fcc = V4L2_PIX_FMT_M420,
83 .name = "YUV 4:2:2 (UYVY)",
84 .guid = UVC_GUID_FORMAT_UYVY,
85 .fcc = V4L2_PIX_FMT_UYVY,
88 .name = "Greyscale 8-bit (Y800)",
89 .guid = UVC_GUID_FORMAT_Y800,
90 .fcc = V4L2_PIX_FMT_GREY,
93 .name = "Greyscale 8-bit (Y8 )",
94 .guid = UVC_GUID_FORMAT_Y8,
95 .fcc = V4L2_PIX_FMT_GREY,
98 .name = "Greyscale 8-bit (D3DFMT_L8)",
99 .guid = UVC_GUID_FORMAT_D3DFMT_L8,
100 .fcc = V4L2_PIX_FMT_GREY,
103 .name = "IR 8-bit (L8_IR)",
104 .guid = UVC_GUID_FORMAT_KSMEDIA_L8_IR,
105 .fcc = V4L2_PIX_FMT_GREY,
108 .name = "Greyscale 10-bit (Y10 )",
109 .guid = UVC_GUID_FORMAT_Y10,
110 .fcc = V4L2_PIX_FMT_Y10,
113 .name = "Greyscale 12-bit (Y12 )",
114 .guid = UVC_GUID_FORMAT_Y12,
115 .fcc = V4L2_PIX_FMT_Y12,
118 .name = "Greyscale 16-bit (Y16 )",
119 .guid = UVC_GUID_FORMAT_Y16,
120 .fcc = V4L2_PIX_FMT_Y16,
123 .name = "BGGR Bayer (BY8 )",
124 .guid = UVC_GUID_FORMAT_BY8,
125 .fcc = V4L2_PIX_FMT_SBGGR8,
128 .name = "BGGR Bayer (BA81)",
129 .guid = UVC_GUID_FORMAT_BA81,
130 .fcc = V4L2_PIX_FMT_SBGGR8,
133 .name = "GBRG Bayer (GBRG)",
134 .guid = UVC_GUID_FORMAT_GBRG,
135 .fcc = V4L2_PIX_FMT_SGBRG8,
138 .name = "GRBG Bayer (GRBG)",
139 .guid = UVC_GUID_FORMAT_GRBG,
140 .fcc = V4L2_PIX_FMT_SGRBG8,
143 .name = "RGGB Bayer (RGGB)",
144 .guid = UVC_GUID_FORMAT_RGGB,
145 .fcc = V4L2_PIX_FMT_SRGGB8,
149 .guid = UVC_GUID_FORMAT_RGBP,
150 .fcc = V4L2_PIX_FMT_RGB565,
153 .name = "BGR 8:8:8 (BGR3)",
154 .guid = UVC_GUID_FORMAT_BGR3,
155 .fcc = V4L2_PIX_FMT_BGR24,
159 .guid = UVC_GUID_FORMAT_H264,
160 .fcc = V4L2_PIX_FMT_H264,
163 .name = "Greyscale 8 L/R (Y8I)",
164 .guid = UVC_GUID_FORMAT_Y8I,
165 .fcc = V4L2_PIX_FMT_Y8I,
168 .name = "Greyscale 12 L/R (Y12I)",
169 .guid = UVC_GUID_FORMAT_Y12I,
170 .fcc = V4L2_PIX_FMT_Y12I,
173 .name = "Depth data 16-bit (Z16)",
174 .guid = UVC_GUID_FORMAT_Z16,
175 .fcc = V4L2_PIX_FMT_Z16,
178 .name = "Bayer 10-bit (SRGGB10P)",
179 .guid = UVC_GUID_FORMAT_RW10,
180 .fcc = V4L2_PIX_FMT_SRGGB10P,
183 .name = "Bayer 16-bit (SBGGR16)",
184 .guid = UVC_GUID_FORMAT_BG16,
185 .fcc = V4L2_PIX_FMT_SBGGR16,
188 .name = "Bayer 16-bit (SGBRG16)",
189 .guid = UVC_GUID_FORMAT_GB16,
190 .fcc = V4L2_PIX_FMT_SGBRG16,
193 .name = "Bayer 16-bit (SRGGB16)",
194 .guid = UVC_GUID_FORMAT_RG16,
195 .fcc = V4L2_PIX_FMT_SRGGB16,
198 .name = "Bayer 16-bit (SGRBG16)",
199 .guid = UVC_GUID_FORMAT_GR16,
200 .fcc = V4L2_PIX_FMT_SGRBG16,
203 .name = "Depth data 16-bit (Z16)",
204 .guid = UVC_GUID_FORMAT_INVZ,
205 .fcc = V4L2_PIX_FMT_Z16,
208 .name = "Greyscale 10-bit (Y10 )",
209 .guid = UVC_GUID_FORMAT_INVI,
210 .fcc = V4L2_PIX_FMT_Y10,
213 .name = "IR:Depth 26-bit (INZI)",
214 .guid = UVC_GUID_FORMAT_INZI,
215 .fcc = V4L2_PIX_FMT_INZI,
218 .name = "4-bit Depth Confidence (Packed)",
219 .guid = UVC_GUID_FORMAT_CNF4,
220 .fcc = V4L2_PIX_FMT_CNF4,
224 /* ------------------------------------------------------------------------
228 struct usb_host_endpoint *uvc_find_endpoint(struct usb_host_interface *alts,
231 struct usb_host_endpoint *ep;
234 for (i = 0; i < alts->desc.bNumEndpoints; ++i) {
235 ep = &alts->endpoint[i];
236 if (ep->desc.bEndpointAddress == epaddr)
243 static struct uvc_format_desc *uvc_format_by_guid(const u8 guid[16])
245 unsigned int len = ARRAY_SIZE(uvc_fmts);
248 for (i = 0; i < len; ++i) {
249 if (memcmp(guid, uvc_fmts[i].guid, 16) == 0)
256 static u32 uvc_colorspace(const u8 primaries)
258 static const u8 colorprimaries[] = {
260 V4L2_COLORSPACE_SRGB,
261 V4L2_COLORSPACE_470_SYSTEM_M,
262 V4L2_COLORSPACE_470_SYSTEM_BG,
263 V4L2_COLORSPACE_SMPTE170M,
264 V4L2_COLORSPACE_SMPTE240M,
267 if (primaries < ARRAY_SIZE(colorprimaries))
268 return colorprimaries[primaries];
273 /* Simplify a fraction using a simple continued fraction decomposition. The
274 * idea here is to convert fractions such as 333333/10000000 to 1/30 using
275 * 32 bit arithmetic only. The algorithm is not perfect and relies upon two
276 * arbitrary parameters to remove non-significative terms from the simple
277 * continued fraction decomposition. Using 8 and 333 for n_terms and threshold
278 * respectively seems to give nice results.
280 void uvc_simplify_fraction(u32 *numerator, u32 *denominator,
281 unsigned int n_terms, unsigned int threshold)
287 an = kmalloc_array(n_terms, sizeof(*an), GFP_KERNEL);
291 /* Convert the fraction to a simple continued fraction. See
292 * http://mathforum.org/dr.math/faq/faq.fractions.html
293 * Stop if the current term is bigger than or equal to the given
299 for (n = 0; n < n_terms && y != 0; ++n) {
301 if (an[n] >= threshold) {
312 /* Expand the simple continued fraction back to an integer fraction. */
316 for (i = n; i > 0; --i) {
327 /* Convert a fraction to a frame interval in 100ns multiples. The idea here is
328 * to compute numerator / denominator * 10000000 using 32 bit fixed point
331 u32 uvc_fraction_to_interval(u32 numerator, u32 denominator)
335 /* Saturate the result if the operation would overflow. */
336 if (denominator == 0 ||
337 numerator/denominator >= ((u32)-1)/10000000)
340 /* Divide both the denominator and the multiplier by two until
341 * numerator * multiplier doesn't overflow. If anyone knows a better
342 * algorithm please let me know.
344 multiplier = 10000000;
345 while (numerator > ((u32)-1)/multiplier) {
350 return denominator ? numerator * multiplier / denominator : 0;
353 /* ------------------------------------------------------------------------
354 * Terminal and unit management
357 struct uvc_entity *uvc_entity_by_id(struct uvc_device *dev, int id)
359 struct uvc_entity *entity;
361 list_for_each_entry(entity, &dev->entities, list) {
362 if (entity->id == id)
369 static struct uvc_entity *uvc_entity_by_reference(struct uvc_device *dev,
370 int id, struct uvc_entity *entity)
375 entity = list_entry(&dev->entities, struct uvc_entity, list);
377 list_for_each_entry_continue(entity, &dev->entities, list) {
378 for (i = 0; i < entity->bNrInPins; ++i)
379 if (entity->baSourceID[i] == id)
386 static struct uvc_streaming *uvc_stream_by_id(struct uvc_device *dev, int id)
388 struct uvc_streaming *stream;
390 list_for_each_entry(stream, &dev->streams, list) {
391 if (stream->header.bTerminalLink == id)
398 /* ------------------------------------------------------------------------
399 * Streaming Object Management
402 static void uvc_stream_delete(struct uvc_streaming *stream)
404 if (stream->async_wq)
405 destroy_workqueue(stream->async_wq);
407 mutex_destroy(&stream->mutex);
409 usb_put_intf(stream->intf);
411 kfree(stream->format);
412 kfree(stream->header.bmaControls);
416 static struct uvc_streaming *uvc_stream_new(struct uvc_device *dev,
417 struct usb_interface *intf)
419 struct uvc_streaming *stream;
421 stream = kzalloc(sizeof(*stream), GFP_KERNEL);
425 mutex_init(&stream->mutex);
428 stream->intf = usb_get_intf(intf);
429 stream->intfnum = intf->cur_altsetting->desc.bInterfaceNumber;
431 /* Allocate a stream specific work queue for asynchronous tasks. */
432 stream->async_wq = alloc_workqueue("uvcvideo", WQ_UNBOUND | WQ_HIGHPRI,
434 if (!stream->async_wq) {
435 uvc_stream_delete(stream);
442 /* ------------------------------------------------------------------------
443 * Descriptors parsing
446 static int uvc_parse_format(struct uvc_device *dev,
447 struct uvc_streaming *streaming, struct uvc_format *format,
448 u32 **intervals, unsigned char *buffer, int buflen)
450 struct usb_interface *intf = streaming->intf;
451 struct usb_host_interface *alts = intf->cur_altsetting;
452 struct uvc_format_desc *fmtdesc;
453 struct uvc_frame *frame;
454 const unsigned char *start = buffer;
455 unsigned int width_multiplier = 1;
456 unsigned int interval;
460 format->type = buffer[2];
461 format->index = buffer[3];
464 case UVC_VS_FORMAT_UNCOMPRESSED:
465 case UVC_VS_FORMAT_FRAME_BASED:
466 n = buffer[2] == UVC_VS_FORMAT_UNCOMPRESSED ? 27 : 28;
468 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
469 "interface %d FORMAT error\n",
471 alts->desc.bInterfaceNumber);
475 /* Find the format descriptor from its GUID. */
476 fmtdesc = uvc_format_by_guid(&buffer[5]);
478 if (fmtdesc != NULL) {
479 strscpy(format->name, fmtdesc->name,
480 sizeof(format->name));
481 format->fcc = fmtdesc->fcc;
483 uvc_printk(KERN_INFO, "Unknown video format %pUl\n",
485 snprintf(format->name, sizeof(format->name), "%pUl\n",
490 format->bpp = buffer[21];
492 /* Some devices report a format that doesn't match what they
495 if (dev->quirks & UVC_QUIRK_FORCE_Y8) {
496 if (format->fcc == V4L2_PIX_FMT_YUYV) {
497 strscpy(format->name, "Greyscale 8-bit (Y8 )",
498 sizeof(format->name));
499 format->fcc = V4L2_PIX_FMT_GREY;
501 width_multiplier = 2;
505 if (buffer[2] == UVC_VS_FORMAT_UNCOMPRESSED) {
506 ftype = UVC_VS_FRAME_UNCOMPRESSED;
508 ftype = UVC_VS_FRAME_FRAME_BASED;
510 format->flags = UVC_FMT_FLAG_COMPRESSED;
514 case UVC_VS_FORMAT_MJPEG:
516 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
517 "interface %d FORMAT error\n",
519 alts->desc.bInterfaceNumber);
523 strscpy(format->name, "MJPEG", sizeof(format->name));
524 format->fcc = V4L2_PIX_FMT_MJPEG;
525 format->flags = UVC_FMT_FLAG_COMPRESSED;
527 ftype = UVC_VS_FRAME_MJPEG;
530 case UVC_VS_FORMAT_DV:
532 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
533 "interface %d FORMAT error\n",
535 alts->desc.bInterfaceNumber);
539 switch (buffer[8] & 0x7f) {
541 strscpy(format->name, "SD-DV", sizeof(format->name));
544 strscpy(format->name, "SDL-DV", sizeof(format->name));
547 strscpy(format->name, "HD-DV", sizeof(format->name));
550 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
551 "interface %d: unknown DV format %u\n",
553 alts->desc.bInterfaceNumber, buffer[8]);
557 strlcat(format->name, buffer[8] & (1 << 7) ? " 60Hz" : " 50Hz",
558 sizeof(format->name));
560 format->fcc = V4L2_PIX_FMT_DV;
561 format->flags = UVC_FMT_FLAG_COMPRESSED | UVC_FMT_FLAG_STREAM;
565 /* Create a dummy frame descriptor. */
566 frame = &format->frame[0];
567 memset(&format->frame[0], 0, sizeof(format->frame[0]));
568 frame->bFrameIntervalType = 1;
569 frame->dwDefaultFrameInterval = 1;
570 frame->dwFrameInterval = *intervals;
575 case UVC_VS_FORMAT_MPEG2TS:
576 case UVC_VS_FORMAT_STREAM_BASED:
577 /* Not supported yet. */
579 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
580 "interface %d unsupported format %u\n",
581 dev->udev->devnum, alts->desc.bInterfaceNumber,
586 uvc_trace(UVC_TRACE_DESCR, "Found format %s.\n", format->name);
591 /* Parse the frame descriptors. Only uncompressed, MJPEG and frame
592 * based formats have frame descriptors.
594 while (buflen > 2 && buffer[1] == USB_DT_CS_INTERFACE &&
595 buffer[2] == ftype) {
596 frame = &format->frame[format->nframes];
597 if (ftype != UVC_VS_FRAME_FRAME_BASED)
598 n = buflen > 25 ? buffer[25] : 0;
600 n = buflen > 21 ? buffer[21] : 0;
604 if (buflen < 26 + 4*n) {
605 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
606 "interface %d FRAME error\n", dev->udev->devnum,
607 alts->desc.bInterfaceNumber);
611 frame->bFrameIndex = buffer[3];
612 frame->bmCapabilities = buffer[4];
613 frame->wWidth = get_unaligned_le16(&buffer[5])
615 frame->wHeight = get_unaligned_le16(&buffer[7]);
616 frame->dwMinBitRate = get_unaligned_le32(&buffer[9]);
617 frame->dwMaxBitRate = get_unaligned_le32(&buffer[13]);
618 if (ftype != UVC_VS_FRAME_FRAME_BASED) {
619 frame->dwMaxVideoFrameBufferSize =
620 get_unaligned_le32(&buffer[17]);
621 frame->dwDefaultFrameInterval =
622 get_unaligned_le32(&buffer[21]);
623 frame->bFrameIntervalType = buffer[25];
625 frame->dwMaxVideoFrameBufferSize = 0;
626 frame->dwDefaultFrameInterval =
627 get_unaligned_le32(&buffer[17]);
628 frame->bFrameIntervalType = buffer[21];
630 frame->dwFrameInterval = *intervals;
632 /* Several UVC chipsets screw up dwMaxVideoFrameBufferSize
633 * completely. Observed behaviours range from setting the
634 * value to 1.1x the actual frame size to hardwiring the
635 * 16 low bits to 0. This results in a higher than necessary
636 * memory usage as well as a wrong image size information. For
637 * uncompressed formats this can be fixed by computing the
638 * value from the frame size.
640 if (!(format->flags & UVC_FMT_FLAG_COMPRESSED))
641 frame->dwMaxVideoFrameBufferSize = format->bpp
642 * frame->wWidth * frame->wHeight / 8;
644 /* Some bogus devices report dwMinFrameInterval equal to
645 * dwMaxFrameInterval and have dwFrameIntervalStep set to
646 * zero. Setting all null intervals to 1 fixes the problem and
647 * some other divisions by zero that could happen.
649 for (i = 0; i < n; ++i) {
650 interval = get_unaligned_le32(&buffer[26+4*i]);
651 *(*intervals)++ = interval ? interval : 1;
654 /* Make sure that the default frame interval stays between
657 n -= frame->bFrameIntervalType ? 1 : 2;
658 frame->dwDefaultFrameInterval =
659 min(frame->dwFrameInterval[n],
660 max(frame->dwFrameInterval[0],
661 frame->dwDefaultFrameInterval));
663 if (dev->quirks & UVC_QUIRK_RESTRICT_FRAME_RATE) {
664 frame->bFrameIntervalType = 1;
665 frame->dwFrameInterval[0] =
666 frame->dwDefaultFrameInterval;
669 uvc_trace(UVC_TRACE_DESCR, "- %ux%u (%u.%u fps)\n",
670 frame->wWidth, frame->wHeight,
671 10000000/frame->dwDefaultFrameInterval,
672 (100000000/frame->dwDefaultFrameInterval)%10);
679 if (buflen > 2 && buffer[1] == USB_DT_CS_INTERFACE &&
680 buffer[2] == UVC_VS_STILL_IMAGE_FRAME) {
685 if (buflen > 2 && buffer[1] == USB_DT_CS_INTERFACE &&
686 buffer[2] == UVC_VS_COLORFORMAT) {
688 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
689 "interface %d COLORFORMAT error\n",
691 alts->desc.bInterfaceNumber);
695 format->colorspace = uvc_colorspace(buffer[3]);
701 return buffer - start;
704 static int uvc_parse_streaming(struct uvc_device *dev,
705 struct usb_interface *intf)
707 struct uvc_streaming *streaming = NULL;
708 struct uvc_format *format;
709 struct uvc_frame *frame;
710 struct usb_host_interface *alts = &intf->altsetting[0];
711 unsigned char *_buffer, *buffer = alts->extra;
712 int _buflen, buflen = alts->extralen;
713 unsigned int nformats = 0, nframes = 0, nintervals = 0;
714 unsigned int size, i, n, p;
719 if (intf->cur_altsetting->desc.bInterfaceSubClass
720 != UVC_SC_VIDEOSTREAMING) {
721 uvc_trace(UVC_TRACE_DESCR, "device %d interface %d isn't a "
722 "video streaming interface\n", dev->udev->devnum,
723 intf->altsetting[0].desc.bInterfaceNumber);
727 if (usb_driver_claim_interface(&uvc_driver.driver, intf, dev)) {
728 uvc_trace(UVC_TRACE_DESCR, "device %d interface %d is already "
729 "claimed\n", dev->udev->devnum,
730 intf->altsetting[0].desc.bInterfaceNumber);
734 streaming = uvc_stream_new(dev, intf);
735 if (streaming == NULL) {
736 usb_driver_release_interface(&uvc_driver.driver, intf);
740 /* The Pico iMage webcam has its class-specific interface descriptors
741 * after the endpoint descriptors.
744 for (i = 0; i < alts->desc.bNumEndpoints; ++i) {
745 struct usb_host_endpoint *ep = &alts->endpoint[i];
747 if (ep->extralen == 0)
750 if (ep->extralen > 2 &&
751 ep->extra[1] == USB_DT_CS_INTERFACE) {
752 uvc_trace(UVC_TRACE_DESCR, "trying extra data "
753 "from endpoint %u.\n", i);
754 buffer = alts->endpoint[i].extra;
755 buflen = alts->endpoint[i].extralen;
761 /* Skip the standard interface descriptors. */
762 while (buflen > 2 && buffer[1] != USB_DT_CS_INTERFACE) {
768 uvc_trace(UVC_TRACE_DESCR, "no class-specific streaming "
769 "interface descriptors found.\n");
773 /* Parse the header descriptor. */
775 case UVC_VS_OUTPUT_HEADER:
776 streaming->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
780 case UVC_VS_INPUT_HEADER:
781 streaming->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
786 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming interface "
787 "%d HEADER descriptor not found.\n", dev->udev->devnum,
788 alts->desc.bInterfaceNumber);
792 p = buflen >= 4 ? buffer[3] : 0;
793 n = buflen >= size ? buffer[size-1] : 0;
795 if (buflen < size + p*n) {
796 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
797 "interface %d HEADER descriptor is invalid.\n",
798 dev->udev->devnum, alts->desc.bInterfaceNumber);
802 streaming->header.bNumFormats = p;
803 streaming->header.bEndpointAddress = buffer[6];
804 if (buffer[2] == UVC_VS_INPUT_HEADER) {
805 streaming->header.bmInfo = buffer[7];
806 streaming->header.bTerminalLink = buffer[8];
807 streaming->header.bStillCaptureMethod = buffer[9];
808 streaming->header.bTriggerSupport = buffer[10];
809 streaming->header.bTriggerUsage = buffer[11];
811 streaming->header.bTerminalLink = buffer[7];
813 streaming->header.bControlSize = n;
815 streaming->header.bmaControls = kmemdup(&buffer[size], p * n,
817 if (streaming->header.bmaControls == NULL) {
828 /* Count the format and frame descriptors. */
829 while (_buflen > 2 && _buffer[1] == USB_DT_CS_INTERFACE) {
830 switch (_buffer[2]) {
831 case UVC_VS_FORMAT_UNCOMPRESSED:
832 case UVC_VS_FORMAT_MJPEG:
833 case UVC_VS_FORMAT_FRAME_BASED:
837 case UVC_VS_FORMAT_DV:
838 /* DV format has no frame descriptor. We will create a
839 * dummy frame descriptor with a dummy frame interval.
846 case UVC_VS_FORMAT_MPEG2TS:
847 case UVC_VS_FORMAT_STREAM_BASED:
848 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
849 "interface %d FORMAT %u is not supported.\n",
851 alts->desc.bInterfaceNumber, _buffer[2]);
854 case UVC_VS_FRAME_UNCOMPRESSED:
855 case UVC_VS_FRAME_MJPEG:
858 nintervals += _buffer[25] ? _buffer[25] : 3;
861 case UVC_VS_FRAME_FRAME_BASED:
864 nintervals += _buffer[21] ? _buffer[21] : 3;
868 _buflen -= _buffer[0];
869 _buffer += _buffer[0];
873 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming interface "
874 "%d has no supported formats defined.\n",
875 dev->udev->devnum, alts->desc.bInterfaceNumber);
879 size = nformats * sizeof(*format) + nframes * sizeof(*frame)
880 + nintervals * sizeof(*interval);
881 format = kzalloc(size, GFP_KERNEL);
882 if (format == NULL) {
887 frame = (struct uvc_frame *)&format[nformats];
888 interval = (u32 *)&frame[nframes];
890 streaming->format = format;
891 streaming->nformats = nformats;
893 /* Parse the format descriptors. */
894 while (buflen > 2 && buffer[1] == USB_DT_CS_INTERFACE) {
896 case UVC_VS_FORMAT_UNCOMPRESSED:
897 case UVC_VS_FORMAT_MJPEG:
898 case UVC_VS_FORMAT_DV:
899 case UVC_VS_FORMAT_FRAME_BASED:
900 format->frame = frame;
901 ret = uvc_parse_format(dev, streaming, format,
902 &interval, buffer, buflen);
906 frame += format->nframes;
922 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming interface "
923 "%d has %u bytes of trailing descriptor garbage.\n",
924 dev->udev->devnum, alts->desc.bInterfaceNumber, buflen);
926 /* Parse the alternate settings to find the maximum bandwidth. */
927 for (i = 0; i < intf->num_altsetting; ++i) {
928 struct usb_host_endpoint *ep;
929 alts = &intf->altsetting[i];
930 ep = uvc_find_endpoint(alts,
931 streaming->header.bEndpointAddress);
935 psize = le16_to_cpu(ep->desc.wMaxPacketSize);
936 psize = (psize & 0x07ff) * (1 + ((psize >> 11) & 3));
937 if (psize > streaming->maxpsize)
938 streaming->maxpsize = psize;
941 list_add_tail(&streaming->list, &dev->streams);
945 usb_driver_release_interface(&uvc_driver.driver, intf);
946 uvc_stream_delete(streaming);
950 static struct uvc_entity *uvc_alloc_entity(u16 type, u8 id,
951 unsigned int num_pads, unsigned int extra_size)
953 struct uvc_entity *entity;
954 unsigned int num_inputs;
958 extra_size = roundup(extra_size, sizeof(*entity->pads));
959 num_inputs = (type & UVC_TERM_OUTPUT) ? num_pads : num_pads - 1;
960 size = sizeof(*entity) + extra_size + sizeof(*entity->pads) * num_pads
962 entity = kzalloc(size, GFP_KERNEL);
969 entity->num_links = 0;
970 entity->num_pads = num_pads;
971 entity->pads = ((void *)(entity + 1)) + extra_size;
973 for (i = 0; i < num_inputs; ++i)
974 entity->pads[i].flags = MEDIA_PAD_FL_SINK;
975 if (!UVC_ENTITY_IS_OTERM(entity))
976 entity->pads[num_pads-1].flags = MEDIA_PAD_FL_SOURCE;
978 entity->bNrInPins = num_inputs;
979 entity->baSourceID = (u8 *)(&entity->pads[num_pads]);
984 /* Parse vendor-specific extensions. */
985 static int uvc_parse_vendor_control(struct uvc_device *dev,
986 const unsigned char *buffer, int buflen)
988 struct usb_device *udev = dev->udev;
989 struct usb_host_interface *alts = dev->intf->cur_altsetting;
990 struct uvc_entity *unit;
994 switch (le16_to_cpu(dev->udev->descriptor.idVendor)) {
995 case 0x046d: /* Logitech */
996 if (buffer[1] != 0x41 || buffer[2] != 0x01)
999 /* Logitech implements several vendor specific functions
1000 * through vendor specific extension units (LXU).
1002 * The LXU descriptors are similar to XU descriptors
1003 * (see "USB Device Video Class for Video Devices", section
1004 * 3.7.2.6 "Extension Unit Descriptor") with the following
1007 * ----------------------------------------------------------
1008 * 0 bLength 1 Number
1009 * Size of this descriptor, in bytes: 24+p+n*2
1010 * ----------------------------------------------------------
1011 * 23+p+n bmControlsType N Bitmap
1012 * Individual bits in the set are defined:
1016 * This bitset is mapped exactly the same as bmControls.
1017 * ----------------------------------------------------------
1018 * 23+p+n*2 bReserved 1 Boolean
1019 * ----------------------------------------------------------
1020 * 24+p+n*2 iExtension 1 Index
1021 * Index of a string descriptor that describes this
1023 * ----------------------------------------------------------
1025 p = buflen >= 22 ? buffer[21] : 0;
1026 n = buflen >= 25 + p ? buffer[22+p] : 0;
1028 if (buflen < 25 + p + 2*n) {
1029 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
1030 "interface %d EXTENSION_UNIT error\n",
1031 udev->devnum, alts->desc.bInterfaceNumber);
1035 unit = uvc_alloc_entity(UVC_VC_EXTENSION_UNIT, buffer[3],
1040 memcpy(unit->extension.guidExtensionCode, &buffer[4], 16);
1041 unit->extension.bNumControls = buffer[20];
1042 memcpy(unit->baSourceID, &buffer[22], p);
1043 unit->extension.bControlSize = buffer[22+p];
1044 unit->extension.bmControls = (u8 *)unit + sizeof(*unit);
1045 unit->extension.bmControlsType = (u8 *)unit + sizeof(*unit)
1047 memcpy(unit->extension.bmControls, &buffer[23+p], 2*n);
1049 if (buffer[24+p+2*n] != 0)
1050 usb_string(udev, buffer[24+p+2*n], unit->name,
1051 sizeof(unit->name));
1053 sprintf(unit->name, "Extension %u", buffer[3]);
1055 list_add_tail(&unit->list, &dev->entities);
1063 static int uvc_parse_standard_control(struct uvc_device *dev,
1064 const unsigned char *buffer, int buflen)
1066 struct usb_device *udev = dev->udev;
1067 struct uvc_entity *unit, *term;
1068 struct usb_interface *intf;
1069 struct usb_host_interface *alts = dev->intf->cur_altsetting;
1070 unsigned int i, n, p, len;
1073 switch (buffer[2]) {
1075 n = buflen >= 12 ? buffer[11] : 0;
1077 if (buflen < 12 + n) {
1078 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
1079 "interface %d HEADER error\n", udev->devnum,
1080 alts->desc.bInterfaceNumber);
1084 dev->uvc_version = get_unaligned_le16(&buffer[3]);
1085 dev->clock_frequency = get_unaligned_le32(&buffer[7]);
1087 /* Parse all USB Video Streaming interfaces. */
1088 for (i = 0; i < n; ++i) {
1089 intf = usb_ifnum_to_if(udev, buffer[12+i]);
1091 uvc_trace(UVC_TRACE_DESCR, "device %d "
1092 "interface %d doesn't exists\n",
1097 uvc_parse_streaming(dev, intf);
1101 case UVC_VC_INPUT_TERMINAL:
1103 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
1104 "interface %d INPUT_TERMINAL error\n",
1105 udev->devnum, alts->desc.bInterfaceNumber);
1110 * Reject invalid terminal types that would cause issues:
1112 * - The high byte must be non-zero, otherwise it would be
1113 * confused with a unit.
1115 * - Bit 15 must be 0, as we use it internally as a terminal
1118 * Other unknown types are accepted.
1120 type = get_unaligned_le16(&buffer[4]);
1121 if ((type & 0x7f00) == 0 || (type & 0x8000) != 0) {
1122 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
1123 "interface %d INPUT_TERMINAL %d has invalid "
1124 "type 0x%04x, skipping\n", udev->devnum,
1125 alts->desc.bInterfaceNumber,
1134 if (type == UVC_ITT_CAMERA) {
1135 n = buflen >= 15 ? buffer[14] : 0;
1138 } else if (type == UVC_ITT_MEDIA_TRANSPORT_INPUT) {
1139 n = buflen >= 9 ? buffer[8] : 0;
1140 p = buflen >= 10 + n ? buffer[9+n] : 0;
1144 if (buflen < len + n + p) {
1145 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
1146 "interface %d INPUT_TERMINAL error\n",
1147 udev->devnum, alts->desc.bInterfaceNumber);
1151 term = uvc_alloc_entity(type | UVC_TERM_INPUT, buffer[3],
1156 if (UVC_ENTITY_TYPE(term) == UVC_ITT_CAMERA) {
1157 term->camera.bControlSize = n;
1158 term->camera.bmControls = (u8 *)term + sizeof(*term);
1159 term->camera.wObjectiveFocalLengthMin =
1160 get_unaligned_le16(&buffer[8]);
1161 term->camera.wObjectiveFocalLengthMax =
1162 get_unaligned_le16(&buffer[10]);
1163 term->camera.wOcularFocalLength =
1164 get_unaligned_le16(&buffer[12]);
1165 memcpy(term->camera.bmControls, &buffer[15], n);
1166 } else if (UVC_ENTITY_TYPE(term) ==
1167 UVC_ITT_MEDIA_TRANSPORT_INPUT) {
1168 term->media.bControlSize = n;
1169 term->media.bmControls = (u8 *)term + sizeof(*term);
1170 term->media.bTransportModeSize = p;
1171 term->media.bmTransportModes = (u8 *)term
1172 + sizeof(*term) + n;
1173 memcpy(term->media.bmControls, &buffer[9], n);
1174 memcpy(term->media.bmTransportModes, &buffer[10+n], p);
1178 usb_string(udev, buffer[7], term->name,
1179 sizeof(term->name));
1180 else if (UVC_ENTITY_TYPE(term) == UVC_ITT_CAMERA)
1181 sprintf(term->name, "Camera %u", buffer[3]);
1182 else if (UVC_ENTITY_TYPE(term) == UVC_ITT_MEDIA_TRANSPORT_INPUT)
1183 sprintf(term->name, "Media %u", buffer[3]);
1185 sprintf(term->name, "Input %u", buffer[3]);
1187 list_add_tail(&term->list, &dev->entities);
1190 case UVC_VC_OUTPUT_TERMINAL:
1192 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
1193 "interface %d OUTPUT_TERMINAL error\n",
1194 udev->devnum, alts->desc.bInterfaceNumber);
1198 /* Make sure the terminal type MSB is not null, otherwise it
1199 * could be confused with a unit.
1201 type = get_unaligned_le16(&buffer[4]);
1202 if ((type & 0xff00) == 0) {
1203 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
1204 "interface %d OUTPUT_TERMINAL %d has invalid "
1205 "type 0x%04x, skipping\n", udev->devnum,
1206 alts->desc.bInterfaceNumber, buffer[3], type);
1210 term = uvc_alloc_entity(type | UVC_TERM_OUTPUT, buffer[3],
1215 memcpy(term->baSourceID, &buffer[7], 1);
1218 usb_string(udev, buffer[8], term->name,
1219 sizeof(term->name));
1221 sprintf(term->name, "Output %u", buffer[3]);
1223 list_add_tail(&term->list, &dev->entities);
1226 case UVC_VC_SELECTOR_UNIT:
1227 p = buflen >= 5 ? buffer[4] : 0;
1229 if (buflen < 5 || buflen < 6 + p) {
1230 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
1231 "interface %d SELECTOR_UNIT error\n",
1232 udev->devnum, alts->desc.bInterfaceNumber);
1236 unit = uvc_alloc_entity(buffer[2], buffer[3], p + 1, 0);
1240 memcpy(unit->baSourceID, &buffer[5], p);
1242 if (buffer[5+p] != 0)
1243 usb_string(udev, buffer[5+p], unit->name,
1244 sizeof(unit->name));
1246 sprintf(unit->name, "Selector %u", buffer[3]);
1248 list_add_tail(&unit->list, &dev->entities);
1251 case UVC_VC_PROCESSING_UNIT:
1252 n = buflen >= 8 ? buffer[7] : 0;
1253 p = dev->uvc_version >= 0x0110 ? 10 : 9;
1255 if (buflen < p + n) {
1256 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
1257 "interface %d PROCESSING_UNIT error\n",
1258 udev->devnum, alts->desc.bInterfaceNumber);
1262 unit = uvc_alloc_entity(buffer[2], buffer[3], 2, n);
1266 memcpy(unit->baSourceID, &buffer[4], 1);
1267 unit->processing.wMaxMultiplier =
1268 get_unaligned_le16(&buffer[5]);
1269 unit->processing.bControlSize = buffer[7];
1270 unit->processing.bmControls = (u8 *)unit + sizeof(*unit);
1271 memcpy(unit->processing.bmControls, &buffer[8], n);
1272 if (dev->uvc_version >= 0x0110)
1273 unit->processing.bmVideoStandards = buffer[9+n];
1275 if (buffer[8+n] != 0)
1276 usb_string(udev, buffer[8+n], unit->name,
1277 sizeof(unit->name));
1279 sprintf(unit->name, "Processing %u", buffer[3]);
1281 list_add_tail(&unit->list, &dev->entities);
1284 case UVC_VC_EXTENSION_UNIT:
1285 p = buflen >= 22 ? buffer[21] : 0;
1286 n = buflen >= 24 + p ? buffer[22+p] : 0;
1288 if (buflen < 24 + p + n) {
1289 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
1290 "interface %d EXTENSION_UNIT error\n",
1291 udev->devnum, alts->desc.bInterfaceNumber);
1295 unit = uvc_alloc_entity(buffer[2], buffer[3], p + 1, n);
1299 memcpy(unit->extension.guidExtensionCode, &buffer[4], 16);
1300 unit->extension.bNumControls = buffer[20];
1301 memcpy(unit->baSourceID, &buffer[22], p);
1302 unit->extension.bControlSize = buffer[22+p];
1303 unit->extension.bmControls = (u8 *)unit + sizeof(*unit);
1304 memcpy(unit->extension.bmControls, &buffer[23+p], n);
1306 if (buffer[23+p+n] != 0)
1307 usb_string(udev, buffer[23+p+n], unit->name,
1308 sizeof(unit->name));
1310 sprintf(unit->name, "Extension %u", buffer[3]);
1312 list_add_tail(&unit->list, &dev->entities);
1316 uvc_trace(UVC_TRACE_DESCR, "Found an unknown CS_INTERFACE "
1317 "descriptor (%u)\n", buffer[2]);
1324 static int uvc_parse_control(struct uvc_device *dev)
1326 struct usb_host_interface *alts = dev->intf->cur_altsetting;
1327 unsigned char *buffer = alts->extra;
1328 int buflen = alts->extralen;
1331 /* Parse the default alternate setting only, as the UVC specification
1332 * defines a single alternate setting, the default alternate setting
1336 while (buflen > 2) {
1337 if (uvc_parse_vendor_control(dev, buffer, buflen) ||
1338 buffer[1] != USB_DT_CS_INTERFACE)
1339 goto next_descriptor;
1341 if ((ret = uvc_parse_standard_control(dev, buffer, buflen)) < 0)
1345 buflen -= buffer[0];
1346 buffer += buffer[0];
1349 /* Check if the optional status endpoint is present. Built-in iSight
1350 * webcams have an interrupt endpoint but spit proprietary data that
1351 * don't conform to the UVC status endpoint messages. Don't try to
1352 * handle the interrupt endpoint for those cameras.
1354 if (alts->desc.bNumEndpoints == 1 &&
1355 !(dev->quirks & UVC_QUIRK_BUILTIN_ISIGHT)) {
1356 struct usb_host_endpoint *ep = &alts->endpoint[0];
1357 struct usb_endpoint_descriptor *desc = &ep->desc;
1359 if (usb_endpoint_is_int_in(desc) &&
1360 le16_to_cpu(desc->wMaxPacketSize) >= 8 &&
1361 desc->bInterval != 0) {
1362 uvc_trace(UVC_TRACE_DESCR, "Found a Status endpoint "
1363 "(addr %02x).\n", desc->bEndpointAddress);
1371 /* ------------------------------------------------------------------------
1376 * Scan the UVC descriptors to locate a chain starting at an Output Terminal
1377 * and containing the following units:
1379 * - one or more Output Terminals (USB Streaming or Display)
1380 * - zero or one Processing Unit
1381 * - zero, one or more single-input Selector Units
1382 * - zero or one multiple-input Selector Units, provided all inputs are
1383 * connected to input terminals
1384 * - zero, one or mode single-input Extension Units
1385 * - one or more Input Terminals (Camera, External or USB Streaming)
1387 * The terminal and units must match on of the following structures:
1389 * ITT_*(0) -> +---------+ +---------+ +---------+ -> TT_STREAMING(0)
1390 * ... | SU{0,1} | -> | PU{0,1} | -> | XU{0,n} | ...
1391 * ITT_*(n) -> +---------+ +---------+ +---------+ -> TT_STREAMING(n)
1393 * +---------+ +---------+ -> OTT_*(0)
1394 * TT_STREAMING -> | PU{0,1} | -> | XU{0,n} | ...
1395 * +---------+ +---------+ -> OTT_*(n)
1397 * The Processing Unit and Extension Units can be in any order. Additional
1398 * Extension Units connected to the main chain as single-unit branches are
1399 * also supported. Single-input Selector Units are ignored.
1401 static int uvc_scan_chain_entity(struct uvc_video_chain *chain,
1402 struct uvc_entity *entity)
1404 switch (UVC_ENTITY_TYPE(entity)) {
1405 case UVC_VC_EXTENSION_UNIT:
1406 if (uvc_trace_param & UVC_TRACE_PROBE)
1407 printk(KERN_CONT " <- XU %d", entity->id);
1409 if (entity->bNrInPins != 1) {
1410 uvc_trace(UVC_TRACE_DESCR, "Extension unit %d has more "
1411 "than 1 input pin.\n", entity->id);
1417 case UVC_VC_PROCESSING_UNIT:
1418 if (uvc_trace_param & UVC_TRACE_PROBE)
1419 printk(KERN_CONT " <- PU %d", entity->id);
1421 if (chain->processing != NULL) {
1422 uvc_trace(UVC_TRACE_DESCR, "Found multiple "
1423 "Processing Units in chain.\n");
1427 chain->processing = entity;
1430 case UVC_VC_SELECTOR_UNIT:
1431 if (uvc_trace_param & UVC_TRACE_PROBE)
1432 printk(KERN_CONT " <- SU %d", entity->id);
1434 /* Single-input selector units are ignored. */
1435 if (entity->bNrInPins == 1)
1438 if (chain->selector != NULL) {
1439 uvc_trace(UVC_TRACE_DESCR, "Found multiple Selector "
1440 "Units in chain.\n");
1444 chain->selector = entity;
1447 case UVC_ITT_VENDOR_SPECIFIC:
1448 case UVC_ITT_CAMERA:
1449 case UVC_ITT_MEDIA_TRANSPORT_INPUT:
1450 if (uvc_trace_param & UVC_TRACE_PROBE)
1451 printk(KERN_CONT " <- IT %d\n", entity->id);
1455 case UVC_OTT_VENDOR_SPECIFIC:
1456 case UVC_OTT_DISPLAY:
1457 case UVC_OTT_MEDIA_TRANSPORT_OUTPUT:
1458 if (uvc_trace_param & UVC_TRACE_PROBE)
1459 printk(KERN_CONT " OT %d", entity->id);
1463 case UVC_TT_STREAMING:
1464 if (UVC_ENTITY_IS_ITERM(entity)) {
1465 if (uvc_trace_param & UVC_TRACE_PROBE)
1466 printk(KERN_CONT " <- IT %d\n", entity->id);
1468 if (uvc_trace_param & UVC_TRACE_PROBE)
1469 printk(KERN_CONT " OT %d", entity->id);
1475 uvc_trace(UVC_TRACE_DESCR, "Unsupported entity type "
1476 "0x%04x found in chain.\n", UVC_ENTITY_TYPE(entity));
1480 list_add_tail(&entity->chain, &chain->entities);
1484 static int uvc_scan_chain_forward(struct uvc_video_chain *chain,
1485 struct uvc_entity *entity, struct uvc_entity *prev)
1487 struct uvc_entity *forward;
1495 forward = uvc_entity_by_reference(chain->dev, entity->id,
1497 if (forward == NULL)
1499 if (forward == prev)
1502 switch (UVC_ENTITY_TYPE(forward)) {
1503 case UVC_VC_EXTENSION_UNIT:
1504 if (forward->bNrInPins != 1) {
1505 uvc_trace(UVC_TRACE_DESCR, "Extension unit %d "
1506 "has more than 1 input pin.\n",
1511 list_add_tail(&forward->chain, &chain->entities);
1512 if (uvc_trace_param & UVC_TRACE_PROBE) {
1514 printk(KERN_CONT " (->");
1516 printk(KERN_CONT " XU %d", forward->id);
1521 case UVC_OTT_VENDOR_SPECIFIC:
1522 case UVC_OTT_DISPLAY:
1523 case UVC_OTT_MEDIA_TRANSPORT_OUTPUT:
1524 case UVC_TT_STREAMING:
1525 if (UVC_ENTITY_IS_ITERM(forward)) {
1526 uvc_trace(UVC_TRACE_DESCR, "Unsupported input "
1527 "terminal %u.\n", forward->id);
1531 list_add_tail(&forward->chain, &chain->entities);
1532 if (uvc_trace_param & UVC_TRACE_PROBE) {
1534 printk(KERN_CONT " (->");
1536 printk(KERN_CONT " OT %d", forward->id);
1543 printk(KERN_CONT ")");
1548 static int uvc_scan_chain_backward(struct uvc_video_chain *chain,
1549 struct uvc_entity **_entity)
1551 struct uvc_entity *entity = *_entity;
1552 struct uvc_entity *term;
1553 int id = -EINVAL, i;
1555 switch (UVC_ENTITY_TYPE(entity)) {
1556 case UVC_VC_EXTENSION_UNIT:
1557 case UVC_VC_PROCESSING_UNIT:
1558 id = entity->baSourceID[0];
1561 case UVC_VC_SELECTOR_UNIT:
1562 /* Single-input selector units are ignored. */
1563 if (entity->bNrInPins == 1) {
1564 id = entity->baSourceID[0];
1568 if (uvc_trace_param & UVC_TRACE_PROBE)
1569 printk(KERN_CONT " <- IT");
1571 chain->selector = entity;
1572 for (i = 0; i < entity->bNrInPins; ++i) {
1573 id = entity->baSourceID[i];
1574 term = uvc_entity_by_id(chain->dev, id);
1575 if (term == NULL || !UVC_ENTITY_IS_ITERM(term)) {
1576 uvc_trace(UVC_TRACE_DESCR, "Selector unit %d "
1577 "input %d isn't connected to an "
1578 "input terminal\n", entity->id, i);
1582 if (uvc_trace_param & UVC_TRACE_PROBE)
1583 printk(KERN_CONT " %d", term->id);
1585 list_add_tail(&term->chain, &chain->entities);
1586 uvc_scan_chain_forward(chain, term, entity);
1589 if (uvc_trace_param & UVC_TRACE_PROBE)
1590 printk(KERN_CONT "\n");
1595 case UVC_ITT_VENDOR_SPECIFIC:
1596 case UVC_ITT_CAMERA:
1597 case UVC_ITT_MEDIA_TRANSPORT_INPUT:
1598 case UVC_OTT_VENDOR_SPECIFIC:
1599 case UVC_OTT_DISPLAY:
1600 case UVC_OTT_MEDIA_TRANSPORT_OUTPUT:
1601 case UVC_TT_STREAMING:
1602 id = UVC_ENTITY_IS_OTERM(entity) ? entity->baSourceID[0] : 0;
1611 entity = uvc_entity_by_id(chain->dev, id);
1612 if (entity == NULL) {
1613 uvc_trace(UVC_TRACE_DESCR, "Found reference to "
1614 "unknown entity %d.\n", id);
1622 static int uvc_scan_chain(struct uvc_video_chain *chain,
1623 struct uvc_entity *term)
1625 struct uvc_entity *entity, *prev;
1627 uvc_trace(UVC_TRACE_PROBE, "Scanning UVC chain:");
1632 while (entity != NULL) {
1633 /* Entity must not be part of an existing chain */
1634 if (entity->chain.next || entity->chain.prev) {
1635 uvc_trace(UVC_TRACE_DESCR, "Found reference to "
1636 "entity %d already in chain.\n", entity->id);
1640 /* Process entity */
1641 if (uvc_scan_chain_entity(chain, entity) < 0)
1645 if (uvc_scan_chain_forward(chain, entity, prev) < 0)
1650 if (uvc_scan_chain_backward(chain, &entity) < 0)
1657 static unsigned int uvc_print_terms(struct list_head *terms, u16 dir,
1660 struct uvc_entity *term;
1661 unsigned int nterms = 0;
1664 list_for_each_entry(term, terms, chain) {
1665 if (!UVC_ENTITY_IS_TERM(term) ||
1666 UVC_TERM_DIRECTION(term) != dir)
1670 p += sprintf(p, ",");
1671 if (++nterms >= 4) {
1672 p += sprintf(p, "...");
1675 p += sprintf(p, "%u", term->id);
1681 static const char *uvc_print_chain(struct uvc_video_chain *chain)
1683 static char buffer[43];
1686 p += uvc_print_terms(&chain->entities, UVC_TERM_INPUT, p);
1687 p += sprintf(p, " -> ");
1688 uvc_print_terms(&chain->entities, UVC_TERM_OUTPUT, p);
1693 static struct uvc_video_chain *uvc_alloc_chain(struct uvc_device *dev)
1695 struct uvc_video_chain *chain;
1697 chain = kzalloc(sizeof(*chain), GFP_KERNEL);
1701 INIT_LIST_HEAD(&chain->entities);
1702 mutex_init(&chain->ctrl_mutex);
1704 v4l2_prio_init(&chain->prio);
1710 * Fallback heuristic for devices that don't connect units and terminals in a
1713 * Some devices have invalid baSourceID references, causing uvc_scan_chain()
1714 * to fail, but if we just take the entities we can find and put them together
1715 * in the most sensible chain we can think of, turns out they do work anyway.
1716 * Note: This heuristic assumes there is a single chain.
1718 * At the time of writing, devices known to have such a broken chain are
1719 * - Acer Integrated Camera (5986:055a)
1720 * - Realtek rtl157a7 (0bda:57a7)
1722 static int uvc_scan_fallback(struct uvc_device *dev)
1724 struct uvc_video_chain *chain;
1725 struct uvc_entity *iterm = NULL;
1726 struct uvc_entity *oterm = NULL;
1727 struct uvc_entity *entity;
1728 struct uvc_entity *prev;
1731 * Start by locating the input and output terminals. We only support
1732 * devices with exactly one of each for now.
1734 list_for_each_entry(entity, &dev->entities, list) {
1735 if (UVC_ENTITY_IS_ITERM(entity)) {
1741 if (UVC_ENTITY_IS_OTERM(entity)) {
1748 if (iterm == NULL || oterm == NULL)
1751 /* Allocate the chain and fill it. */
1752 chain = uvc_alloc_chain(dev);
1756 if (uvc_scan_chain_entity(chain, oterm) < 0)
1762 * Add all Processing and Extension Units with two pads. The order
1763 * doesn't matter much, use reverse list traversal to connect units in
1764 * UVC descriptor order as we build the chain from output to input. This
1765 * leads to units appearing in the order meant by the manufacturer for
1766 * the cameras known to require this heuristic.
1768 list_for_each_entry_reverse(entity, &dev->entities, list) {
1769 if (entity->type != UVC_VC_PROCESSING_UNIT &&
1770 entity->type != UVC_VC_EXTENSION_UNIT)
1773 if (entity->num_pads != 2)
1776 if (uvc_scan_chain_entity(chain, entity) < 0)
1779 prev->baSourceID[0] = entity->id;
1783 if (uvc_scan_chain_entity(chain, iterm) < 0)
1786 prev->baSourceID[0] = iterm->id;
1788 list_add_tail(&chain->list, &dev->chains);
1790 uvc_trace(UVC_TRACE_PROBE,
1791 "Found a video chain by fallback heuristic (%s).\n",
1792 uvc_print_chain(chain));
1802 * Scan the device for video chains and register video devices.
1804 * Chains are scanned starting at their output terminals and walked backwards.
1806 static int uvc_scan_device(struct uvc_device *dev)
1808 struct uvc_video_chain *chain;
1809 struct uvc_entity *term;
1811 list_for_each_entry(term, &dev->entities, list) {
1812 if (!UVC_ENTITY_IS_OTERM(term))
1815 /* If the terminal is already included in a chain, skip it.
1816 * This can happen for chains that have multiple output
1817 * terminals, where all output terminals beside the first one
1818 * will be inserted in the chain in forward scans.
1820 if (term->chain.next || term->chain.prev)
1823 chain = uvc_alloc_chain(dev);
1827 term->flags |= UVC_ENTITY_FLAG_DEFAULT;
1829 if (uvc_scan_chain(chain, term) < 0) {
1834 uvc_trace(UVC_TRACE_PROBE, "Found a valid video chain (%s).\n",
1835 uvc_print_chain(chain));
1837 list_add_tail(&chain->list, &dev->chains);
1840 if (list_empty(&dev->chains))
1841 uvc_scan_fallback(dev);
1843 if (list_empty(&dev->chains)) {
1844 uvc_printk(KERN_INFO, "No valid video chain found.\n");
1851 /* ------------------------------------------------------------------------
1852 * Video device registration and unregistration
1856 * Delete the UVC device.
1858 * Called by the kernel when the last reference to the uvc_device structure
1861 * As this function is called after or during disconnect(), all URBs have
1862 * already been cancelled by the USB core. There is no need to kill the
1863 * interrupt URB manually.
1865 static void uvc_delete(struct kref *kref)
1867 struct uvc_device *dev = container_of(kref, struct uvc_device, ref);
1868 struct list_head *p, *n;
1870 uvc_status_cleanup(dev);
1871 uvc_ctrl_cleanup_device(dev);
1873 usb_put_intf(dev->intf);
1874 usb_put_dev(dev->udev);
1876 #ifdef CONFIG_MEDIA_CONTROLLER
1877 media_device_cleanup(&dev->mdev);
1880 list_for_each_safe(p, n, &dev->chains) {
1881 struct uvc_video_chain *chain;
1882 chain = list_entry(p, struct uvc_video_chain, list);
1886 list_for_each_safe(p, n, &dev->entities) {
1887 struct uvc_entity *entity;
1888 entity = list_entry(p, struct uvc_entity, list);
1889 #ifdef CONFIG_MEDIA_CONTROLLER
1890 uvc_mc_cleanup_entity(entity);
1895 list_for_each_safe(p, n, &dev->streams) {
1896 struct uvc_streaming *streaming;
1897 streaming = list_entry(p, struct uvc_streaming, list);
1898 usb_driver_release_interface(&uvc_driver.driver,
1900 uvc_stream_delete(streaming);
1906 static void uvc_release(struct video_device *vdev)
1908 struct uvc_streaming *stream = video_get_drvdata(vdev);
1909 struct uvc_device *dev = stream->dev;
1911 kref_put(&dev->ref, uvc_delete);
1915 * Unregister the video devices.
1917 static void uvc_unregister_video(struct uvc_device *dev)
1919 struct uvc_streaming *stream;
1921 list_for_each_entry(stream, &dev->streams, list) {
1922 if (!video_is_registered(&stream->vdev))
1925 video_unregister_device(&stream->vdev);
1926 video_unregister_device(&stream->meta.vdev);
1928 uvc_debugfs_cleanup_stream(stream);
1931 uvc_status_unregister(dev);
1934 v4l2_device_unregister(&dev->vdev);
1935 #ifdef CONFIG_MEDIA_CONTROLLER
1936 if (media_devnode_is_registered(dev->mdev.devnode))
1937 media_device_unregister(&dev->mdev);
1941 int uvc_register_video_device(struct uvc_device *dev,
1942 struct uvc_streaming *stream,
1943 struct video_device *vdev,
1944 struct uvc_video_queue *queue,
1945 enum v4l2_buf_type type,
1946 const struct v4l2_file_operations *fops,
1947 const struct v4l2_ioctl_ops *ioctl_ops)
1951 /* Initialize the video buffers queue. */
1952 ret = uvc_queue_init(queue, type, !uvc_no_drop_param);
1956 /* Register the device with V4L. */
1959 * We already hold a reference to dev->udev. The video device will be
1960 * unregistered before the reference is released, so we don't need to
1963 vdev->v4l2_dev = &dev->vdev;
1965 vdev->ioctl_ops = ioctl_ops;
1966 vdev->release = uvc_release;
1967 vdev->prio = &stream->chain->prio;
1968 if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
1969 vdev->vfl_dir = VFL_DIR_TX;
1971 vdev->vfl_dir = VFL_DIR_RX;
1974 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
1976 vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
1978 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
1979 vdev->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
1981 case V4L2_BUF_TYPE_META_CAPTURE:
1982 vdev->device_caps = V4L2_CAP_META_CAPTURE | V4L2_CAP_STREAMING;
1986 strscpy(vdev->name, dev->name, sizeof(vdev->name));
1989 * Set the driver data before calling video_register_device, otherwise
1990 * the file open() handler might race us.
1992 video_set_drvdata(vdev, stream);
1994 ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1);
1996 uvc_printk(KERN_ERR, "Failed to register %s device (%d).\n",
1997 v4l2_type_names[type], ret);
2001 kref_get(&dev->ref);
2005 static int uvc_register_video(struct uvc_device *dev,
2006 struct uvc_streaming *stream)
2010 /* Initialize the streaming interface with default parameters. */
2011 ret = uvc_video_init(stream);
2013 uvc_printk(KERN_ERR, "Failed to initialize the device (%d).\n",
2018 if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
2019 stream->chain->caps |= V4L2_CAP_VIDEO_CAPTURE
2020 | V4L2_CAP_META_CAPTURE;
2022 stream->chain->caps |= V4L2_CAP_VIDEO_OUTPUT;
2024 uvc_debugfs_init_stream(stream);
2026 /* Register the device with V4L. */
2027 return uvc_register_video_device(dev, stream, &stream->vdev,
2028 &stream->queue, stream->type,
2029 &uvc_fops, &uvc_ioctl_ops);
2033 * Register all video devices in all chains.
2035 static int uvc_register_terms(struct uvc_device *dev,
2036 struct uvc_video_chain *chain)
2038 struct uvc_streaming *stream;
2039 struct uvc_entity *term;
2042 list_for_each_entry(term, &chain->entities, chain) {
2043 if (UVC_ENTITY_TYPE(term) != UVC_TT_STREAMING)
2046 stream = uvc_stream_by_id(dev, term->id);
2047 if (stream == NULL) {
2048 uvc_printk(KERN_INFO, "No streaming interface found "
2049 "for terminal %u.", term->id);
2053 stream->chain = chain;
2054 ret = uvc_register_video(dev, stream);
2058 /* Register a metadata node, but ignore a possible failure,
2059 * complete registration of video nodes anyway.
2061 uvc_meta_register(stream);
2063 term->vdev = &stream->vdev;
2069 static int uvc_register_chains(struct uvc_device *dev)
2071 struct uvc_video_chain *chain;
2074 list_for_each_entry(chain, &dev->chains, list) {
2075 ret = uvc_register_terms(dev, chain);
2079 #ifdef CONFIG_MEDIA_CONTROLLER
2080 ret = uvc_mc_register_entities(chain);
2082 uvc_printk(KERN_INFO,
2083 "Failed to register entities (%d).\n", ret);
2090 /* ------------------------------------------------------------------------
2091 * USB probe, disconnect, suspend and resume
2094 static const struct uvc_device_info uvc_quirk_none = { 0 };
2096 static int uvc_probe(struct usb_interface *intf,
2097 const struct usb_device_id *id)
2099 struct usb_device *udev = interface_to_usbdev(intf);
2100 struct uvc_device *dev;
2101 const struct uvc_device_info *info =
2102 (const struct uvc_device_info *)id->driver_info;
2106 if (id->idVendor && id->idProduct)
2107 uvc_trace(UVC_TRACE_PROBE, "Probing known UVC device %s "
2108 "(%04x:%04x)\n", udev->devpath, id->idVendor,
2111 uvc_trace(UVC_TRACE_PROBE, "Probing generic UVC device %s\n",
2114 /* Allocate memory for the device and initialize it. */
2115 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
2119 INIT_LIST_HEAD(&dev->entities);
2120 INIT_LIST_HEAD(&dev->chains);
2121 INIT_LIST_HEAD(&dev->streams);
2122 kref_init(&dev->ref);
2123 atomic_set(&dev->nmappings, 0);
2124 mutex_init(&dev->lock);
2126 dev->udev = usb_get_dev(udev);
2127 dev->intf = usb_get_intf(intf);
2128 dev->intfnum = intf->cur_altsetting->desc.bInterfaceNumber;
2129 dev->info = info ? info : &uvc_quirk_none;
2130 dev->quirks = uvc_quirks_param == -1
2131 ? dev->info->quirks : uvc_quirks_param;
2133 if (udev->product != NULL)
2134 strscpy(dev->name, udev->product, sizeof(dev->name));
2136 snprintf(dev->name, sizeof(dev->name),
2137 "UVC Camera (%04x:%04x)",
2138 le16_to_cpu(udev->descriptor.idVendor),
2139 le16_to_cpu(udev->descriptor.idProduct));
2142 * Add iFunction or iInterface to names when available as additional
2143 * distinguishers between interfaces. iFunction is prioritized over
2144 * iInterface which matches Windows behavior at the point of writing.
2146 if (intf->intf_assoc && intf->intf_assoc->iFunction != 0)
2147 function = intf->intf_assoc->iFunction;
2149 function = intf->cur_altsetting->desc.iInterface;
2150 if (function != 0) {
2153 strlcat(dev->name, ": ", sizeof(dev->name));
2154 len = strlen(dev->name);
2155 usb_string(udev, function, dev->name + len,
2156 sizeof(dev->name) - len);
2159 /* Parse the Video Class control descriptor. */
2160 if (uvc_parse_control(dev) < 0) {
2161 uvc_trace(UVC_TRACE_PROBE, "Unable to parse UVC "
2166 uvc_printk(KERN_INFO, "Found UVC %u.%02x device %s (%04x:%04x)\n",
2167 dev->uvc_version >> 8, dev->uvc_version & 0xff,
2168 udev->product ? udev->product : "<unnamed>",
2169 le16_to_cpu(udev->descriptor.idVendor),
2170 le16_to_cpu(udev->descriptor.idProduct));
2172 if (dev->quirks != dev->info->quirks) {
2173 uvc_printk(KERN_INFO, "Forcing device quirks to 0x%x by module "
2174 "parameter for testing purpose.\n", dev->quirks);
2175 uvc_printk(KERN_INFO, "Please report required quirks to the "
2176 "linux-uvc-devel mailing list.\n");
2179 /* Initialize the media device and register the V4L2 device. */
2180 #ifdef CONFIG_MEDIA_CONTROLLER
2181 dev->mdev.dev = &intf->dev;
2182 strscpy(dev->mdev.model, dev->name, sizeof(dev->mdev.model));
2184 strscpy(dev->mdev.serial, udev->serial,
2185 sizeof(dev->mdev.serial));
2186 usb_make_path(udev, dev->mdev.bus_info, sizeof(dev->mdev.bus_info));
2187 dev->mdev.hw_revision = le16_to_cpu(udev->descriptor.bcdDevice);
2188 media_device_init(&dev->mdev);
2190 dev->vdev.mdev = &dev->mdev;
2192 if (v4l2_device_register(&intf->dev, &dev->vdev) < 0)
2195 /* Initialize controls. */
2196 if (uvc_ctrl_init_device(dev) < 0)
2199 /* Scan the device for video chains. */
2200 if (uvc_scan_device(dev) < 0)
2203 /* Register video device nodes. */
2204 if (uvc_register_chains(dev) < 0)
2207 #ifdef CONFIG_MEDIA_CONTROLLER
2208 /* Register the media device node */
2209 if (media_device_register(&dev->mdev) < 0)
2212 /* Save our data pointer in the interface data. */
2213 usb_set_intfdata(intf, dev);
2215 /* Initialize the interrupt URB. */
2216 if ((ret = uvc_status_init(dev)) < 0) {
2217 uvc_printk(KERN_INFO, "Unable to initialize the status "
2218 "endpoint (%d), status interrupt will not be "
2219 "supported.\n", ret);
2222 uvc_trace(UVC_TRACE_PROBE, "UVC device initialized.\n");
2223 usb_enable_autosuspend(udev);
2227 uvc_unregister_video(dev);
2228 kref_put(&dev->ref, uvc_delete);
2232 static void uvc_disconnect(struct usb_interface *intf)
2234 struct uvc_device *dev = usb_get_intfdata(intf);
2236 /* Set the USB interface data to NULL. This can be done outside the
2237 * lock, as there's no other reader.
2239 usb_set_intfdata(intf, NULL);
2241 if (intf->cur_altsetting->desc.bInterfaceSubClass ==
2242 UVC_SC_VIDEOSTREAMING)
2245 uvc_unregister_video(dev);
2246 kref_put(&dev->ref, uvc_delete);
2249 static int uvc_suspend(struct usb_interface *intf, pm_message_t message)
2251 struct uvc_device *dev = usb_get_intfdata(intf);
2252 struct uvc_streaming *stream;
2254 uvc_trace(UVC_TRACE_SUSPEND, "Suspending interface %u\n",
2255 intf->cur_altsetting->desc.bInterfaceNumber);
2257 /* Controls are cached on the fly so they don't need to be saved. */
2258 if (intf->cur_altsetting->desc.bInterfaceSubClass ==
2259 UVC_SC_VIDEOCONTROL) {
2260 mutex_lock(&dev->lock);
2262 uvc_status_stop(dev);
2263 mutex_unlock(&dev->lock);
2267 list_for_each_entry(stream, &dev->streams, list) {
2268 if (stream->intf == intf)
2269 return uvc_video_suspend(stream);
2272 uvc_trace(UVC_TRACE_SUSPEND, "Suspend: video streaming USB interface "
2277 static int __uvc_resume(struct usb_interface *intf, int reset)
2279 struct uvc_device *dev = usb_get_intfdata(intf);
2280 struct uvc_streaming *stream;
2283 uvc_trace(UVC_TRACE_SUSPEND, "Resuming interface %u\n",
2284 intf->cur_altsetting->desc.bInterfaceNumber);
2286 if (intf->cur_altsetting->desc.bInterfaceSubClass ==
2287 UVC_SC_VIDEOCONTROL) {
2289 ret = uvc_ctrl_restore_values(dev);
2294 mutex_lock(&dev->lock);
2296 ret = uvc_status_start(dev, GFP_NOIO);
2297 mutex_unlock(&dev->lock);
2302 list_for_each_entry(stream, &dev->streams, list) {
2303 if (stream->intf == intf) {
2304 ret = uvc_video_resume(stream, reset);
2306 uvc_queue_streamoff(&stream->queue,
2307 stream->queue.queue.type);
2312 uvc_trace(UVC_TRACE_SUSPEND, "Resume: video streaming USB interface "
2317 static int uvc_resume(struct usb_interface *intf)
2319 return __uvc_resume(intf, 0);
2322 static int uvc_reset_resume(struct usb_interface *intf)
2324 return __uvc_resume(intf, 1);
2327 /* ------------------------------------------------------------------------
2331 static int uvc_clock_param_get(char *buffer, const struct kernel_param *kp)
2333 if (uvc_clock_param == CLOCK_MONOTONIC)
2334 return sprintf(buffer, "CLOCK_MONOTONIC");
2336 return sprintf(buffer, "CLOCK_REALTIME");
2339 static int uvc_clock_param_set(const char *val, const struct kernel_param *kp)
2341 if (strncasecmp(val, "clock_", strlen("clock_")) == 0)
2342 val += strlen("clock_");
2344 if (strcasecmp(val, "monotonic") == 0)
2345 uvc_clock_param = CLOCK_MONOTONIC;
2346 else if (strcasecmp(val, "realtime") == 0)
2347 uvc_clock_param = CLOCK_REALTIME;
2354 module_param_call(clock, uvc_clock_param_set, uvc_clock_param_get,
2355 &uvc_clock_param, S_IRUGO|S_IWUSR);
2356 MODULE_PARM_DESC(clock, "Video buffers timestamp clock");
2357 module_param_named(hwtimestamps, uvc_hw_timestamps_param, uint, S_IRUGO|S_IWUSR);
2358 MODULE_PARM_DESC(hwtimestamps, "Use hardware timestamps");
2359 module_param_named(nodrop, uvc_no_drop_param, uint, S_IRUGO|S_IWUSR);
2360 MODULE_PARM_DESC(nodrop, "Don't drop incomplete frames");
2361 module_param_named(quirks, uvc_quirks_param, uint, S_IRUGO|S_IWUSR);
2362 MODULE_PARM_DESC(quirks, "Forced device quirks");
2363 module_param_named(trace, uvc_trace_param, uint, S_IRUGO|S_IWUSR);
2364 MODULE_PARM_DESC(trace, "Trace level bitmask");
2365 module_param_named(timeout, uvc_timeout_param, uint, S_IRUGO|S_IWUSR);
2366 MODULE_PARM_DESC(timeout, "Streaming control requests timeout");
2368 /* ------------------------------------------------------------------------
2369 * Driver initialization and cleanup
2372 static const struct uvc_device_info uvc_quirk_probe_minmax = {
2373 .quirks = UVC_QUIRK_PROBE_MINMAX,
2376 static const struct uvc_device_info uvc_quirk_fix_bandwidth = {
2377 .quirks = UVC_QUIRK_FIX_BANDWIDTH,
2380 static const struct uvc_device_info uvc_quirk_probe_def = {
2381 .quirks = UVC_QUIRK_PROBE_DEF,
2384 static const struct uvc_device_info uvc_quirk_stream_no_fid = {
2385 .quirks = UVC_QUIRK_STREAM_NO_FID,
2388 static const struct uvc_device_info uvc_quirk_force_y8 = {
2389 .quirks = UVC_QUIRK_FORCE_Y8,
2392 #define UVC_INFO_QUIRK(q) (kernel_ulong_t)&(struct uvc_device_info){.quirks = q}
2393 #define UVC_INFO_META(m) (kernel_ulong_t)&(struct uvc_device_info) \
2397 * The Logitech cameras listed below have their interface class set to
2398 * VENDOR_SPEC because they don't announce themselves as UVC devices, even
2399 * though they are compliant.
2401 static const struct usb_device_id uvc_ids[] = {
2402 /* LogiLink Wireless Webcam */
2403 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2404 | USB_DEVICE_ID_MATCH_INT_INFO,
2406 .idProduct = 0xa91a,
2407 .bInterfaceClass = USB_CLASS_VIDEO,
2408 .bInterfaceSubClass = 1,
2409 .bInterfaceProtocol = 0,
2410 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
2411 /* Genius eFace 2025 */
2412 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2413 | USB_DEVICE_ID_MATCH_INT_INFO,
2415 .idProduct = 0x706e,
2416 .bInterfaceClass = USB_CLASS_VIDEO,
2417 .bInterfaceSubClass = 1,
2418 .bInterfaceProtocol = 0,
2419 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
2420 /* Microsoft Lifecam NX-6000 */
2421 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2422 | USB_DEVICE_ID_MATCH_INT_INFO,
2424 .idProduct = 0x00f8,
2425 .bInterfaceClass = USB_CLASS_VIDEO,
2426 .bInterfaceSubClass = 1,
2427 .bInterfaceProtocol = 0,
2428 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
2429 /* Microsoft Lifecam NX-3000 */
2430 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2431 | USB_DEVICE_ID_MATCH_INT_INFO,
2433 .idProduct = 0x0721,
2434 .bInterfaceClass = USB_CLASS_VIDEO,
2435 .bInterfaceSubClass = 1,
2436 .bInterfaceProtocol = 0,
2437 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def },
2438 /* Microsoft Lifecam VX-7000 */
2439 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2440 | USB_DEVICE_ID_MATCH_INT_INFO,
2442 .idProduct = 0x0723,
2443 .bInterfaceClass = USB_CLASS_VIDEO,
2444 .bInterfaceSubClass = 1,
2445 .bInterfaceProtocol = 0,
2446 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
2447 /* Logitech Quickcam Fusion */
2448 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2449 | USB_DEVICE_ID_MATCH_INT_INFO,
2451 .idProduct = 0x08c1,
2452 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
2453 .bInterfaceSubClass = 1,
2454 .bInterfaceProtocol = 0 },
2455 /* Logitech Quickcam Orbit MP */
2456 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2457 | USB_DEVICE_ID_MATCH_INT_INFO,
2459 .idProduct = 0x08c2,
2460 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
2461 .bInterfaceSubClass = 1,
2462 .bInterfaceProtocol = 0 },
2463 /* Logitech Quickcam Pro for Notebook */
2464 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2465 | USB_DEVICE_ID_MATCH_INT_INFO,
2467 .idProduct = 0x08c3,
2468 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
2469 .bInterfaceSubClass = 1,
2470 .bInterfaceProtocol = 0 },
2471 /* Logitech Quickcam Pro 5000 */
2472 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2473 | USB_DEVICE_ID_MATCH_INT_INFO,
2475 .idProduct = 0x08c5,
2476 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
2477 .bInterfaceSubClass = 1,
2478 .bInterfaceProtocol = 0 },
2479 /* Logitech Quickcam OEM Dell Notebook */
2480 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2481 | USB_DEVICE_ID_MATCH_INT_INFO,
2483 .idProduct = 0x08c6,
2484 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
2485 .bInterfaceSubClass = 1,
2486 .bInterfaceProtocol = 0 },
2487 /* Logitech Quickcam OEM Cisco VT Camera II */
2488 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2489 | USB_DEVICE_ID_MATCH_INT_INFO,
2491 .idProduct = 0x08c7,
2492 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
2493 .bInterfaceSubClass = 1,
2494 .bInterfaceProtocol = 0 },
2495 /* Logitech HD Pro Webcam C920 */
2496 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2497 | USB_DEVICE_ID_MATCH_INT_INFO,
2499 .idProduct = 0x082d,
2500 .bInterfaceClass = USB_CLASS_VIDEO,
2501 .bInterfaceSubClass = 1,
2502 .bInterfaceProtocol = 0,
2503 .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_RESTORE_CTRLS_ON_INIT) },
2504 /* Chicony CNF7129 (Asus EEE 100HE) */
2505 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2506 | USB_DEVICE_ID_MATCH_INT_INFO,
2508 .idProduct = 0xb071,
2509 .bInterfaceClass = USB_CLASS_VIDEO,
2510 .bInterfaceSubClass = 1,
2511 .bInterfaceProtocol = 0,
2512 .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_RESTRICT_FRAME_RATE) },
2513 /* Alcor Micro AU3820 (Future Boy PC USB Webcam) */
2514 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2515 | USB_DEVICE_ID_MATCH_INT_INFO,
2517 .idProduct = 0x3820,
2518 .bInterfaceClass = USB_CLASS_VIDEO,
2519 .bInterfaceSubClass = 1,
2520 .bInterfaceProtocol = 0,
2521 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
2522 /* Dell XPS m1530 */
2523 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2524 | USB_DEVICE_ID_MATCH_INT_INFO,
2526 .idProduct = 0x2640,
2527 .bInterfaceClass = USB_CLASS_VIDEO,
2528 .bInterfaceSubClass = 1,
2529 .bInterfaceProtocol = 0,
2530 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def },
2531 /* Dell SP2008WFP Monitor */
2532 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2533 | USB_DEVICE_ID_MATCH_INT_INFO,
2535 .idProduct = 0x2641,
2536 .bInterfaceClass = USB_CLASS_VIDEO,
2537 .bInterfaceSubClass = 1,
2538 .bInterfaceProtocol = 0,
2539 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def },
2540 /* Dell Alienware X51 */
2541 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2542 | USB_DEVICE_ID_MATCH_INT_INFO,
2544 .idProduct = 0x2643,
2545 .bInterfaceClass = USB_CLASS_VIDEO,
2546 .bInterfaceSubClass = 1,
2547 .bInterfaceProtocol = 0,
2548 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def },
2549 /* Dell Studio Hybrid 140g (OmniVision webcam) */
2550 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2551 | USB_DEVICE_ID_MATCH_INT_INFO,
2553 .idProduct = 0x264a,
2554 .bInterfaceClass = USB_CLASS_VIDEO,
2555 .bInterfaceSubClass = 1,
2556 .bInterfaceProtocol = 0,
2557 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def },
2558 /* Dell XPS M1330 (OmniVision OV7670 webcam) */
2559 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2560 | USB_DEVICE_ID_MATCH_INT_INFO,
2562 .idProduct = 0x7670,
2563 .bInterfaceClass = USB_CLASS_VIDEO,
2564 .bInterfaceSubClass = 1,
2565 .bInterfaceProtocol = 0,
2566 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def },
2567 /* Apple Built-In iSight */
2568 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2569 | USB_DEVICE_ID_MATCH_INT_INFO,
2571 .idProduct = 0x8501,
2572 .bInterfaceClass = USB_CLASS_VIDEO,
2573 .bInterfaceSubClass = 1,
2574 .bInterfaceProtocol = 0,
2575 .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_PROBE_MINMAX
2576 | UVC_QUIRK_BUILTIN_ISIGHT) },
2577 /* Apple Built-In iSight via iBridge */
2578 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2579 | USB_DEVICE_ID_MATCH_INT_INFO,
2581 .idProduct = 0x8600,
2582 .bInterfaceClass = USB_CLASS_VIDEO,
2583 .bInterfaceSubClass = 1,
2584 .bInterfaceProtocol = 0,
2585 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def },
2586 /* Foxlink ("HP Webcam" on HP Mini 5103) */
2587 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2588 | USB_DEVICE_ID_MATCH_INT_INFO,
2590 .idProduct = 0x0403,
2591 .bInterfaceClass = USB_CLASS_VIDEO,
2592 .bInterfaceSubClass = 1,
2593 .bInterfaceProtocol = 0,
2594 .driver_info = (kernel_ulong_t)&uvc_quirk_fix_bandwidth },
2595 /* Genesys Logic USB 2.0 PC Camera */
2596 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2597 | USB_DEVICE_ID_MATCH_INT_INFO,
2599 .idProduct = 0x0505,
2600 .bInterfaceClass = USB_CLASS_VIDEO,
2601 .bInterfaceSubClass = 1,
2602 .bInterfaceProtocol = 0,
2603 .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid },
2604 /* Hercules Classic Silver */
2605 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2606 | USB_DEVICE_ID_MATCH_INT_INFO,
2608 .idProduct = 0x300c,
2609 .bInterfaceClass = USB_CLASS_VIDEO,
2610 .bInterfaceSubClass = 1,
2611 .bInterfaceProtocol = 0,
2612 .driver_info = (kernel_ulong_t)&uvc_quirk_fix_bandwidth },
2614 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2615 | USB_DEVICE_ID_MATCH_INT_INFO,
2617 .idProduct = 0x332d,
2618 .bInterfaceClass = USB_CLASS_VIDEO,
2619 .bInterfaceSubClass = 1,
2620 .bInterfaceProtocol = 0,
2621 .driver_info = (kernel_ulong_t)&uvc_quirk_fix_bandwidth },
2622 /* ViMicro - Minoru3D */
2623 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2624 | USB_DEVICE_ID_MATCH_INT_INFO,
2626 .idProduct = 0x3410,
2627 .bInterfaceClass = USB_CLASS_VIDEO,
2628 .bInterfaceSubClass = 1,
2629 .bInterfaceProtocol = 0,
2630 .driver_info = (kernel_ulong_t)&uvc_quirk_fix_bandwidth },
2631 /* ViMicro Venus - Minoru3D */
2632 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2633 | USB_DEVICE_ID_MATCH_INT_INFO,
2635 .idProduct = 0x3420,
2636 .bInterfaceClass = USB_CLASS_VIDEO,
2637 .bInterfaceSubClass = 1,
2638 .bInterfaceProtocol = 0,
2639 .driver_info = (kernel_ulong_t)&uvc_quirk_fix_bandwidth },
2640 /* Ophir Optronics - SPCAM 620U */
2641 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2642 | USB_DEVICE_ID_MATCH_INT_INFO,
2644 .idProduct = 0x0555,
2645 .bInterfaceClass = USB_CLASS_VIDEO,
2646 .bInterfaceSubClass = 1,
2647 .bInterfaceProtocol = 0,
2648 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
2650 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2651 | USB_DEVICE_ID_MATCH_INT_INFO,
2653 .idProduct = 0x0004,
2654 .bInterfaceClass = USB_CLASS_VIDEO,
2655 .bInterfaceSubClass = 1,
2656 .bInterfaceProtocol = 0,
2657 .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_PROBE_MINMAX
2658 | UVC_QUIRK_PROBE_DEF) },
2659 /* IMC Networks (Medion Akoya) */
2660 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2661 | USB_DEVICE_ID_MATCH_INT_INFO,
2663 .idProduct = 0x5103,
2664 .bInterfaceClass = USB_CLASS_VIDEO,
2665 .bInterfaceSubClass = 1,
2666 .bInterfaceProtocol = 0,
2667 .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid },
2668 /* JMicron USB2.0 XGA WebCam */
2669 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2670 | USB_DEVICE_ID_MATCH_INT_INFO,
2672 .idProduct = 0x0310,
2673 .bInterfaceClass = USB_CLASS_VIDEO,
2674 .bInterfaceSubClass = 1,
2675 .bInterfaceProtocol = 0,
2676 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
2677 /* Syntek (HP Spartan) */
2678 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2679 | USB_DEVICE_ID_MATCH_INT_INFO,
2681 .idProduct = 0x5212,
2682 .bInterfaceClass = USB_CLASS_VIDEO,
2683 .bInterfaceSubClass = 1,
2684 .bInterfaceProtocol = 0,
2685 .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid },
2686 /* Syntek (Samsung Q310) */
2687 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2688 | USB_DEVICE_ID_MATCH_INT_INFO,
2690 .idProduct = 0x5931,
2691 .bInterfaceClass = USB_CLASS_VIDEO,
2692 .bInterfaceSubClass = 1,
2693 .bInterfaceProtocol = 0,
2694 .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid },
2695 /* Syntek (Packard Bell EasyNote MX52 */
2696 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2697 | USB_DEVICE_ID_MATCH_INT_INFO,
2699 .idProduct = 0x8a12,
2700 .bInterfaceClass = USB_CLASS_VIDEO,
2701 .bInterfaceSubClass = 1,
2702 .bInterfaceProtocol = 0,
2703 .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid },
2704 /* Syntek (Asus F9SG) */
2705 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2706 | USB_DEVICE_ID_MATCH_INT_INFO,
2708 .idProduct = 0x8a31,
2709 .bInterfaceClass = USB_CLASS_VIDEO,
2710 .bInterfaceSubClass = 1,
2711 .bInterfaceProtocol = 0,
2712 .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid },
2713 /* Syntek (Asus U3S) */
2714 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2715 | USB_DEVICE_ID_MATCH_INT_INFO,
2717 .idProduct = 0x8a33,
2718 .bInterfaceClass = USB_CLASS_VIDEO,
2719 .bInterfaceSubClass = 1,
2720 .bInterfaceProtocol = 0,
2721 .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid },
2722 /* Syntek (JAOtech Smart Terminal) */
2723 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2724 | USB_DEVICE_ID_MATCH_INT_INFO,
2726 .idProduct = 0x8a34,
2727 .bInterfaceClass = USB_CLASS_VIDEO,
2728 .bInterfaceSubClass = 1,
2729 .bInterfaceProtocol = 0,
2730 .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid },
2732 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2733 | USB_DEVICE_ID_MATCH_INT_INFO,
2735 .idProduct = 0x0202,
2736 .bInterfaceClass = USB_CLASS_VIDEO,
2737 .bInterfaceSubClass = 1,
2738 .bInterfaceProtocol = 0,
2739 .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid },
2740 /* Lenovo Thinkpad SL400/SL500 */
2741 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2742 | USB_DEVICE_ID_MATCH_INT_INFO,
2744 .idProduct = 0x480b,
2745 .bInterfaceClass = USB_CLASS_VIDEO,
2746 .bInterfaceSubClass = 1,
2747 .bInterfaceProtocol = 0,
2748 .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid },
2749 /* Aveo Technology USB 2.0 Camera */
2750 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2751 | USB_DEVICE_ID_MATCH_INT_INFO,
2753 .idProduct = 0x0306,
2754 .bInterfaceClass = USB_CLASS_VIDEO,
2755 .bInterfaceSubClass = 1,
2756 .bInterfaceProtocol = 0,
2757 .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_PROBE_MINMAX
2758 | UVC_QUIRK_PROBE_EXTRAFIELDS) },
2759 /* Aveo Technology USB 2.0 Camera (Tasco USB Microscope) */
2760 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2761 | USB_DEVICE_ID_MATCH_INT_INFO,
2763 .idProduct = 0x0516,
2764 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
2765 .bInterfaceSubClass = 1,
2766 .bInterfaceProtocol = 0 },
2767 /* Ecamm Pico iMage */
2768 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2769 | USB_DEVICE_ID_MATCH_INT_INFO,
2771 .idProduct = 0xcafe,
2772 .bInterfaceClass = USB_CLASS_VIDEO,
2773 .bInterfaceSubClass = 1,
2774 .bInterfaceProtocol = 0,
2775 .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_PROBE_EXTRAFIELDS) },
2776 /* Manta MM-353 Plako */
2777 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2778 | USB_DEVICE_ID_MATCH_INT_INFO,
2780 .idProduct = 0x3188,
2781 .bInterfaceClass = USB_CLASS_VIDEO,
2782 .bInterfaceSubClass = 1,
2783 .bInterfaceProtocol = 0,
2784 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
2785 /* FSC WebCam V30S */
2786 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2787 | USB_DEVICE_ID_MATCH_INT_INFO,
2789 .idProduct = 0x3288,
2790 .bInterfaceClass = USB_CLASS_VIDEO,
2791 .bInterfaceSubClass = 1,
2792 .bInterfaceProtocol = 0,
2793 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
2794 /* Arkmicro unbranded */
2795 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2796 | USB_DEVICE_ID_MATCH_INT_INFO,
2798 .idProduct = 0x3290,
2799 .bInterfaceClass = USB_CLASS_VIDEO,
2800 .bInterfaceSubClass = 1,
2801 .bInterfaceProtocol = 0,
2802 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def },
2803 /* The Imaging Source USB CCD cameras */
2804 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2805 | USB_DEVICE_ID_MATCH_INT_INFO,
2807 .idProduct = 0x8102,
2808 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
2809 .bInterfaceSubClass = 1,
2810 .bInterfaceProtocol = 0 },
2811 /* Bodelin ProScopeHR */
2812 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2813 | USB_DEVICE_ID_MATCH_DEV_HI
2814 | USB_DEVICE_ID_MATCH_INT_INFO,
2816 .idProduct = 0x1000,
2817 .bcdDevice_hi = 0x0126,
2818 .bInterfaceClass = USB_CLASS_VIDEO,
2819 .bInterfaceSubClass = 1,
2820 .bInterfaceProtocol = 0,
2821 .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_STATUS_INTERVAL) },
2822 /* MSI StarCam 370i */
2823 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2824 | USB_DEVICE_ID_MATCH_INT_INFO,
2826 .idProduct = 0x2951,
2827 .bInterfaceClass = USB_CLASS_VIDEO,
2828 .bInterfaceSubClass = 1,
2829 .bInterfaceProtocol = 0,
2830 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
2831 /* Generalplus Technology Inc. 808 Camera */
2832 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2833 | USB_DEVICE_ID_MATCH_INT_INFO,
2835 .idProduct = 0x2002,
2836 .bInterfaceClass = USB_CLASS_VIDEO,
2837 .bInterfaceSubClass = 1,
2838 .bInterfaceProtocol = 0,
2839 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
2840 /* SiGma Micro USB Web Camera */
2841 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2842 | USB_DEVICE_ID_MATCH_INT_INFO,
2844 .idProduct = 0x3000,
2845 .bInterfaceClass = USB_CLASS_VIDEO,
2846 .bInterfaceSubClass = 1,
2847 .bInterfaceProtocol = 0,
2848 .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_PROBE_MINMAX
2849 | UVC_QUIRK_IGNORE_SELECTOR_UNIT) },
2850 /* Oculus VR Positional Tracker DK2 */
2851 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2852 | USB_DEVICE_ID_MATCH_INT_INFO,
2854 .idProduct = 0x0201,
2855 .bInterfaceClass = USB_CLASS_VIDEO,
2856 .bInterfaceSubClass = 1,
2857 .bInterfaceProtocol = 0,
2858 .driver_info = (kernel_ulong_t)&uvc_quirk_force_y8 },
2859 /* Oculus VR Rift Sensor */
2860 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2861 | USB_DEVICE_ID_MATCH_INT_INFO,
2863 .idProduct = 0x0211,
2864 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
2865 .bInterfaceSubClass = 1,
2866 .bInterfaceProtocol = 0,
2867 .driver_info = (kernel_ulong_t)&uvc_quirk_force_y8 },
2868 /* Intel RealSense D4M */
2869 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2870 | USB_DEVICE_ID_MATCH_INT_INFO,
2872 .idProduct = 0x0b03,
2873 .bInterfaceClass = USB_CLASS_VIDEO,
2874 .bInterfaceSubClass = 1,
2875 .bInterfaceProtocol = 0,
2876 .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) },
2877 /* Generic USB Video Class */
2878 { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_UNDEFINED) },
2879 { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_15) },
2883 MODULE_DEVICE_TABLE(usb, uvc_ids);
2885 struct uvc_driver uvc_driver = {
2889 .disconnect = uvc_disconnect,
2890 .suspend = uvc_suspend,
2891 .resume = uvc_resume,
2892 .reset_resume = uvc_reset_resume,
2893 .id_table = uvc_ids,
2894 .supports_autosuspend = 1,
2898 static int __init uvc_init(void)
2904 ret = usb_register(&uvc_driver.driver);
2906 uvc_debugfs_cleanup();
2910 printk(KERN_INFO DRIVER_DESC " (" DRIVER_VERSION ")\n");
2914 static void __exit uvc_cleanup(void)
2916 usb_deregister(&uvc_driver.driver);
2917 uvc_debugfs_cleanup();
2920 module_init(uvc_init);
2921 module_exit(uvc_cleanup);
2923 MODULE_AUTHOR(DRIVER_AUTHOR);
2924 MODULE_DESCRIPTION(DRIVER_DESC);
2925 MODULE_LICENSE("GPL");
2926 MODULE_VERSION(DRIVER_VERSION);