2 * uvc_driver.c -- USB Video Class driver
4 * Copyright (C) 2005-2010
5 * Laurent Pinchart (laurent.pinchart@ideasonboard.com)
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 " \
32 "<laurent.pinchart@ideasonboard.com>"
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,
219 /* ------------------------------------------------------------------------
223 struct usb_host_endpoint *uvc_find_endpoint(struct usb_host_interface *alts,
226 struct usb_host_endpoint *ep;
229 for (i = 0; i < alts->desc.bNumEndpoints; ++i) {
230 ep = &alts->endpoint[i];
231 if (ep->desc.bEndpointAddress == epaddr)
238 static struct uvc_format_desc *uvc_format_by_guid(const u8 guid[16])
240 unsigned int len = ARRAY_SIZE(uvc_fmts);
243 for (i = 0; i < len; ++i) {
244 if (memcmp(guid, uvc_fmts[i].guid, 16) == 0)
251 static u32 uvc_colorspace(const u8 primaries)
253 static const u8 colorprimaries[] = {
255 V4L2_COLORSPACE_SRGB,
256 V4L2_COLORSPACE_470_SYSTEM_M,
257 V4L2_COLORSPACE_470_SYSTEM_BG,
258 V4L2_COLORSPACE_SMPTE170M,
259 V4L2_COLORSPACE_SMPTE240M,
262 if (primaries < ARRAY_SIZE(colorprimaries))
263 return colorprimaries[primaries];
268 /* Simplify a fraction using a simple continued fraction decomposition. The
269 * idea here is to convert fractions such as 333333/10000000 to 1/30 using
270 * 32 bit arithmetic only. The algorithm is not perfect and relies upon two
271 * arbitrary parameters to remove non-significative terms from the simple
272 * continued fraction decomposition. Using 8 and 333 for n_terms and threshold
273 * respectively seems to give nice results.
275 void uvc_simplify_fraction(u32 *numerator, u32 *denominator,
276 unsigned int n_terms, unsigned int threshold)
282 an = kmalloc_array(n_terms, sizeof(*an), GFP_KERNEL);
286 /* Convert the fraction to a simple continued fraction. See
287 * http://mathforum.org/dr.math/faq/faq.fractions.html
288 * Stop if the current term is bigger than or equal to the given
294 for (n = 0; n < n_terms && y != 0; ++n) {
296 if (an[n] >= threshold) {
307 /* Expand the simple continued fraction back to an integer fraction. */
311 for (i = n; i > 0; --i) {
322 /* Convert a fraction to a frame interval in 100ns multiples. The idea here is
323 * to compute numerator / denominator * 10000000 using 32 bit fixed point
326 u32 uvc_fraction_to_interval(u32 numerator, u32 denominator)
330 /* Saturate the result if the operation would overflow. */
331 if (denominator == 0 ||
332 numerator/denominator >= ((u32)-1)/10000000)
335 /* Divide both the denominator and the multiplier by two until
336 * numerator * multiplier doesn't overflow. If anyone knows a better
337 * algorithm please let me know.
339 multiplier = 10000000;
340 while (numerator > ((u32)-1)/multiplier) {
345 return denominator ? numerator * multiplier / denominator : 0;
348 /* ------------------------------------------------------------------------
349 * Terminal and unit management
352 struct uvc_entity *uvc_entity_by_id(struct uvc_device *dev, int id)
354 struct uvc_entity *entity;
356 list_for_each_entry(entity, &dev->entities, list) {
357 if (entity->id == id)
364 static struct uvc_entity *uvc_entity_by_reference(struct uvc_device *dev,
365 int id, struct uvc_entity *entity)
370 entity = list_entry(&dev->entities, struct uvc_entity, list);
372 list_for_each_entry_continue(entity, &dev->entities, list) {
373 for (i = 0; i < entity->bNrInPins; ++i)
374 if (entity->baSourceID[i] == id)
381 static struct uvc_streaming *uvc_stream_by_id(struct uvc_device *dev, int id)
383 struct uvc_streaming *stream;
385 list_for_each_entry(stream, &dev->streams, list) {
386 if (stream->header.bTerminalLink == id)
393 /* ------------------------------------------------------------------------
394 * Streaming Object Management
397 static void uvc_stream_delete(struct uvc_streaming *stream)
399 mutex_destroy(&stream->mutex);
401 usb_put_intf(stream->intf);
403 kfree(stream->format);
404 kfree(stream->header.bmaControls);
408 static struct uvc_streaming *uvc_stream_new(struct uvc_device *dev,
409 struct usb_interface *intf)
411 struct uvc_streaming *stream;
413 stream = kzalloc(sizeof(*stream), GFP_KERNEL);
417 mutex_init(&stream->mutex);
420 stream->intf = usb_get_intf(intf);
421 stream->intfnum = intf->cur_altsetting->desc.bInterfaceNumber;
426 /* ------------------------------------------------------------------------
427 * Descriptors parsing
430 static int uvc_parse_format(struct uvc_device *dev,
431 struct uvc_streaming *streaming, struct uvc_format *format,
432 u32 **intervals, unsigned char *buffer, int buflen)
434 struct usb_interface *intf = streaming->intf;
435 struct usb_host_interface *alts = intf->cur_altsetting;
436 struct uvc_format_desc *fmtdesc;
437 struct uvc_frame *frame;
438 const unsigned char *start = buffer;
439 unsigned int width_multiplier = 1;
440 unsigned int interval;
444 format->type = buffer[2];
445 format->index = buffer[3];
448 case UVC_VS_FORMAT_UNCOMPRESSED:
449 case UVC_VS_FORMAT_FRAME_BASED:
450 n = buffer[2] == UVC_VS_FORMAT_UNCOMPRESSED ? 27 : 28;
452 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
453 "interface %d FORMAT error\n",
455 alts->desc.bInterfaceNumber);
459 /* Find the format descriptor from its GUID. */
460 fmtdesc = uvc_format_by_guid(&buffer[5]);
462 if (fmtdesc != NULL) {
463 strlcpy(format->name, fmtdesc->name,
464 sizeof(format->name));
465 format->fcc = fmtdesc->fcc;
467 uvc_printk(KERN_INFO, "Unknown video format %pUl\n",
469 snprintf(format->name, sizeof(format->name), "%pUl\n",
474 format->bpp = buffer[21];
476 /* Some devices report a format that doesn't match what they
479 if (dev->quirks & UVC_QUIRK_FORCE_Y8) {
480 if (format->fcc == V4L2_PIX_FMT_YUYV) {
481 strlcpy(format->name, "Greyscale 8-bit (Y8 )",
482 sizeof(format->name));
483 format->fcc = V4L2_PIX_FMT_GREY;
485 width_multiplier = 2;
489 if (buffer[2] == UVC_VS_FORMAT_UNCOMPRESSED) {
490 ftype = UVC_VS_FRAME_UNCOMPRESSED;
492 ftype = UVC_VS_FRAME_FRAME_BASED;
494 format->flags = UVC_FMT_FLAG_COMPRESSED;
498 case UVC_VS_FORMAT_MJPEG:
500 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
501 "interface %d FORMAT error\n",
503 alts->desc.bInterfaceNumber);
507 strlcpy(format->name, "MJPEG", sizeof(format->name));
508 format->fcc = V4L2_PIX_FMT_MJPEG;
509 format->flags = UVC_FMT_FLAG_COMPRESSED;
511 ftype = UVC_VS_FRAME_MJPEG;
514 case UVC_VS_FORMAT_DV:
516 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
517 "interface %d FORMAT error\n",
519 alts->desc.bInterfaceNumber);
523 switch (buffer[8] & 0x7f) {
525 strlcpy(format->name, "SD-DV", sizeof(format->name));
528 strlcpy(format->name, "SDL-DV", sizeof(format->name));
531 strlcpy(format->name, "HD-DV", sizeof(format->name));
534 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
535 "interface %d: unknown DV format %u\n",
537 alts->desc.bInterfaceNumber, buffer[8]);
541 strlcat(format->name, buffer[8] & (1 << 7) ? " 60Hz" : " 50Hz",
542 sizeof(format->name));
544 format->fcc = V4L2_PIX_FMT_DV;
545 format->flags = UVC_FMT_FLAG_COMPRESSED | UVC_FMT_FLAG_STREAM;
549 /* Create a dummy frame descriptor. */
550 frame = &format->frame[0];
551 memset(&format->frame[0], 0, sizeof(format->frame[0]));
552 frame->bFrameIntervalType = 1;
553 frame->dwDefaultFrameInterval = 1;
554 frame->dwFrameInterval = *intervals;
559 case UVC_VS_FORMAT_MPEG2TS:
560 case UVC_VS_FORMAT_STREAM_BASED:
561 /* Not supported yet. */
563 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
564 "interface %d unsupported format %u\n",
565 dev->udev->devnum, alts->desc.bInterfaceNumber,
570 uvc_trace(UVC_TRACE_DESCR, "Found format %s.\n", format->name);
575 /* Parse the frame descriptors. Only uncompressed, MJPEG and frame
576 * based formats have frame descriptors.
578 while (buflen > 2 && buffer[1] == USB_DT_CS_INTERFACE &&
579 buffer[2] == ftype) {
580 frame = &format->frame[format->nframes];
581 if (ftype != UVC_VS_FRAME_FRAME_BASED)
582 n = buflen > 25 ? buffer[25] : 0;
584 n = buflen > 21 ? buffer[21] : 0;
588 if (buflen < 26 + 4*n) {
589 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
590 "interface %d FRAME error\n", dev->udev->devnum,
591 alts->desc.bInterfaceNumber);
595 frame->bFrameIndex = buffer[3];
596 frame->bmCapabilities = buffer[4];
597 frame->wWidth = get_unaligned_le16(&buffer[5])
599 frame->wHeight = get_unaligned_le16(&buffer[7]);
600 frame->dwMinBitRate = get_unaligned_le32(&buffer[9]);
601 frame->dwMaxBitRate = get_unaligned_le32(&buffer[13]);
602 if (ftype != UVC_VS_FRAME_FRAME_BASED) {
603 frame->dwMaxVideoFrameBufferSize =
604 get_unaligned_le32(&buffer[17]);
605 frame->dwDefaultFrameInterval =
606 get_unaligned_le32(&buffer[21]);
607 frame->bFrameIntervalType = buffer[25];
609 frame->dwMaxVideoFrameBufferSize = 0;
610 frame->dwDefaultFrameInterval =
611 get_unaligned_le32(&buffer[17]);
612 frame->bFrameIntervalType = buffer[21];
614 frame->dwFrameInterval = *intervals;
616 /* Several UVC chipsets screw up dwMaxVideoFrameBufferSize
617 * completely. Observed behaviours range from setting the
618 * value to 1.1x the actual frame size to hardwiring the
619 * 16 low bits to 0. This results in a higher than necessary
620 * memory usage as well as a wrong image size information. For
621 * uncompressed formats this can be fixed by computing the
622 * value from the frame size.
624 if (!(format->flags & UVC_FMT_FLAG_COMPRESSED))
625 frame->dwMaxVideoFrameBufferSize = format->bpp
626 * frame->wWidth * frame->wHeight / 8;
628 /* Some bogus devices report dwMinFrameInterval equal to
629 * dwMaxFrameInterval and have dwFrameIntervalStep set to
630 * zero. Setting all null intervals to 1 fixes the problem and
631 * some other divisions by zero that could happen.
633 for (i = 0; i < n; ++i) {
634 interval = get_unaligned_le32(&buffer[26+4*i]);
635 *(*intervals)++ = interval ? interval : 1;
638 /* Make sure that the default frame interval stays between
641 n -= frame->bFrameIntervalType ? 1 : 2;
642 frame->dwDefaultFrameInterval =
643 min(frame->dwFrameInterval[n],
644 max(frame->dwFrameInterval[0],
645 frame->dwDefaultFrameInterval));
647 if (dev->quirks & UVC_QUIRK_RESTRICT_FRAME_RATE) {
648 frame->bFrameIntervalType = 1;
649 frame->dwFrameInterval[0] =
650 frame->dwDefaultFrameInterval;
653 uvc_trace(UVC_TRACE_DESCR, "- %ux%u (%u.%u fps)\n",
654 frame->wWidth, frame->wHeight,
655 10000000/frame->dwDefaultFrameInterval,
656 (100000000/frame->dwDefaultFrameInterval)%10);
663 if (buflen > 2 && buffer[1] == USB_DT_CS_INTERFACE &&
664 buffer[2] == UVC_VS_STILL_IMAGE_FRAME) {
669 if (buflen > 2 && buffer[1] == USB_DT_CS_INTERFACE &&
670 buffer[2] == UVC_VS_COLORFORMAT) {
672 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
673 "interface %d COLORFORMAT error\n",
675 alts->desc.bInterfaceNumber);
679 format->colorspace = uvc_colorspace(buffer[3]);
685 return buffer - start;
688 static int uvc_parse_streaming(struct uvc_device *dev,
689 struct usb_interface *intf)
691 struct uvc_streaming *streaming = NULL;
692 struct uvc_format *format;
693 struct uvc_frame *frame;
694 struct usb_host_interface *alts = &intf->altsetting[0];
695 unsigned char *_buffer, *buffer = alts->extra;
696 int _buflen, buflen = alts->extralen;
697 unsigned int nformats = 0, nframes = 0, nintervals = 0;
698 unsigned int size, i, n, p;
703 if (intf->cur_altsetting->desc.bInterfaceSubClass
704 != UVC_SC_VIDEOSTREAMING) {
705 uvc_trace(UVC_TRACE_DESCR, "device %d interface %d isn't a "
706 "video streaming interface\n", dev->udev->devnum,
707 intf->altsetting[0].desc.bInterfaceNumber);
711 if (usb_driver_claim_interface(&uvc_driver.driver, intf, dev)) {
712 uvc_trace(UVC_TRACE_DESCR, "device %d interface %d is already "
713 "claimed\n", dev->udev->devnum,
714 intf->altsetting[0].desc.bInterfaceNumber);
718 streaming = uvc_stream_new(dev, intf);
719 if (streaming == NULL) {
720 usb_driver_release_interface(&uvc_driver.driver, intf);
724 /* The Pico iMage webcam has its class-specific interface descriptors
725 * after the endpoint descriptors.
728 for (i = 0; i < alts->desc.bNumEndpoints; ++i) {
729 struct usb_host_endpoint *ep = &alts->endpoint[i];
731 if (ep->extralen == 0)
734 if (ep->extralen > 2 &&
735 ep->extra[1] == USB_DT_CS_INTERFACE) {
736 uvc_trace(UVC_TRACE_DESCR, "trying extra data "
737 "from endpoint %u.\n", i);
738 buffer = alts->endpoint[i].extra;
739 buflen = alts->endpoint[i].extralen;
745 /* Skip the standard interface descriptors. */
746 while (buflen > 2 && buffer[1] != USB_DT_CS_INTERFACE) {
752 uvc_trace(UVC_TRACE_DESCR, "no class-specific streaming "
753 "interface descriptors found.\n");
757 /* Parse the header descriptor. */
759 case UVC_VS_OUTPUT_HEADER:
760 streaming->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
764 case UVC_VS_INPUT_HEADER:
765 streaming->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
770 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming interface "
771 "%d HEADER descriptor not found.\n", dev->udev->devnum,
772 alts->desc.bInterfaceNumber);
776 p = buflen >= 4 ? buffer[3] : 0;
777 n = buflen >= size ? buffer[size-1] : 0;
779 if (buflen < size + p*n) {
780 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
781 "interface %d HEADER descriptor is invalid.\n",
782 dev->udev->devnum, alts->desc.bInterfaceNumber);
786 streaming->header.bNumFormats = p;
787 streaming->header.bEndpointAddress = buffer[6];
788 if (buffer[2] == UVC_VS_INPUT_HEADER) {
789 streaming->header.bmInfo = buffer[7];
790 streaming->header.bTerminalLink = buffer[8];
791 streaming->header.bStillCaptureMethod = buffer[9];
792 streaming->header.bTriggerSupport = buffer[10];
793 streaming->header.bTriggerUsage = buffer[11];
795 streaming->header.bTerminalLink = buffer[7];
797 streaming->header.bControlSize = n;
799 streaming->header.bmaControls = kmemdup(&buffer[size], p * n,
801 if (streaming->header.bmaControls == NULL) {
812 /* Count the format and frame descriptors. */
813 while (_buflen > 2 && _buffer[1] == USB_DT_CS_INTERFACE) {
814 switch (_buffer[2]) {
815 case UVC_VS_FORMAT_UNCOMPRESSED:
816 case UVC_VS_FORMAT_MJPEG:
817 case UVC_VS_FORMAT_FRAME_BASED:
821 case UVC_VS_FORMAT_DV:
822 /* DV format has no frame descriptor. We will create a
823 * dummy frame descriptor with a dummy frame interval.
830 case UVC_VS_FORMAT_MPEG2TS:
831 case UVC_VS_FORMAT_STREAM_BASED:
832 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
833 "interface %d FORMAT %u is not supported.\n",
835 alts->desc.bInterfaceNumber, _buffer[2]);
838 case UVC_VS_FRAME_UNCOMPRESSED:
839 case UVC_VS_FRAME_MJPEG:
842 nintervals += _buffer[25] ? _buffer[25] : 3;
845 case UVC_VS_FRAME_FRAME_BASED:
848 nintervals += _buffer[21] ? _buffer[21] : 3;
852 _buflen -= _buffer[0];
853 _buffer += _buffer[0];
857 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming interface "
858 "%d has no supported formats defined.\n",
859 dev->udev->devnum, alts->desc.bInterfaceNumber);
863 size = nformats * sizeof(*format) + nframes * sizeof(*frame)
864 + nintervals * sizeof(*interval);
865 format = kzalloc(size, GFP_KERNEL);
866 if (format == NULL) {
871 frame = (struct uvc_frame *)&format[nformats];
872 interval = (u32 *)&frame[nframes];
874 streaming->format = format;
875 streaming->nformats = nformats;
877 /* Parse the format descriptors. */
878 while (buflen > 2 && buffer[1] == USB_DT_CS_INTERFACE) {
880 case UVC_VS_FORMAT_UNCOMPRESSED:
881 case UVC_VS_FORMAT_MJPEG:
882 case UVC_VS_FORMAT_DV:
883 case UVC_VS_FORMAT_FRAME_BASED:
884 format->frame = frame;
885 ret = uvc_parse_format(dev, streaming, format,
886 &interval, buffer, buflen);
890 frame += format->nframes;
906 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming interface "
907 "%d has %u bytes of trailing descriptor garbage.\n",
908 dev->udev->devnum, alts->desc.bInterfaceNumber, buflen);
910 /* Parse the alternate settings to find the maximum bandwidth. */
911 for (i = 0; i < intf->num_altsetting; ++i) {
912 struct usb_host_endpoint *ep;
913 alts = &intf->altsetting[i];
914 ep = uvc_find_endpoint(alts,
915 streaming->header.bEndpointAddress);
919 psize = le16_to_cpu(ep->desc.wMaxPacketSize);
920 psize = (psize & 0x07ff) * (1 + ((psize >> 11) & 3));
921 if (psize > streaming->maxpsize)
922 streaming->maxpsize = psize;
925 list_add_tail(&streaming->list, &dev->streams);
929 usb_driver_release_interface(&uvc_driver.driver, intf);
930 uvc_stream_delete(streaming);
934 static struct uvc_entity *uvc_alloc_entity(u16 type, u8 id,
935 unsigned int num_pads, unsigned int extra_size)
937 struct uvc_entity *entity;
938 unsigned int num_inputs;
942 extra_size = roundup(extra_size, sizeof(*entity->pads));
944 num_inputs = type & UVC_TERM_OUTPUT ? num_pads : num_pads - 1;
947 size = sizeof(*entity) + extra_size + sizeof(*entity->pads) * num_pads
949 entity = kzalloc(size, GFP_KERNEL);
956 entity->num_links = 0;
957 entity->num_pads = num_pads;
958 entity->pads = ((void *)(entity + 1)) + extra_size;
960 for (i = 0; i < num_inputs; ++i)
961 entity->pads[i].flags = MEDIA_PAD_FL_SINK;
962 if (!UVC_ENTITY_IS_OTERM(entity) && num_pads)
963 entity->pads[num_pads-1].flags = MEDIA_PAD_FL_SOURCE;
965 entity->bNrInPins = num_inputs;
966 entity->baSourceID = (u8 *)(&entity->pads[num_pads]);
971 /* Parse vendor-specific extensions. */
972 static int uvc_parse_vendor_control(struct uvc_device *dev,
973 const unsigned char *buffer, int buflen)
975 struct usb_device *udev = dev->udev;
976 struct usb_host_interface *alts = dev->intf->cur_altsetting;
977 struct uvc_entity *unit;
981 switch (le16_to_cpu(dev->udev->descriptor.idVendor)) {
982 case 0x046d: /* Logitech */
983 if (buffer[1] != 0x41 || buffer[2] != 0x01)
986 /* Logitech implements several vendor specific functions
987 * through vendor specific extension units (LXU).
989 * The LXU descriptors are similar to XU descriptors
990 * (see "USB Device Video Class for Video Devices", section
991 * 3.7.2.6 "Extension Unit Descriptor") with the following
994 * ----------------------------------------------------------
996 * Size of this descriptor, in bytes: 24+p+n*2
997 * ----------------------------------------------------------
998 * 23+p+n bmControlsType N Bitmap
999 * Individual bits in the set are defined:
1003 * This bitset is mapped exactly the same as bmControls.
1004 * ----------------------------------------------------------
1005 * 23+p+n*2 bReserved 1 Boolean
1006 * ----------------------------------------------------------
1007 * 24+p+n*2 iExtension 1 Index
1008 * Index of a string descriptor that describes this
1010 * ----------------------------------------------------------
1012 p = buflen >= 22 ? buffer[21] : 0;
1013 n = buflen >= 25 + p ? buffer[22+p] : 0;
1015 if (buflen < 25 + p + 2*n) {
1016 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
1017 "interface %d EXTENSION_UNIT error\n",
1018 udev->devnum, alts->desc.bInterfaceNumber);
1022 unit = uvc_alloc_entity(UVC_VC_EXTENSION_UNIT, buffer[3],
1027 memcpy(unit->extension.guidExtensionCode, &buffer[4], 16);
1028 unit->extension.bNumControls = buffer[20];
1029 memcpy(unit->baSourceID, &buffer[22], p);
1030 unit->extension.bControlSize = buffer[22+p];
1031 unit->extension.bmControls = (u8 *)unit + sizeof(*unit);
1032 unit->extension.bmControlsType = (u8 *)unit + sizeof(*unit)
1034 memcpy(unit->extension.bmControls, &buffer[23+p], 2*n);
1036 if (buffer[24+p+2*n] == 0 ||
1037 usb_string(udev, buffer[24+p+2*n], unit->name, sizeof(unit->name)) < 0)
1038 sprintf(unit->name, "Extension %u", buffer[3]);
1040 list_add_tail(&unit->list, &dev->entities);
1048 static int uvc_parse_standard_control(struct uvc_device *dev,
1049 const unsigned char *buffer, int buflen)
1051 struct usb_device *udev = dev->udev;
1052 struct uvc_entity *unit, *term;
1053 struct usb_interface *intf;
1054 struct usb_host_interface *alts = dev->intf->cur_altsetting;
1055 unsigned int i, n, p, len;
1058 switch (buffer[2]) {
1060 n = buflen >= 12 ? buffer[11] : 0;
1062 if (buflen < 12 + n) {
1063 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
1064 "interface %d HEADER error\n", udev->devnum,
1065 alts->desc.bInterfaceNumber);
1069 dev->uvc_version = get_unaligned_le16(&buffer[3]);
1070 dev->clock_frequency = get_unaligned_le32(&buffer[7]);
1072 /* Parse all USB Video Streaming interfaces. */
1073 for (i = 0; i < n; ++i) {
1074 intf = usb_ifnum_to_if(udev, buffer[12+i]);
1076 uvc_trace(UVC_TRACE_DESCR, "device %d "
1077 "interface %d doesn't exists\n",
1082 uvc_parse_streaming(dev, intf);
1086 case UVC_VC_INPUT_TERMINAL:
1088 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
1089 "interface %d INPUT_TERMINAL error\n",
1090 udev->devnum, alts->desc.bInterfaceNumber);
1095 * Reject invalid terminal types that would cause issues:
1097 * - The high byte must be non-zero, otherwise it would be
1098 * confused with a unit.
1100 * - Bit 15 must be 0, as we use it internally as a terminal
1103 * Other unknown types are accepted.
1105 type = get_unaligned_le16(&buffer[4]);
1106 if ((type & 0x7f00) == 0 || (type & 0x8000) != 0) {
1107 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
1108 "interface %d INPUT_TERMINAL %d has invalid "
1109 "type 0x%04x, skipping\n", udev->devnum,
1110 alts->desc.bInterfaceNumber,
1119 if (type == UVC_ITT_CAMERA) {
1120 n = buflen >= 15 ? buffer[14] : 0;
1123 } else if (type == UVC_ITT_MEDIA_TRANSPORT_INPUT) {
1124 n = buflen >= 9 ? buffer[8] : 0;
1125 p = buflen >= 10 + n ? buffer[9+n] : 0;
1129 if (buflen < len + n + p) {
1130 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
1131 "interface %d INPUT_TERMINAL error\n",
1132 udev->devnum, alts->desc.bInterfaceNumber);
1136 term = uvc_alloc_entity(type | UVC_TERM_INPUT, buffer[3],
1141 if (UVC_ENTITY_TYPE(term) == UVC_ITT_CAMERA) {
1142 term->camera.bControlSize = n;
1143 term->camera.bmControls = (u8 *)term + sizeof(*term);
1144 term->camera.wObjectiveFocalLengthMin =
1145 get_unaligned_le16(&buffer[8]);
1146 term->camera.wObjectiveFocalLengthMax =
1147 get_unaligned_le16(&buffer[10]);
1148 term->camera.wOcularFocalLength =
1149 get_unaligned_le16(&buffer[12]);
1150 memcpy(term->camera.bmControls, &buffer[15], n);
1151 } else if (UVC_ENTITY_TYPE(term) ==
1152 UVC_ITT_MEDIA_TRANSPORT_INPUT) {
1153 term->media.bControlSize = n;
1154 term->media.bmControls = (u8 *)term + sizeof(*term);
1155 term->media.bTransportModeSize = p;
1156 term->media.bmTransportModes = (u8 *)term
1157 + sizeof(*term) + n;
1158 memcpy(term->media.bmControls, &buffer[9], n);
1159 memcpy(term->media.bmTransportModes, &buffer[10+n], p);
1162 if (buffer[7] == 0 ||
1163 usb_string(udev, buffer[7], term->name, sizeof(term->name)) < 0) {
1164 if (UVC_ENTITY_TYPE(term) == UVC_ITT_CAMERA)
1165 sprintf(term->name, "Camera %u", buffer[3]);
1166 if (UVC_ENTITY_TYPE(term) == UVC_ITT_MEDIA_TRANSPORT_INPUT)
1167 sprintf(term->name, "Media %u", buffer[3]);
1169 sprintf(term->name, "Input %u", buffer[3]);
1172 list_add_tail(&term->list, &dev->entities);
1175 case UVC_VC_OUTPUT_TERMINAL:
1177 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
1178 "interface %d OUTPUT_TERMINAL error\n",
1179 udev->devnum, alts->desc.bInterfaceNumber);
1183 /* Make sure the terminal type MSB is not null, otherwise it
1184 * could be confused with a unit.
1186 type = get_unaligned_le16(&buffer[4]);
1187 if ((type & 0xff00) == 0) {
1188 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
1189 "interface %d OUTPUT_TERMINAL %d has invalid "
1190 "type 0x%04x, skipping\n", udev->devnum,
1191 alts->desc.bInterfaceNumber, buffer[3], type);
1195 term = uvc_alloc_entity(type | UVC_TERM_OUTPUT, buffer[3],
1200 memcpy(term->baSourceID, &buffer[7], 1);
1202 if (buffer[8] == 0 ||
1203 usb_string(udev, buffer[8], term->name, sizeof(term->name)) < 0)
1204 sprintf(term->name, "Output %u", buffer[3]);
1206 list_add_tail(&term->list, &dev->entities);
1209 case UVC_VC_SELECTOR_UNIT:
1210 p = buflen >= 5 ? buffer[4] : 0;
1212 if (buflen < 5 || buflen < 6 + p) {
1213 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
1214 "interface %d SELECTOR_UNIT error\n",
1215 udev->devnum, alts->desc.bInterfaceNumber);
1219 unit = uvc_alloc_entity(buffer[2], buffer[3], p + 1, 0);
1223 memcpy(unit->baSourceID, &buffer[5], p);
1225 if (buffer[5+p] == 0 ||
1226 usb_string(udev, buffer[5+p], unit->name, sizeof(unit->name)) < 0)
1227 sprintf(unit->name, "Selector %u", buffer[3]);
1229 list_add_tail(&unit->list, &dev->entities);
1232 case UVC_VC_PROCESSING_UNIT:
1233 n = buflen >= 8 ? buffer[7] : 0;
1234 p = dev->uvc_version >= 0x0110 ? 10 : 9;
1236 if (buflen < p + n) {
1237 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
1238 "interface %d PROCESSING_UNIT error\n",
1239 udev->devnum, alts->desc.bInterfaceNumber);
1243 unit = uvc_alloc_entity(buffer[2], buffer[3], 2, n);
1247 memcpy(unit->baSourceID, &buffer[4], 1);
1248 unit->processing.wMaxMultiplier =
1249 get_unaligned_le16(&buffer[5]);
1250 unit->processing.bControlSize = buffer[7];
1251 unit->processing.bmControls = (u8 *)unit + sizeof(*unit);
1252 memcpy(unit->processing.bmControls, &buffer[8], n);
1253 if (dev->uvc_version >= 0x0110)
1254 unit->processing.bmVideoStandards = buffer[9+n];
1256 if (buffer[8+n] == 0 ||
1257 usb_string(udev, buffer[8+n], unit->name, sizeof(unit->name)) < 0)
1258 sprintf(unit->name, "Processing %u", buffer[3]);
1260 list_add_tail(&unit->list, &dev->entities);
1263 case UVC_VC_EXTENSION_UNIT:
1264 p = buflen >= 22 ? buffer[21] : 0;
1265 n = buflen >= 24 + p ? buffer[22+p] : 0;
1267 if (buflen < 24 + p + n) {
1268 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
1269 "interface %d EXTENSION_UNIT error\n",
1270 udev->devnum, alts->desc.bInterfaceNumber);
1274 unit = uvc_alloc_entity(buffer[2], buffer[3], p + 1, n);
1278 memcpy(unit->extension.guidExtensionCode, &buffer[4], 16);
1279 unit->extension.bNumControls = buffer[20];
1280 memcpy(unit->baSourceID, &buffer[22], p);
1281 unit->extension.bControlSize = buffer[22+p];
1282 unit->extension.bmControls = (u8 *)unit + sizeof(*unit);
1283 memcpy(unit->extension.bmControls, &buffer[23+p], n);
1285 if (buffer[23+p+n] == 0 ||
1286 usb_string(udev, buffer[23+p+n], unit->name, sizeof(unit->name)) < 0)
1287 sprintf(unit->name, "Extension %u", buffer[3]);
1289 list_add_tail(&unit->list, &dev->entities);
1293 uvc_trace(UVC_TRACE_DESCR, "Found an unknown CS_INTERFACE "
1294 "descriptor (%u)\n", buffer[2]);
1301 static int uvc_parse_control(struct uvc_device *dev)
1303 struct usb_host_interface *alts = dev->intf->cur_altsetting;
1304 unsigned char *buffer = alts->extra;
1305 int buflen = alts->extralen;
1308 /* Parse the default alternate setting only, as the UVC specification
1309 * defines a single alternate setting, the default alternate setting
1313 while (buflen > 2) {
1314 if (uvc_parse_vendor_control(dev, buffer, buflen) ||
1315 buffer[1] != USB_DT_CS_INTERFACE)
1316 goto next_descriptor;
1318 if ((ret = uvc_parse_standard_control(dev, buffer, buflen)) < 0)
1322 buflen -= buffer[0];
1323 buffer += buffer[0];
1326 /* Check if the optional status endpoint is present. Built-in iSight
1327 * webcams have an interrupt endpoint but spit proprietary data that
1328 * don't conform to the UVC status endpoint messages. Don't try to
1329 * handle the interrupt endpoint for those cameras.
1331 if (alts->desc.bNumEndpoints == 1 &&
1332 !(dev->quirks & UVC_QUIRK_BUILTIN_ISIGHT)) {
1333 struct usb_host_endpoint *ep = &alts->endpoint[0];
1334 struct usb_endpoint_descriptor *desc = &ep->desc;
1336 if (usb_endpoint_is_int_in(desc) &&
1337 le16_to_cpu(desc->wMaxPacketSize) >= 8 &&
1338 desc->bInterval != 0) {
1339 uvc_trace(UVC_TRACE_DESCR, "Found a Status endpoint "
1340 "(addr %02x).\n", desc->bEndpointAddress);
1348 /* ------------------------------------------------------------------------
1353 * Scan the UVC descriptors to locate a chain starting at an Output Terminal
1354 * and containing the following units:
1356 * - one or more Output Terminals (USB Streaming or Display)
1357 * - zero or one Processing Unit
1358 * - zero, one or more single-input Selector Units
1359 * - zero or one multiple-input Selector Units, provided all inputs are
1360 * connected to input terminals
1361 * - zero, one or mode single-input Extension Units
1362 * - one or more Input Terminals (Camera, External or USB Streaming)
1364 * The terminal and units must match on of the following structures:
1366 * ITT_*(0) -> +---------+ +---------+ +---------+ -> TT_STREAMING(0)
1367 * ... | SU{0,1} | -> | PU{0,1} | -> | XU{0,n} | ...
1368 * ITT_*(n) -> +---------+ +---------+ +---------+ -> TT_STREAMING(n)
1370 * +---------+ +---------+ -> OTT_*(0)
1371 * TT_STREAMING -> | PU{0,1} | -> | XU{0,n} | ...
1372 * +---------+ +---------+ -> OTT_*(n)
1374 * The Processing Unit and Extension Units can be in any order. Additional
1375 * Extension Units connected to the main chain as single-unit branches are
1376 * also supported. Single-input Selector Units are ignored.
1378 static int uvc_scan_chain_entity(struct uvc_video_chain *chain,
1379 struct uvc_entity *entity)
1381 switch (UVC_ENTITY_TYPE(entity)) {
1382 case UVC_VC_EXTENSION_UNIT:
1383 if (uvc_trace_param & UVC_TRACE_PROBE)
1384 printk(KERN_CONT " <- XU %d", entity->id);
1386 if (entity->bNrInPins != 1) {
1387 uvc_trace(UVC_TRACE_DESCR, "Extension unit %d has more "
1388 "than 1 input pin.\n", entity->id);
1394 case UVC_VC_PROCESSING_UNIT:
1395 if (uvc_trace_param & UVC_TRACE_PROBE)
1396 printk(KERN_CONT " <- PU %d", entity->id);
1398 if (chain->processing != NULL) {
1399 uvc_trace(UVC_TRACE_DESCR, "Found multiple "
1400 "Processing Units in chain.\n");
1404 chain->processing = entity;
1407 case UVC_VC_SELECTOR_UNIT:
1408 if (uvc_trace_param & UVC_TRACE_PROBE)
1409 printk(KERN_CONT " <- SU %d", entity->id);
1411 /* Single-input selector units are ignored. */
1412 if (entity->bNrInPins == 1)
1415 if (chain->selector != NULL) {
1416 uvc_trace(UVC_TRACE_DESCR, "Found multiple Selector "
1417 "Units in chain.\n");
1421 chain->selector = entity;
1424 case UVC_ITT_VENDOR_SPECIFIC:
1425 case UVC_ITT_CAMERA:
1426 case UVC_ITT_MEDIA_TRANSPORT_INPUT:
1427 if (uvc_trace_param & UVC_TRACE_PROBE)
1428 printk(KERN_CONT " <- IT %d\n", entity->id);
1432 case UVC_OTT_VENDOR_SPECIFIC:
1433 case UVC_OTT_DISPLAY:
1434 case UVC_OTT_MEDIA_TRANSPORT_OUTPUT:
1435 if (uvc_trace_param & UVC_TRACE_PROBE)
1436 printk(KERN_CONT " OT %d", entity->id);
1440 case UVC_TT_STREAMING:
1441 if (UVC_ENTITY_IS_ITERM(entity)) {
1442 if (uvc_trace_param & UVC_TRACE_PROBE)
1443 printk(KERN_CONT " <- IT %d\n", entity->id);
1445 if (uvc_trace_param & UVC_TRACE_PROBE)
1446 printk(KERN_CONT " OT %d", entity->id);
1452 uvc_trace(UVC_TRACE_DESCR, "Unsupported entity type "
1453 "0x%04x found in chain.\n", UVC_ENTITY_TYPE(entity));
1457 list_add_tail(&entity->chain, &chain->entities);
1461 static int uvc_scan_chain_forward(struct uvc_video_chain *chain,
1462 struct uvc_entity *entity, struct uvc_entity *prev)
1464 struct uvc_entity *forward;
1472 forward = uvc_entity_by_reference(chain->dev, entity->id,
1474 if (forward == NULL)
1476 if (forward == prev)
1478 if (forward->chain.next || forward->chain.prev) {
1479 uvc_trace(UVC_TRACE_DESCR, "Found reference to "
1480 "entity %d already in chain.\n", forward->id);
1484 switch (UVC_ENTITY_TYPE(forward)) {
1485 case UVC_VC_EXTENSION_UNIT:
1486 if (forward->bNrInPins != 1) {
1487 uvc_trace(UVC_TRACE_DESCR, "Extension unit %d "
1488 "has more than 1 input pin.\n",
1493 list_add_tail(&forward->chain, &chain->entities);
1494 if (uvc_trace_param & UVC_TRACE_PROBE) {
1496 printk(KERN_CONT " (->");
1498 printk(KERN_CONT " XU %d", forward->id);
1503 case UVC_OTT_VENDOR_SPECIFIC:
1504 case UVC_OTT_DISPLAY:
1505 case UVC_OTT_MEDIA_TRANSPORT_OUTPUT:
1506 case UVC_TT_STREAMING:
1507 if (UVC_ENTITY_IS_ITERM(forward)) {
1508 uvc_trace(UVC_TRACE_DESCR, "Unsupported input "
1509 "terminal %u.\n", forward->id);
1513 list_add_tail(&forward->chain, &chain->entities);
1514 if (uvc_trace_param & UVC_TRACE_PROBE) {
1516 printk(KERN_CONT " (->");
1518 printk(KERN_CONT " OT %d", forward->id);
1525 printk(KERN_CONT ")");
1530 static int uvc_scan_chain_backward(struct uvc_video_chain *chain,
1531 struct uvc_entity **_entity)
1533 struct uvc_entity *entity = *_entity;
1534 struct uvc_entity *term;
1535 int id = -EINVAL, i;
1537 switch (UVC_ENTITY_TYPE(entity)) {
1538 case UVC_VC_EXTENSION_UNIT:
1539 case UVC_VC_PROCESSING_UNIT:
1540 id = entity->baSourceID[0];
1543 case UVC_VC_SELECTOR_UNIT:
1544 /* Single-input selector units are ignored. */
1545 if (entity->bNrInPins == 1) {
1546 id = entity->baSourceID[0];
1550 if (uvc_trace_param & UVC_TRACE_PROBE)
1551 printk(KERN_CONT " <- IT");
1553 chain->selector = entity;
1554 for (i = 0; i < entity->bNrInPins; ++i) {
1555 id = entity->baSourceID[i];
1556 term = uvc_entity_by_id(chain->dev, id);
1557 if (term == NULL || !UVC_ENTITY_IS_ITERM(term)) {
1558 uvc_trace(UVC_TRACE_DESCR, "Selector unit %d "
1559 "input %d isn't connected to an "
1560 "input terminal\n", entity->id, i);
1564 if (term->chain.next || term->chain.prev) {
1565 uvc_trace(UVC_TRACE_DESCR, "Found reference to "
1566 "entity %d already in chain.\n",
1571 if (uvc_trace_param & UVC_TRACE_PROBE)
1572 printk(KERN_CONT " %d", term->id);
1574 list_add_tail(&term->chain, &chain->entities);
1575 uvc_scan_chain_forward(chain, term, entity);
1578 if (uvc_trace_param & UVC_TRACE_PROBE)
1579 printk(KERN_CONT "\n");
1584 case UVC_ITT_VENDOR_SPECIFIC:
1585 case UVC_ITT_CAMERA:
1586 case UVC_ITT_MEDIA_TRANSPORT_INPUT:
1587 case UVC_OTT_VENDOR_SPECIFIC:
1588 case UVC_OTT_DISPLAY:
1589 case UVC_OTT_MEDIA_TRANSPORT_OUTPUT:
1590 case UVC_TT_STREAMING:
1591 id = UVC_ENTITY_IS_OTERM(entity) ? entity->baSourceID[0] : 0;
1600 entity = uvc_entity_by_id(chain->dev, id);
1601 if (entity == NULL) {
1602 uvc_trace(UVC_TRACE_DESCR, "Found reference to "
1603 "unknown entity %d.\n", id);
1611 static int uvc_scan_chain(struct uvc_video_chain *chain,
1612 struct uvc_entity *term)
1614 struct uvc_entity *entity, *prev;
1616 uvc_trace(UVC_TRACE_PROBE, "Scanning UVC chain:");
1621 while (entity != NULL) {
1622 /* Entity must not be part of an existing chain */
1623 if (entity->chain.next || entity->chain.prev) {
1624 uvc_trace(UVC_TRACE_DESCR, "Found reference to "
1625 "entity %d already in chain.\n", entity->id);
1629 /* Process entity */
1630 if (uvc_scan_chain_entity(chain, entity) < 0)
1634 if (uvc_scan_chain_forward(chain, entity, prev) < 0)
1639 if (uvc_scan_chain_backward(chain, &entity) < 0)
1646 static unsigned int uvc_print_terms(struct list_head *terms, u16 dir,
1649 struct uvc_entity *term;
1650 unsigned int nterms = 0;
1653 list_for_each_entry(term, terms, chain) {
1654 if (!UVC_ENTITY_IS_TERM(term) ||
1655 UVC_TERM_DIRECTION(term) != dir)
1659 p += sprintf(p, ",");
1660 if (++nterms >= 4) {
1661 p += sprintf(p, "...");
1664 p += sprintf(p, "%u", term->id);
1670 static const char *uvc_print_chain(struct uvc_video_chain *chain)
1672 static char buffer[43];
1675 p += uvc_print_terms(&chain->entities, UVC_TERM_INPUT, p);
1676 p += sprintf(p, " -> ");
1677 uvc_print_terms(&chain->entities, UVC_TERM_OUTPUT, p);
1682 static struct uvc_video_chain *uvc_alloc_chain(struct uvc_device *dev)
1684 struct uvc_video_chain *chain;
1686 chain = kzalloc(sizeof(*chain), GFP_KERNEL);
1690 INIT_LIST_HEAD(&chain->entities);
1691 mutex_init(&chain->ctrl_mutex);
1693 v4l2_prio_init(&chain->prio);
1699 * Fallback heuristic for devices that don't connect units and terminals in a
1702 * Some devices have invalid baSourceID references, causing uvc_scan_chain()
1703 * to fail, but if we just take the entities we can find and put them together
1704 * in the most sensible chain we can think of, turns out they do work anyway.
1705 * Note: This heuristic assumes there is a single chain.
1707 * At the time of writing, devices known to have such a broken chain are
1708 * - Acer Integrated Camera (5986:055a)
1709 * - Realtek rtl157a7 (0bda:57a7)
1711 static int uvc_scan_fallback(struct uvc_device *dev)
1713 struct uvc_video_chain *chain;
1714 struct uvc_entity *iterm = NULL;
1715 struct uvc_entity *oterm = NULL;
1716 struct uvc_entity *entity;
1717 struct uvc_entity *prev;
1720 * Start by locating the input and output terminals. We only support
1721 * devices with exactly one of each for now.
1723 list_for_each_entry(entity, &dev->entities, list) {
1724 if (UVC_ENTITY_IS_ITERM(entity)) {
1730 if (UVC_ENTITY_IS_OTERM(entity)) {
1737 if (iterm == NULL || oterm == NULL)
1740 /* Allocate the chain and fill it. */
1741 chain = uvc_alloc_chain(dev);
1745 if (uvc_scan_chain_entity(chain, oterm) < 0)
1751 * Add all Processing and Extension Units with two pads. The order
1752 * doesn't matter much, use reverse list traversal to connect units in
1753 * UVC descriptor order as we build the chain from output to input. This
1754 * leads to units appearing in the order meant by the manufacturer for
1755 * the cameras known to require this heuristic.
1757 list_for_each_entry_reverse(entity, &dev->entities, list) {
1758 if (entity->type != UVC_VC_PROCESSING_UNIT &&
1759 entity->type != UVC_VC_EXTENSION_UNIT)
1762 if (entity->num_pads != 2)
1765 if (uvc_scan_chain_entity(chain, entity) < 0)
1768 prev->baSourceID[0] = entity->id;
1772 if (uvc_scan_chain_entity(chain, iterm) < 0)
1775 prev->baSourceID[0] = iterm->id;
1777 list_add_tail(&chain->list, &dev->chains);
1779 uvc_trace(UVC_TRACE_PROBE,
1780 "Found a video chain by fallback heuristic (%s).\n",
1781 uvc_print_chain(chain));
1791 * Scan the device for video chains and register video devices.
1793 * Chains are scanned starting at their output terminals and walked backwards.
1795 static int uvc_scan_device(struct uvc_device *dev)
1797 struct uvc_video_chain *chain;
1798 struct uvc_entity *term;
1800 list_for_each_entry(term, &dev->entities, list) {
1801 if (!UVC_ENTITY_IS_OTERM(term))
1804 /* If the terminal is already included in a chain, skip it.
1805 * This can happen for chains that have multiple output
1806 * terminals, where all output terminals beside the first one
1807 * will be inserted in the chain in forward scans.
1809 if (term->chain.next || term->chain.prev)
1812 chain = uvc_alloc_chain(dev);
1816 term->flags |= UVC_ENTITY_FLAG_DEFAULT;
1818 if (uvc_scan_chain(chain, term) < 0) {
1823 uvc_trace(UVC_TRACE_PROBE, "Found a valid video chain (%s).\n",
1824 uvc_print_chain(chain));
1826 list_add_tail(&chain->list, &dev->chains);
1829 if (list_empty(&dev->chains))
1830 uvc_scan_fallback(dev);
1832 if (list_empty(&dev->chains)) {
1833 uvc_printk(KERN_INFO, "No valid video chain found.\n");
1840 /* ------------------------------------------------------------------------
1841 * Video device registration and unregistration
1845 * Delete the UVC device.
1847 * Called by the kernel when the last reference to the uvc_device structure
1850 * As this function is called after or during disconnect(), all URBs have
1851 * already been cancelled by the USB core. There is no need to kill the
1852 * interrupt URB manually.
1854 static void uvc_delete(struct kref *kref)
1856 struct uvc_device *dev = container_of(kref, struct uvc_device, ref);
1857 struct list_head *p, *n;
1859 uvc_status_cleanup(dev);
1860 uvc_ctrl_cleanup_device(dev);
1862 usb_put_intf(dev->intf);
1863 usb_put_dev(dev->udev);
1865 #ifdef CONFIG_MEDIA_CONTROLLER
1866 media_device_cleanup(&dev->mdev);
1869 list_for_each_safe(p, n, &dev->chains) {
1870 struct uvc_video_chain *chain;
1871 chain = list_entry(p, struct uvc_video_chain, list);
1875 list_for_each_safe(p, n, &dev->entities) {
1876 struct uvc_entity *entity;
1877 entity = list_entry(p, struct uvc_entity, list);
1878 #ifdef CONFIG_MEDIA_CONTROLLER
1879 uvc_mc_cleanup_entity(entity);
1884 list_for_each_safe(p, n, &dev->streams) {
1885 struct uvc_streaming *streaming;
1886 streaming = list_entry(p, struct uvc_streaming, list);
1887 usb_driver_release_interface(&uvc_driver.driver,
1889 uvc_stream_delete(streaming);
1895 static void uvc_release(struct video_device *vdev)
1897 struct uvc_streaming *stream = video_get_drvdata(vdev);
1898 struct uvc_device *dev = stream->dev;
1900 kref_put(&dev->ref, uvc_delete);
1904 * Unregister the video devices.
1906 static void uvc_unregister_video(struct uvc_device *dev)
1908 struct uvc_streaming *stream;
1910 list_for_each_entry(stream, &dev->streams, list) {
1911 if (!video_is_registered(&stream->vdev))
1914 video_unregister_device(&stream->vdev);
1915 video_unregister_device(&stream->meta.vdev);
1917 uvc_debugfs_cleanup_stream(stream);
1920 uvc_status_unregister(dev);
1923 v4l2_device_unregister(&dev->vdev);
1924 #ifdef CONFIG_MEDIA_CONTROLLER
1925 if (media_devnode_is_registered(dev->mdev.devnode))
1926 media_device_unregister(&dev->mdev);
1930 int uvc_register_video_device(struct uvc_device *dev,
1931 struct uvc_streaming *stream,
1932 struct video_device *vdev,
1933 struct uvc_video_queue *queue,
1934 enum v4l2_buf_type type,
1935 const struct v4l2_file_operations *fops,
1936 const struct v4l2_ioctl_ops *ioctl_ops)
1940 /* Initialize the video buffers queue. */
1941 ret = uvc_queue_init(queue, type, !uvc_no_drop_param);
1945 /* Register the device with V4L. */
1948 * We already hold a reference to dev->udev. The video device will be
1949 * unregistered before the reference is released, so we don't need to
1952 vdev->v4l2_dev = &dev->vdev;
1954 vdev->ioctl_ops = ioctl_ops;
1955 vdev->release = uvc_release;
1956 vdev->prio = &stream->chain->prio;
1957 if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
1958 vdev->vfl_dir = VFL_DIR_TX;
1960 vdev->vfl_dir = VFL_DIR_RX;
1963 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
1965 vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
1967 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
1968 vdev->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
1970 case V4L2_BUF_TYPE_META_CAPTURE:
1971 vdev->device_caps = V4L2_CAP_META_CAPTURE | V4L2_CAP_STREAMING;
1975 strlcpy(vdev->name, dev->name, sizeof(vdev->name));
1978 * Set the driver data before calling video_register_device, otherwise
1979 * the file open() handler might race us.
1981 video_set_drvdata(vdev, stream);
1983 ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1);
1985 uvc_printk(KERN_ERR, "Failed to register %s device (%d).\n",
1986 v4l2_type_names[type], ret);
1990 kref_get(&dev->ref);
1994 static int uvc_register_video(struct uvc_device *dev,
1995 struct uvc_streaming *stream)
1999 /* Initialize the streaming interface with default parameters. */
2000 ret = uvc_video_init(stream);
2002 uvc_printk(KERN_ERR, "Failed to initialize the device (%d).\n",
2007 if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
2008 stream->chain->caps |= V4L2_CAP_VIDEO_CAPTURE
2009 | V4L2_CAP_META_CAPTURE;
2011 stream->chain->caps |= V4L2_CAP_VIDEO_OUTPUT;
2013 uvc_debugfs_init_stream(stream);
2015 /* Register the device with V4L. */
2016 return uvc_register_video_device(dev, stream, &stream->vdev,
2017 &stream->queue, stream->type,
2018 &uvc_fops, &uvc_ioctl_ops);
2022 * Register all video devices in all chains.
2024 static int uvc_register_terms(struct uvc_device *dev,
2025 struct uvc_video_chain *chain)
2027 struct uvc_streaming *stream;
2028 struct uvc_entity *term;
2031 list_for_each_entry(term, &chain->entities, chain) {
2032 if (UVC_ENTITY_TYPE(term) != UVC_TT_STREAMING)
2035 stream = uvc_stream_by_id(dev, term->id);
2036 if (stream == NULL) {
2037 uvc_printk(KERN_INFO, "No streaming interface found "
2038 "for terminal %u.", term->id);
2042 stream->chain = chain;
2043 ret = uvc_register_video(dev, stream);
2047 /* Register a metadata node, but ignore a possible failure,
2048 * complete registration of video nodes anyway.
2050 uvc_meta_register(stream);
2052 term->vdev = &stream->vdev;
2058 static int uvc_register_chains(struct uvc_device *dev)
2060 struct uvc_video_chain *chain;
2063 list_for_each_entry(chain, &dev->chains, list) {
2064 ret = uvc_register_terms(dev, chain);
2068 #ifdef CONFIG_MEDIA_CONTROLLER
2069 ret = uvc_mc_register_entities(chain);
2071 uvc_printk(KERN_INFO, "Failed to register entites "
2080 /* ------------------------------------------------------------------------
2081 * USB probe, disconnect, suspend and resume
2084 struct uvc_device_info {
2089 static int uvc_probe(struct usb_interface *intf,
2090 const struct usb_device_id *id)
2092 struct usb_device *udev = interface_to_usbdev(intf);
2093 struct uvc_device *dev;
2094 const struct uvc_device_info *info =
2095 (const struct uvc_device_info *)id->driver_info;
2096 u32 quirks = info ? info->quirks : 0;
2100 if (id->idVendor && id->idProduct)
2101 uvc_trace(UVC_TRACE_PROBE, "Probing known UVC device %s "
2102 "(%04x:%04x)\n", udev->devpath, id->idVendor,
2105 uvc_trace(UVC_TRACE_PROBE, "Probing generic UVC device %s\n",
2108 /* Allocate memory for the device and initialize it. */
2109 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
2113 INIT_LIST_HEAD(&dev->entities);
2114 INIT_LIST_HEAD(&dev->chains);
2115 INIT_LIST_HEAD(&dev->streams);
2116 kref_init(&dev->ref);
2117 atomic_set(&dev->nmappings, 0);
2118 mutex_init(&dev->lock);
2120 dev->udev = usb_get_dev(udev);
2121 dev->intf = usb_get_intf(intf);
2122 dev->intfnum = intf->cur_altsetting->desc.bInterfaceNumber;
2123 dev->quirks = (uvc_quirks_param == -1)
2124 ? quirks : uvc_quirks_param;
2126 dev->meta_format = info->meta_format;
2128 if (udev->product != NULL)
2129 strlcpy(dev->name, udev->product, sizeof(dev->name));
2131 snprintf(dev->name, sizeof(dev->name),
2132 "UVC Camera (%04x:%04x)",
2133 le16_to_cpu(udev->descriptor.idVendor),
2134 le16_to_cpu(udev->descriptor.idProduct));
2137 * Add iFunction or iInterface to names when available as additional
2138 * distinguishers between interfaces. iFunction is prioritized over
2139 * iInterface which matches Windows behavior at the point of writing.
2141 if (intf->intf_assoc && intf->intf_assoc->iFunction != 0)
2142 function = intf->intf_assoc->iFunction;
2144 function = intf->cur_altsetting->desc.iInterface;
2145 if (function != 0) {
2148 strlcat(dev->name, ": ", sizeof(dev->name));
2149 len = strlen(dev->name);
2150 usb_string(udev, function, dev->name + len,
2151 sizeof(dev->name) - len);
2154 /* Initialize the media device. */
2155 #ifdef CONFIG_MEDIA_CONTROLLER
2156 dev->mdev.dev = &intf->dev;
2157 strscpy(dev->mdev.model, dev->name, sizeof(dev->mdev.model));
2159 strscpy(dev->mdev.serial, udev->serial,
2160 sizeof(dev->mdev.serial));
2161 usb_make_path(udev, dev->mdev.bus_info, sizeof(dev->mdev.bus_info));
2162 dev->mdev.hw_revision = le16_to_cpu(udev->descriptor.bcdDevice);
2163 media_device_init(&dev->mdev);
2165 dev->vdev.mdev = &dev->mdev;
2168 /* Parse the Video Class control descriptor. */
2169 if (uvc_parse_control(dev) < 0) {
2170 uvc_trace(UVC_TRACE_PROBE, "Unable to parse UVC "
2175 uvc_printk(KERN_INFO, "Found UVC %u.%02x device %s (%04x:%04x)\n",
2176 dev->uvc_version >> 8, dev->uvc_version & 0xff,
2177 udev->product ? udev->product : "<unnamed>",
2178 le16_to_cpu(udev->descriptor.idVendor),
2179 le16_to_cpu(udev->descriptor.idProduct));
2181 if (dev->quirks != quirks) {
2182 uvc_printk(KERN_INFO, "Forcing device quirks to 0x%x by module "
2183 "parameter for testing purpose.\n", dev->quirks);
2184 uvc_printk(KERN_INFO, "Please report required quirks to the "
2185 "linux-uvc-devel mailing list.\n");
2188 /* Register the V4L2 device. */
2189 if (v4l2_device_register(&intf->dev, &dev->vdev) < 0)
2192 /* Initialize controls. */
2193 if (uvc_ctrl_init_device(dev) < 0)
2196 /* Scan the device for video chains. */
2197 if (uvc_scan_device(dev) < 0)
2200 /* Register video device nodes. */
2201 if (uvc_register_chains(dev) < 0)
2204 #ifdef CONFIG_MEDIA_CONTROLLER
2205 /* Register the media device node */
2206 if (media_device_register(&dev->mdev) < 0)
2209 /* Save our data pointer in the interface data. */
2210 usb_set_intfdata(intf, dev);
2212 /* Initialize the interrupt URB. */
2213 if ((ret = uvc_status_init(dev)) < 0) {
2214 uvc_printk(KERN_INFO, "Unable to initialize the status "
2215 "endpoint (%d), status interrupt will not be "
2216 "supported.\n", ret);
2219 uvc_trace(UVC_TRACE_PROBE, "UVC device initialized.\n");
2220 usb_enable_autosuspend(udev);
2224 uvc_unregister_video(dev);
2225 kref_put(&dev->ref, uvc_delete);
2229 static void uvc_disconnect(struct usb_interface *intf)
2231 struct uvc_device *dev = usb_get_intfdata(intf);
2233 /* Set the USB interface data to NULL. This can be done outside the
2234 * lock, as there's no other reader.
2236 usb_set_intfdata(intf, NULL);
2238 if (intf->cur_altsetting->desc.bInterfaceSubClass ==
2239 UVC_SC_VIDEOSTREAMING)
2242 uvc_unregister_video(dev);
2243 kref_put(&dev->ref, uvc_delete);
2246 static int uvc_suspend(struct usb_interface *intf, pm_message_t message)
2248 struct uvc_device *dev = usb_get_intfdata(intf);
2249 struct uvc_streaming *stream;
2251 uvc_trace(UVC_TRACE_SUSPEND, "Suspending interface %u\n",
2252 intf->cur_altsetting->desc.bInterfaceNumber);
2254 /* Controls are cached on the fly so they don't need to be saved. */
2255 if (intf->cur_altsetting->desc.bInterfaceSubClass ==
2256 UVC_SC_VIDEOCONTROL) {
2257 mutex_lock(&dev->lock);
2259 uvc_status_stop(dev);
2260 mutex_unlock(&dev->lock);
2264 list_for_each_entry(stream, &dev->streams, list) {
2265 if (stream->intf == intf)
2266 return uvc_video_suspend(stream);
2269 uvc_trace(UVC_TRACE_SUSPEND, "Suspend: video streaming USB interface "
2274 static int __uvc_resume(struct usb_interface *intf, int reset)
2276 struct uvc_device *dev = usb_get_intfdata(intf);
2277 struct uvc_streaming *stream;
2280 uvc_trace(UVC_TRACE_SUSPEND, "Resuming interface %u\n",
2281 intf->cur_altsetting->desc.bInterfaceNumber);
2283 if (intf->cur_altsetting->desc.bInterfaceSubClass ==
2284 UVC_SC_VIDEOCONTROL) {
2286 ret = uvc_ctrl_restore_values(dev);
2291 mutex_lock(&dev->lock);
2293 ret = uvc_status_start(dev, GFP_NOIO);
2294 mutex_unlock(&dev->lock);
2299 list_for_each_entry(stream, &dev->streams, list) {
2300 if (stream->intf == intf) {
2301 ret = uvc_video_resume(stream, reset);
2303 uvc_queue_streamoff(&stream->queue,
2304 stream->queue.queue.type);
2309 uvc_trace(UVC_TRACE_SUSPEND, "Resume: video streaming USB interface "
2314 static int uvc_resume(struct usb_interface *intf)
2316 return __uvc_resume(intf, 0);
2319 static int uvc_reset_resume(struct usb_interface *intf)
2321 return __uvc_resume(intf, 1);
2324 /* ------------------------------------------------------------------------
2328 static int uvc_clock_param_get(char *buffer, const struct kernel_param *kp)
2330 if (uvc_clock_param == CLOCK_MONOTONIC)
2331 return sprintf(buffer, "CLOCK_MONOTONIC");
2333 return sprintf(buffer, "CLOCK_REALTIME");
2336 static int uvc_clock_param_set(const char *val, const struct kernel_param *kp)
2338 if (strncasecmp(val, "clock_", strlen("clock_")) == 0)
2339 val += strlen("clock_");
2341 if (strcasecmp(val, "monotonic") == 0)
2342 uvc_clock_param = CLOCK_MONOTONIC;
2343 else if (strcasecmp(val, "realtime") == 0)
2344 uvc_clock_param = CLOCK_REALTIME;
2351 module_param_call(clock, uvc_clock_param_set, uvc_clock_param_get,
2352 &uvc_clock_param, S_IRUGO|S_IWUSR);
2353 MODULE_PARM_DESC(clock, "Video buffers timestamp clock");
2354 module_param_named(hwtimestamps, uvc_hw_timestamps_param, uint, S_IRUGO|S_IWUSR);
2355 MODULE_PARM_DESC(hwtimestamps, "Use hardware timestamps");
2356 module_param_named(nodrop, uvc_no_drop_param, uint, S_IRUGO|S_IWUSR);
2357 MODULE_PARM_DESC(nodrop, "Don't drop incomplete frames");
2358 module_param_named(quirks, uvc_quirks_param, uint, S_IRUGO|S_IWUSR);
2359 MODULE_PARM_DESC(quirks, "Forced device quirks");
2360 module_param_named(trace, uvc_trace_param, uint, S_IRUGO|S_IWUSR);
2361 MODULE_PARM_DESC(trace, "Trace level bitmask");
2362 module_param_named(timeout, uvc_timeout_param, uint, S_IRUGO|S_IWUSR);
2363 MODULE_PARM_DESC(timeout, "Streaming control requests timeout");
2365 /* ------------------------------------------------------------------------
2366 * Driver initialization and cleanup
2369 static const struct uvc_device_info uvc_quirk_probe_minmax = {
2370 .quirks = UVC_QUIRK_PROBE_MINMAX,
2373 static const struct uvc_device_info uvc_quirk_fix_bandwidth = {
2374 .quirks = UVC_QUIRK_FIX_BANDWIDTH,
2377 static const struct uvc_device_info uvc_quirk_probe_def = {
2378 .quirks = UVC_QUIRK_PROBE_DEF,
2381 static const struct uvc_device_info uvc_quirk_stream_no_fid = {
2382 .quirks = UVC_QUIRK_STREAM_NO_FID,
2385 static const struct uvc_device_info uvc_quirk_force_y8 = {
2386 .quirks = UVC_QUIRK_FORCE_Y8,
2389 #define UVC_QUIRK_INFO(q) (kernel_ulong_t)&(struct uvc_device_info){.quirks = q}
2392 * The Logitech cameras listed below have their interface class set to
2393 * VENDOR_SPEC because they don't announce themselves as UVC devices, even
2394 * though they are compliant.
2396 static const struct usb_device_id uvc_ids[] = {
2397 /* LogiLink Wireless Webcam */
2398 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2399 | USB_DEVICE_ID_MATCH_INT_INFO,
2401 .idProduct = 0xa91a,
2402 .bInterfaceClass = USB_CLASS_VIDEO,
2403 .bInterfaceSubClass = 1,
2404 .bInterfaceProtocol = 0,
2405 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
2406 /* Genius eFace 2025 */
2407 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2408 | USB_DEVICE_ID_MATCH_INT_INFO,
2410 .idProduct = 0x706e,
2411 .bInterfaceClass = USB_CLASS_VIDEO,
2412 .bInterfaceSubClass = 1,
2413 .bInterfaceProtocol = 0,
2414 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
2415 /* Microsoft Lifecam NX-6000 */
2416 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2417 | USB_DEVICE_ID_MATCH_INT_INFO,
2419 .idProduct = 0x00f8,
2420 .bInterfaceClass = USB_CLASS_VIDEO,
2421 .bInterfaceSubClass = 1,
2422 .bInterfaceProtocol = 0,
2423 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
2424 /* Microsoft Lifecam NX-3000 */
2425 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2426 | USB_DEVICE_ID_MATCH_INT_INFO,
2428 .idProduct = 0x0721,
2429 .bInterfaceClass = USB_CLASS_VIDEO,
2430 .bInterfaceSubClass = 1,
2431 .bInterfaceProtocol = 0,
2432 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def },
2433 /* Microsoft Lifecam VX-7000 */
2434 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2435 | USB_DEVICE_ID_MATCH_INT_INFO,
2437 .idProduct = 0x0723,
2438 .bInterfaceClass = USB_CLASS_VIDEO,
2439 .bInterfaceSubClass = 1,
2440 .bInterfaceProtocol = 0,
2441 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
2442 /* Logitech Quickcam Fusion */
2443 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2444 | USB_DEVICE_ID_MATCH_INT_INFO,
2446 .idProduct = 0x08c1,
2447 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
2448 .bInterfaceSubClass = 1,
2449 .bInterfaceProtocol = 0 },
2450 /* Logitech Quickcam Orbit MP */
2451 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2452 | USB_DEVICE_ID_MATCH_INT_INFO,
2454 .idProduct = 0x08c2,
2455 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
2456 .bInterfaceSubClass = 1,
2457 .bInterfaceProtocol = 0 },
2458 /* Logitech Quickcam Pro for Notebook */
2459 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2460 | USB_DEVICE_ID_MATCH_INT_INFO,
2462 .idProduct = 0x08c3,
2463 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
2464 .bInterfaceSubClass = 1,
2465 .bInterfaceProtocol = 0 },
2466 /* Logitech Quickcam Pro 5000 */
2467 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2468 | USB_DEVICE_ID_MATCH_INT_INFO,
2470 .idProduct = 0x08c5,
2471 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
2472 .bInterfaceSubClass = 1,
2473 .bInterfaceProtocol = 0 },
2474 /* Logitech Quickcam OEM Dell Notebook */
2475 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2476 | USB_DEVICE_ID_MATCH_INT_INFO,
2478 .idProduct = 0x08c6,
2479 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
2480 .bInterfaceSubClass = 1,
2481 .bInterfaceProtocol = 0 },
2482 /* Logitech Quickcam OEM Cisco VT Camera II */
2483 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2484 | USB_DEVICE_ID_MATCH_INT_INFO,
2486 .idProduct = 0x08c7,
2487 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
2488 .bInterfaceSubClass = 1,
2489 .bInterfaceProtocol = 0 },
2490 /* Logitech HD Pro Webcam C920 */
2491 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2492 | USB_DEVICE_ID_MATCH_INT_INFO,
2494 .idProduct = 0x082d,
2495 .bInterfaceClass = USB_CLASS_VIDEO,
2496 .bInterfaceSubClass = 1,
2497 .bInterfaceProtocol = 0,
2498 .driver_info = UVC_QUIRK_INFO(UVC_QUIRK_RESTORE_CTRLS_ON_INIT) },
2499 /* Chicony CNF7129 (Asus EEE 100HE) */
2500 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2501 | USB_DEVICE_ID_MATCH_INT_INFO,
2503 .idProduct = 0xb071,
2504 .bInterfaceClass = USB_CLASS_VIDEO,
2505 .bInterfaceSubClass = 1,
2506 .bInterfaceProtocol = 0,
2507 .driver_info = UVC_QUIRK_INFO(UVC_QUIRK_RESTRICT_FRAME_RATE) },
2508 /* Alcor Micro AU3820 (Future Boy PC USB Webcam) */
2509 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2510 | USB_DEVICE_ID_MATCH_INT_INFO,
2512 .idProduct = 0x3820,
2513 .bInterfaceClass = USB_CLASS_VIDEO,
2514 .bInterfaceSubClass = 1,
2515 .bInterfaceProtocol = 0,
2516 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
2517 /* Dell XPS m1530 */
2518 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2519 | USB_DEVICE_ID_MATCH_INT_INFO,
2521 .idProduct = 0x2640,
2522 .bInterfaceClass = USB_CLASS_VIDEO,
2523 .bInterfaceSubClass = 1,
2524 .bInterfaceProtocol = 0,
2525 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def },
2526 /* Dell SP2008WFP Monitor */
2527 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2528 | USB_DEVICE_ID_MATCH_INT_INFO,
2530 .idProduct = 0x2641,
2531 .bInterfaceClass = USB_CLASS_VIDEO,
2532 .bInterfaceSubClass = 1,
2533 .bInterfaceProtocol = 0,
2534 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def },
2535 /* Dell Alienware X51 */
2536 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2537 | USB_DEVICE_ID_MATCH_INT_INFO,
2539 .idProduct = 0x2643,
2540 .bInterfaceClass = USB_CLASS_VIDEO,
2541 .bInterfaceSubClass = 1,
2542 .bInterfaceProtocol = 0,
2543 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def },
2544 /* Dell Studio Hybrid 140g (OmniVision webcam) */
2545 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2546 | USB_DEVICE_ID_MATCH_INT_INFO,
2548 .idProduct = 0x264a,
2549 .bInterfaceClass = USB_CLASS_VIDEO,
2550 .bInterfaceSubClass = 1,
2551 .bInterfaceProtocol = 0,
2552 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def },
2553 /* Dell XPS M1330 (OmniVision OV7670 webcam) */
2554 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2555 | USB_DEVICE_ID_MATCH_INT_INFO,
2557 .idProduct = 0x7670,
2558 .bInterfaceClass = USB_CLASS_VIDEO,
2559 .bInterfaceSubClass = 1,
2560 .bInterfaceProtocol = 0,
2561 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def },
2562 /* Apple Built-In iSight */
2563 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2564 | USB_DEVICE_ID_MATCH_INT_INFO,
2566 .idProduct = 0x8501,
2567 .bInterfaceClass = USB_CLASS_VIDEO,
2568 .bInterfaceSubClass = 1,
2569 .bInterfaceProtocol = 0,
2570 .driver_info = UVC_QUIRK_INFO(UVC_QUIRK_PROBE_MINMAX
2571 | UVC_QUIRK_BUILTIN_ISIGHT) },
2572 /* Apple Built-In iSight via iBridge */
2573 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2574 | USB_DEVICE_ID_MATCH_INT_INFO,
2576 .idProduct = 0x8600,
2577 .bInterfaceClass = USB_CLASS_VIDEO,
2578 .bInterfaceSubClass = 1,
2579 .bInterfaceProtocol = 0,
2580 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def },
2581 /* Foxlink ("HP Webcam" on HP Mini 5103) */
2582 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2583 | USB_DEVICE_ID_MATCH_INT_INFO,
2585 .idProduct = 0x0403,
2586 .bInterfaceClass = USB_CLASS_VIDEO,
2587 .bInterfaceSubClass = 1,
2588 .bInterfaceProtocol = 0,
2589 .driver_info = (kernel_ulong_t)&uvc_quirk_fix_bandwidth },
2590 /* Genesys Logic USB 2.0 PC Camera */
2591 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2592 | USB_DEVICE_ID_MATCH_INT_INFO,
2594 .idProduct = 0x0505,
2595 .bInterfaceClass = USB_CLASS_VIDEO,
2596 .bInterfaceSubClass = 1,
2597 .bInterfaceProtocol = 0,
2598 .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid },
2599 /* Hercules Classic Silver */
2600 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2601 | USB_DEVICE_ID_MATCH_INT_INFO,
2603 .idProduct = 0x300c,
2604 .bInterfaceClass = USB_CLASS_VIDEO,
2605 .bInterfaceSubClass = 1,
2606 .bInterfaceProtocol = 0,
2607 .driver_info = (kernel_ulong_t)&uvc_quirk_fix_bandwidth },
2609 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2610 | USB_DEVICE_ID_MATCH_INT_INFO,
2612 .idProduct = 0x332d,
2613 .bInterfaceClass = USB_CLASS_VIDEO,
2614 .bInterfaceSubClass = 1,
2615 .bInterfaceProtocol = 0,
2616 .driver_info = (kernel_ulong_t)&uvc_quirk_fix_bandwidth },
2617 /* ViMicro - Minoru3D */
2618 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2619 | USB_DEVICE_ID_MATCH_INT_INFO,
2621 .idProduct = 0x3410,
2622 .bInterfaceClass = USB_CLASS_VIDEO,
2623 .bInterfaceSubClass = 1,
2624 .bInterfaceProtocol = 0,
2625 .driver_info = (kernel_ulong_t)&uvc_quirk_fix_bandwidth },
2626 /* ViMicro Venus - Minoru3D */
2627 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2628 | USB_DEVICE_ID_MATCH_INT_INFO,
2630 .idProduct = 0x3420,
2631 .bInterfaceClass = USB_CLASS_VIDEO,
2632 .bInterfaceSubClass = 1,
2633 .bInterfaceProtocol = 0,
2634 .driver_info = (kernel_ulong_t)&uvc_quirk_fix_bandwidth },
2635 /* Ophir Optronics - SPCAM 620U */
2636 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2637 | USB_DEVICE_ID_MATCH_INT_INFO,
2639 .idProduct = 0x0555,
2640 .bInterfaceClass = USB_CLASS_VIDEO,
2641 .bInterfaceSubClass = 1,
2642 .bInterfaceProtocol = 0,
2643 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
2645 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2646 | USB_DEVICE_ID_MATCH_INT_INFO,
2648 .idProduct = 0x0004,
2649 .bInterfaceClass = USB_CLASS_VIDEO,
2650 .bInterfaceSubClass = 1,
2651 .bInterfaceProtocol = 0,
2652 .driver_info = UVC_QUIRK_INFO(UVC_QUIRK_PROBE_MINMAX
2653 | UVC_QUIRK_PROBE_DEF) },
2654 /* IMC Networks (Medion Akoya) */
2655 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2656 | USB_DEVICE_ID_MATCH_INT_INFO,
2658 .idProduct = 0x5103,
2659 .bInterfaceClass = USB_CLASS_VIDEO,
2660 .bInterfaceSubClass = 1,
2661 .bInterfaceProtocol = 0,
2662 .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid },
2663 /* JMicron USB2.0 XGA WebCam */
2664 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2665 | USB_DEVICE_ID_MATCH_INT_INFO,
2667 .idProduct = 0x0310,
2668 .bInterfaceClass = USB_CLASS_VIDEO,
2669 .bInterfaceSubClass = 1,
2670 .bInterfaceProtocol = 0,
2671 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
2672 /* Syntek (HP Spartan) */
2673 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2674 | USB_DEVICE_ID_MATCH_INT_INFO,
2676 .idProduct = 0x5212,
2677 .bInterfaceClass = USB_CLASS_VIDEO,
2678 .bInterfaceSubClass = 1,
2679 .bInterfaceProtocol = 0,
2680 .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid },
2681 /* Syntek (Samsung Q310) */
2682 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2683 | USB_DEVICE_ID_MATCH_INT_INFO,
2685 .idProduct = 0x5931,
2686 .bInterfaceClass = USB_CLASS_VIDEO,
2687 .bInterfaceSubClass = 1,
2688 .bInterfaceProtocol = 0,
2689 .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid },
2690 /* Syntek (Packard Bell EasyNote MX52 */
2691 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2692 | USB_DEVICE_ID_MATCH_INT_INFO,
2694 .idProduct = 0x8a12,
2695 .bInterfaceClass = USB_CLASS_VIDEO,
2696 .bInterfaceSubClass = 1,
2697 .bInterfaceProtocol = 0,
2698 .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid },
2699 /* Syntek (Asus F9SG) */
2700 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2701 | USB_DEVICE_ID_MATCH_INT_INFO,
2703 .idProduct = 0x8a31,
2704 .bInterfaceClass = USB_CLASS_VIDEO,
2705 .bInterfaceSubClass = 1,
2706 .bInterfaceProtocol = 0,
2707 .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid },
2708 /* Syntek (Asus U3S) */
2709 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2710 | USB_DEVICE_ID_MATCH_INT_INFO,
2712 .idProduct = 0x8a33,
2713 .bInterfaceClass = USB_CLASS_VIDEO,
2714 .bInterfaceSubClass = 1,
2715 .bInterfaceProtocol = 0,
2716 .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid },
2717 /* Syntek (JAOtech Smart Terminal) */
2718 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2719 | USB_DEVICE_ID_MATCH_INT_INFO,
2721 .idProduct = 0x8a34,
2722 .bInterfaceClass = USB_CLASS_VIDEO,
2723 .bInterfaceSubClass = 1,
2724 .bInterfaceProtocol = 0,
2725 .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid },
2727 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2728 | USB_DEVICE_ID_MATCH_INT_INFO,
2730 .idProduct = 0x0202,
2731 .bInterfaceClass = USB_CLASS_VIDEO,
2732 .bInterfaceSubClass = 1,
2733 .bInterfaceProtocol = 0,
2734 .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid },
2735 /* Lenovo Thinkpad SL400/SL500 */
2736 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2737 | USB_DEVICE_ID_MATCH_INT_INFO,
2739 .idProduct = 0x480b,
2740 .bInterfaceClass = USB_CLASS_VIDEO,
2741 .bInterfaceSubClass = 1,
2742 .bInterfaceProtocol = 0,
2743 .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid },
2744 /* Aveo Technology USB 2.0 Camera */
2745 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2746 | USB_DEVICE_ID_MATCH_INT_INFO,
2748 .idProduct = 0x0306,
2749 .bInterfaceClass = USB_CLASS_VIDEO,
2750 .bInterfaceSubClass = 1,
2751 .bInterfaceProtocol = 0,
2752 .driver_info = UVC_QUIRK_INFO(UVC_QUIRK_PROBE_MINMAX
2753 | UVC_QUIRK_PROBE_EXTRAFIELDS) },
2754 /* Aveo Technology USB 2.0 Camera (Tasco USB Microscope) */
2755 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2756 | USB_DEVICE_ID_MATCH_INT_INFO,
2758 .idProduct = 0x0516,
2759 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
2760 .bInterfaceSubClass = 1,
2761 .bInterfaceProtocol = 0 },
2762 /* Ecamm Pico iMage */
2763 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2764 | USB_DEVICE_ID_MATCH_INT_INFO,
2766 .idProduct = 0xcafe,
2767 .bInterfaceClass = USB_CLASS_VIDEO,
2768 .bInterfaceSubClass = 1,
2769 .bInterfaceProtocol = 0,
2770 .driver_info = UVC_QUIRK_INFO(UVC_QUIRK_PROBE_EXTRAFIELDS) },
2771 /* Manta MM-353 Plako */
2772 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2773 | USB_DEVICE_ID_MATCH_INT_INFO,
2775 .idProduct = 0x3188,
2776 .bInterfaceClass = USB_CLASS_VIDEO,
2777 .bInterfaceSubClass = 1,
2778 .bInterfaceProtocol = 0,
2779 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
2780 /* FSC WebCam V30S */
2781 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2782 | USB_DEVICE_ID_MATCH_INT_INFO,
2784 .idProduct = 0x3288,
2785 .bInterfaceClass = USB_CLASS_VIDEO,
2786 .bInterfaceSubClass = 1,
2787 .bInterfaceProtocol = 0,
2788 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
2789 /* Arkmicro unbranded */
2790 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2791 | USB_DEVICE_ID_MATCH_INT_INFO,
2793 .idProduct = 0x3290,
2794 .bInterfaceClass = USB_CLASS_VIDEO,
2795 .bInterfaceSubClass = 1,
2796 .bInterfaceProtocol = 0,
2797 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_def },
2798 /* The Imaging Source USB CCD cameras */
2799 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2800 | USB_DEVICE_ID_MATCH_INT_INFO,
2802 .idProduct = 0x8102,
2803 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
2804 .bInterfaceSubClass = 1,
2805 .bInterfaceProtocol = 0 },
2806 /* Bodelin ProScopeHR */
2807 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2808 | USB_DEVICE_ID_MATCH_DEV_HI
2809 | USB_DEVICE_ID_MATCH_INT_INFO,
2811 .idProduct = 0x1000,
2812 .bcdDevice_hi = 0x0126,
2813 .bInterfaceClass = USB_CLASS_VIDEO,
2814 .bInterfaceSubClass = 1,
2815 .bInterfaceProtocol = 0,
2816 .driver_info = UVC_QUIRK_INFO(UVC_QUIRK_STATUS_INTERVAL) },
2817 /* MSI StarCam 370i */
2818 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2819 | USB_DEVICE_ID_MATCH_INT_INFO,
2821 .idProduct = 0x2951,
2822 .bInterfaceClass = USB_CLASS_VIDEO,
2823 .bInterfaceSubClass = 1,
2824 .bInterfaceProtocol = 0,
2825 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
2826 /* Generalplus Technology Inc. 808 Camera */
2827 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2828 | USB_DEVICE_ID_MATCH_INT_INFO,
2830 .idProduct = 0x2002,
2831 .bInterfaceClass = USB_CLASS_VIDEO,
2832 .bInterfaceSubClass = 1,
2833 .bInterfaceProtocol = 0,
2834 .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
2835 /* SiGma Micro USB Web Camera */
2836 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2837 | USB_DEVICE_ID_MATCH_INT_INFO,
2839 .idProduct = 0x3000,
2840 .bInterfaceClass = USB_CLASS_VIDEO,
2841 .bInterfaceSubClass = 1,
2842 .bInterfaceProtocol = 0,
2843 .driver_info = UVC_QUIRK_INFO(UVC_QUIRK_PROBE_MINMAX
2844 | UVC_QUIRK_IGNORE_SELECTOR_UNIT) },
2845 /* Oculus VR Positional Tracker DK2 */
2846 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2847 | USB_DEVICE_ID_MATCH_INT_INFO,
2849 .idProduct = 0x0201,
2850 .bInterfaceClass = USB_CLASS_VIDEO,
2851 .bInterfaceSubClass = 1,
2852 .bInterfaceProtocol = 0,
2853 .driver_info = (kernel_ulong_t)&uvc_quirk_force_y8 },
2854 /* Oculus VR Rift Sensor */
2855 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
2856 | USB_DEVICE_ID_MATCH_INT_INFO,
2858 .idProduct = 0x0211,
2859 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
2860 .bInterfaceSubClass = 1,
2861 .bInterfaceProtocol = 0,
2862 .driver_info = (kernel_ulong_t)&uvc_quirk_force_y8 },
2863 /* Generic USB Video Class */
2864 { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_UNDEFINED) },
2865 { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_15) },
2869 MODULE_DEVICE_TABLE(usb, uvc_ids);
2871 struct uvc_driver uvc_driver = {
2875 .disconnect = uvc_disconnect,
2876 .suspend = uvc_suspend,
2877 .resume = uvc_resume,
2878 .reset_resume = uvc_reset_resume,
2879 .id_table = uvc_ids,
2880 .supports_autosuspend = 1,
2884 static int __init uvc_init(void)
2890 ret = usb_register(&uvc_driver.driver);
2892 uvc_debugfs_cleanup();
2896 printk(KERN_INFO DRIVER_DESC " (" DRIVER_VERSION ")\n");
2900 static void __exit uvc_cleanup(void)
2902 usb_deregister(&uvc_driver.driver);
2903 uvc_debugfs_cleanup();
2906 module_init(uvc_init);
2907 module_exit(uvc_cleanup);
2909 MODULE_AUTHOR(DRIVER_AUTHOR);
2910 MODULE_DESCRIPTION(DRIVER_DESC);
2911 MODULE_LICENSE("GPL");
2912 MODULE_VERSION(DRIVER_VERSION);