aboutsummaryrefslogtreecommitdiffstats
path: root/usb
diff options
authorGreg Kroah-Hartman <gregkh@suse.de>2010-07-26 14:44:39 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2010-07-26 14:44:39 -0700
commit05eb87b12a0ff0b645dcf70ccc91942638f84802 (patch)
treed108e0bf3f90aae0e59dd715e31636b9fbd19aba /usb
parentba9d216e7d22ef8010eeef5deacbb37bc9e58f67 (diff)
downloadpatches-05eb87b12a0ff0b645dcf70ccc91942638f84802.tar.gz
more patches
Diffstat (limited to 'usb')
-rw-r--r--usb/usb-gadget-file_storage-serial-parameter-even-if-not-test-mode.patch104
-rw-r--r--usb/usb-imx21-hcd-set-task-state-with-schedule_timeout_uninterruptible.patch32
-rw-r--r--usb/usb-serial-enabling-support-for-segway-rmp-in-ftdi_sio.patch49
-rw-r--r--usb/usb-uvc-move-constants-and-structures-definitions-to-linux-usb-video.h.patch1044
4 files changed, 185 insertions, 1044 deletions
diff --git a/usb/usb-gadget-file_storage-serial-parameter-even-if-not-test-mode.patch b/usb/usb-gadget-file_storage-serial-parameter-even-if-not-test-mode.patch
new file mode 100644
index 00000000000000..b28f922b984297
--- /dev/null
+++ b/usb/usb-gadget-file_storage-serial-parameter-even-if-not-test-mode.patch
@@ -0,0 +1,104 @@
+From m.nazarewicz@samsung.com Mon Jul 26 14:26:35 2010
+Date: Thu, 22 Jul 2010 14:16:37 +0200
+From: Michal Nazarewicz <m.nazarewicz@samsung.com>
+Subject: USB: gadget: file_storage: serial parameter even if not test mode
+To: linux-usb@vger.kernel.org
+Cc: Kyungmin Park <kyungmin.park@samsung.com>,
+ Marek Szyprowski <m.szyprowski@samsung.com>,
+ David Brownell <david-b@pacbell.net>, Alan Stern <stern@rowland.harvard.edu>,
+ Greg KH <greg@kroah.com>, linux-kernel@vger.kernel.org,
+ Yann Cantin <yann.cantin@laposte.net>
+Message-id: <709d887b2249e9651060729eb62b29a1d3edc256.1279794290.git.m.nazarewicz@samsung.com>
+
+Moved the serial parameter handling code out of "#ifdef
+CONFIG_USB_FILE_STORAGE_TEST".
+
+This modifies Yann Cantin's commit "USB: Add a serial number
+parameter to g_file_storage" module as per Alan Stern's request.
+
+Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
+Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
+Acked-by: Alan Stern <stern@rowland.harvard.edu>
+Tested-by: Anand Gadiyar <gadiyar@ti.com>
+Cc: David Brownell <david-b@pacbell.net>
+Cc: Yann Cantin <yann.cantin@laposte.net>
+
+---
+ drivers/usb/gadget/file_storage.c | 20 +++++++++++---------
+ 1 file changed, 11 insertions(+), 9 deletions(-)
+
+--- a/drivers/usb/gadget/file_storage.c
++++ b/drivers/usb/gadget/file_storage.c
+@@ -321,7 +321,7 @@ static struct {
+ unsigned short vendor;
+ unsigned short product;
+ unsigned short release;
+- char *serial_parm;
++ char *serial;
+ unsigned int buflen;
+
+ int transport_type;
+@@ -365,6 +365,8 @@ MODULE_PARM_DESC(stall, "false to preven
+ module_param_named(cdrom, mod_data.cdrom, bool, S_IRUGO);
+ MODULE_PARM_DESC(cdrom, "true to emulate cdrom instead of disk");
+
++module_param_named(serial, mod_data.serial, charp, S_IRUGO);
++MODULE_PARM_DESC(serial, "USB serial number");
+
+ /* In the non-TEST version, only the module parameters listed above
+ * are available. */
+@@ -386,9 +388,6 @@ MODULE_PARM_DESC(product, "USB Product I
+ module_param_named(release, mod_data.release, ushort, S_IRUGO);
+ MODULE_PARM_DESC(release, "USB release number");
+
+-module_param_named(serial, mod_data.serial_parm, charp, S_IRUGO);
+-MODULE_PARM_DESC(serial, "USB serial number");
+-
+ module_param_named(buflen, mod_data.buflen, uint, S_IRUGO);
+ MODULE_PARM_DESC(buflen, "I/O buffer size");
+
+@@ -3291,10 +3290,12 @@ static int __init check_parameters(struc
+ return -ETOOSMALL;
+ }
+
++#endif /* CONFIG_USB_FILE_STORAGE_TEST */
++
+ /* Serial string handling.
+ * On a real device, the serial string would be loaded
+ * from permanent storage. */
+- if (mod_data.serial_parm) {
++ if (mod_data.serial) {
+ const char *ch;
+ unsigned len = 0;
+
+@@ -3303,7 +3304,7 @@ static int __init check_parameters(struc
+ * 12 uppercase hexadecimal characters.
+ * BBB need at least 12 uppercase hexadecimal characters,
+ * with a maximum of 126. */
+- for (ch = mod_data.serial_parm; *ch; ++ch) {
++ for (ch = mod_data.serial; *ch; ++ch) {
+ ++len;
+ if ((*ch < '0' || *ch > '9') &&
+ (*ch < 'A' || *ch > 'F')) { /* not uppercase hex */
+@@ -3322,8 +3323,11 @@ static int __init check_parameters(struc
+ "Failing back to default\n");
+ goto fill_serial;
+ }
+- fsg_strings[FSG_STRING_SERIAL - 1].s = mod_data.serial_parm;
++ fsg_strings[FSG_STRING_SERIAL - 1].s = mod_data.serial;
+ } else {
++ WARNING(fsg,
++ "Userspace failed to provide serial number; "
++ "Failing back to default\n");
+ fill_serial:
+ /* Serial number not specified or invalid, make our own.
+ * We just encode it from the driver version string,
+@@ -3339,8 +3343,6 @@ fill_serial:
+ }
+ }
+
+-#endif /* CONFIG_USB_FILE_STORAGE_TEST */
+-
+ return 0;
+ }
+
diff --git a/usb/usb-imx21-hcd-set-task-state-with-schedule_timeout_uninterruptible.patch b/usb/usb-imx21-hcd-set-task-state-with-schedule_timeout_uninterruptible.patch
new file mode 100644
index 00000000000000..3ad0b83b5c8f25
--- /dev/null
+++ b/usb/usb-imx21-hcd-set-task-state-with-schedule_timeout_uninterruptible.patch
@@ -0,0 +1,32 @@
+From linux-usb-owner@vger.kernel.org Mon Jul 26 14:22:01 2010
+From: Kulikov Vasiliy <segooon@gmail.com>
+To: kernel-janitors@vger.kernel.org
+Cc: Greg Kroah-Hartman <gregkh@suse.de>, Tejun Heo <tj@kernel.org>,
+ Martin Fuzzey <mfuzzey@gmail.com>, linux-usb@vger.kernel.org,
+ linux-kernel@vger.kernel.org
+Subject: [PATCH] usb: imx21-hcd: set task state with schedule_timeout_uninterruptible()
+Date: Mon, 26 Jul 2010 12:26:22 +0400
+Message-Id: <1280132783-8182-1-git-send-email-segooon@gmail.com>
+
+imx21_hc_reset() uses schedule_timeout() without setting state to
+STATE_(UN)INTERRUPTIBLE. As it is called in cycle without checking of
+pending signals, use schedule_timeout_uninterruptible().
+
+Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/host/imx21-hcd.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/host/imx21-hcd.c
++++ b/drivers/usb/host/imx21-hcd.c
+@@ -1521,7 +1521,7 @@ static int imx21_hc_reset(struct usb_hcd
+ return -ETIMEDOUT;
+ }
+ spin_unlock_irq(&imx21->lock);
+- schedule_timeout(1);
++ schedule_timeout_uninterruptible(1);
+ spin_lock_irq(&imx21->lock);
+ }
+ spin_unlock_irqrestore(&imx21->lock, flags);
diff --git a/usb/usb-serial-enabling-support-for-segway-rmp-in-ftdi_sio.patch b/usb/usb-serial-enabling-support-for-segway-rmp-in-ftdi_sio.patch
new file mode 100644
index 00000000000000..727e7155ecca04
--- /dev/null
+++ b/usb/usb-serial-enabling-support-for-segway-rmp-in-ftdi_sio.patch
@@ -0,0 +1,49 @@
+From jgrogers@gatech.edu Mon Jul 26 14:18:48 2010
+From: John Rogers <jgrogers@gatech.edu>
+Subject: USB: serial: enabling support for Segway RMP in ftdi_sio
+Date: Sat, 24 Jul 2010 09:50:52 -0400
+Message-Id: <9CA0AFB3-3DF4-496D-8ECC-1C60C90C861B@mail.gatech.edu>
+Cc: linux-usb@vger.kernel.org
+To: greg@kroah.com
+
+From: John G. Rogers <jgrogers@gmail.com>
+
+I have added the ProductID=0xe729 VendorID=FTDI_VID=0x0403 which will
+enable support for the Segway Robotic Mobility Platform (RMP200) in the
+ftdi_sio kernel module. Currently, users of the Segway RMP200 must use
+a RUN+="/sbin/modprobe -q ftdi-sio product=0xe729 vendor=0x0403 in a
+udev rule to get the ftdi_sio module to handle the usb interface and
+mount it on /dev/ttyXXX. This is not a good solution because some users
+will have multiple USB to Serial converters which will use the ftdi_sio
+module.
+
+Signed-off-by: John Rogers <jgrogers@gmail.com>
+Cc: stable <stable@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/ftdi_sio.c | 1 +
+ drivers/usb/serial/ftdi_sio_ids.h | 5 +++++
+ 2 files changed, 6 insertions(+)
+
+--- a/drivers/usb/serial/ftdi_sio.c
++++ b/drivers/usb/serial/ftdi_sio.c
+@@ -746,6 +746,7 @@ static struct usb_device_id id_table_com
+ .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
+ { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH4_PID),
+ .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
++ { USB_DEVICE(FTDI_VID, SEGWAY_RMP200_PID) },
+ { }, /* Optional parameter entry */
+ { } /* Terminating entry */
+ };
+--- a/drivers/usb/serial/ftdi_sio_ids.h
++++ b/drivers/usb/serial/ftdi_sio_ids.h
+@@ -1032,3 +1032,8 @@
+ #define XVERVE_SIGNALYZER_SH2_PID 0xBCA2
+ #define XVERVE_SIGNALYZER_SH4_PID 0xBCA4
+
++/*
++ * Segway Robotic Mobility Platform USB interface (using VID 0x0403)
++ * Submitted by John G. Rogers
++ */
++#define SEGWAY_RMP200_PID 0xe729
diff --git a/usb/usb-uvc-move-constants-and-structures-definitions-to-linux-usb-video.h.patch b/usb/usb-uvc-move-constants-and-structures-definitions-to-linux-usb-video.h.patch
deleted file mode 100644
index 59c6f4834cb351..00000000000000
--- a/usb/usb-uvc-move-constants-and-structures-definitions-to-linux-usb-video.h.patch
+++ /dev/null
@@ -1,1044 +0,0 @@
-From laurent.pinchart@ideasonboard.com Wed Jun 16 13:25:39 2010
-From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Date: Mon, 7 Jun 2010 13:09:47 +0200
-Subject: USB: uvc: Move constants and structures definitions to linux/usb/video.h
-To: linux-usb@vger.kernel.org
-Message-ID: <1275908987-5774-1-git-send-email-laurent.pinchart@ideasonboard.com>
-
-
-The UVC host and gadget drivers both define constants and structures in
-private header files. Move all those definitions to linux/usb/video.h
-where they can be shared by the two drivers (and be available for
-userspace applications).
-
-Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-
----
- drivers/media/video/uvc/uvcvideo.h | 19 -
- drivers/usb/gadget/f_uvc.c | 16 -
- drivers/usb/gadget/f_uvc.h | 352 --------------------------------
- drivers/usb/gadget/uvc.h | 36 ---
- drivers/usb/gadget/webcam.c | 24 +-
- include/linux/usb/video.h | 397 +++++++++++++++++++++++++++++++++++++
- 6 files changed, 418 insertions(+), 426 deletions(-)
-
---- a/drivers/media/video/uvc/uvcvideo.h
-+++ b/drivers/media/video/uvc/uvcvideo.h
-@@ -179,25 +179,6 @@ struct uvc_device;
- /* TODO: Put the most frequently accessed fields at the beginning of
- * structures to maximize cache efficiency.
- */
--struct uvc_streaming_control {
-- __u16 bmHint;
-- __u8 bFormatIndex;
-- __u8 bFrameIndex;
-- __u32 dwFrameInterval;
-- __u16 wKeyFrameRate;
-- __u16 wPFrameRate;
-- __u16 wCompQuality;
-- __u16 wCompWindowSize;
-- __u16 wDelay;
-- __u32 dwMaxVideoFrameSize;
-- __u32 dwMaxPayloadTransferSize;
-- __u32 dwClockFrequency;
-- __u8 bmFramingInfo;
-- __u8 bPreferedVersion;
-- __u8 bMinVersion;
-- __u8 bMaxVersion;
--};
--
- struct uvc_menu_info {
- __u32 value;
- __u8 name[32];
---- a/drivers/usb/gadget/f_uvc.c
-+++ b/drivers/usb/gadget/f_uvc.c
-@@ -61,12 +61,12 @@ static struct usb_gadget_strings *uvc_fu
- #define UVC_INTF_VIDEO_STREAMING 1
-
- static struct usb_interface_assoc_descriptor uvc_iad __initdata = {
-- .bLength = USB_DT_INTERFACE_ASSOCIATION_SIZE,
-+ .bLength = sizeof(uvc_iad),
- .bDescriptorType = USB_DT_INTERFACE_ASSOCIATION,
- .bFirstInterface = 0,
- .bInterfaceCount = 2,
- .bFunctionClass = USB_CLASS_VIDEO,
-- .bFunctionSubClass = 0x03,
-+ .bFunctionSubClass = UVC_SC_VIDEO_INTERFACE_COLLECTION,
- .bFunctionProtocol = 0x00,
- .iFunction = 0,
- };
-@@ -78,7 +78,7 @@ static struct usb_interface_descriptor u
- .bAlternateSetting = 0,
- .bNumEndpoints = 1,
- .bInterfaceClass = USB_CLASS_VIDEO,
-- .bInterfaceSubClass = 0x01,
-+ .bInterfaceSubClass = UVC_SC_VIDEOCONTROL,
- .bInterfaceProtocol = 0x00,
- .iInterface = 0,
- };
-@@ -106,7 +106,7 @@ static struct usb_interface_descriptor u
- .bAlternateSetting = 0,
- .bNumEndpoints = 0,
- .bInterfaceClass = USB_CLASS_VIDEO,
-- .bInterfaceSubClass = 0x02,
-+ .bInterfaceSubClass = UVC_SC_VIDEOSTREAMING,
- .bInterfaceProtocol = 0x00,
- .iInterface = 0,
- };
-@@ -118,7 +118,7 @@ static struct usb_interface_descriptor u
- .bAlternateSetting = 1,
- .bNumEndpoints = 1,
- .bInterfaceClass = USB_CLASS_VIDEO,
-- .bInterfaceSubClass = 0x02,
-+ .bInterfaceSubClass = UVC_SC_VIDEOSTREAMING,
- .bInterfaceProtocol = 0x00,
- .iInterface = 0,
- };
-@@ -603,15 +603,15 @@ uvc_bind_config(struct usb_configuration
-
- /* Validate the descriptors. */
- if (control == NULL || control[0] == NULL ||
-- control[0]->bDescriptorSubType != UVC_DT_HEADER)
-+ control[0]->bDescriptorSubType != UVC_VC_HEADER)
- goto error;
-
- if (fs_streaming == NULL || fs_streaming[0] == NULL ||
-- fs_streaming[0]->bDescriptorSubType != UVC_DT_INPUT_HEADER)
-+ fs_streaming[0]->bDescriptorSubType != UVC_VS_INPUT_HEADER)
- goto error;
-
- if (hs_streaming == NULL || hs_streaming[0] == NULL ||
-- hs_streaming[0]->bDescriptorSubType != UVC_DT_INPUT_HEADER)
-+ hs_streaming[0]->bDescriptorSubType != UVC_VS_INPUT_HEADER)
- goto error;
-
- uvc->desc.control = control;
---- a/drivers/usb/gadget/f_uvc.h
-+++ b/drivers/usb/gadget/f_uvc.h
-@@ -15,357 +15,7 @@
- #define _F_UVC_H_
-
- #include <linux/usb/composite.h>
--
--#define USB_CLASS_VIDEO_CONTROL 1
--#define USB_CLASS_VIDEO_STREAMING 2
--
--struct uvc_descriptor_header {
-- __u8 bLength;
-- __u8 bDescriptorType;
-- __u8 bDescriptorSubType;
--} __attribute__ ((packed));
--
--struct uvc_header_descriptor {
-- __u8 bLength;
-- __u8 bDescriptorType;
-- __u8 bDescriptorSubType;
-- __u16 bcdUVC;
-- __u16 wTotalLength;
-- __u32 dwClockFrequency;
-- __u8 bInCollection;
-- __u8 baInterfaceNr[];
--} __attribute__((__packed__));
--
--#define UVC_HEADER_DESCRIPTOR(n) uvc_header_descriptor_##n
--
--#define DECLARE_UVC_HEADER_DESCRIPTOR(n) \
--struct UVC_HEADER_DESCRIPTOR(n) { \
-- __u8 bLength; \
-- __u8 bDescriptorType; \
-- __u8 bDescriptorSubType; \
-- __u16 bcdUVC; \
-- __u16 wTotalLength; \
-- __u32 dwClockFrequency; \
-- __u8 bInCollection; \
-- __u8 baInterfaceNr[n]; \
--} __attribute__ ((packed))
--
--struct uvc_input_terminal_descriptor {
-- __u8 bLength;
-- __u8 bDescriptorType;
-- __u8 bDescriptorSubType;
-- __u8 bTerminalID;
-- __u16 wTerminalType;
-- __u8 bAssocTerminal;
-- __u8 iTerminal;
--} __attribute__((__packed__));
--
--struct uvc_output_terminal_descriptor {
-- __u8 bLength;
-- __u8 bDescriptorType;
-- __u8 bDescriptorSubType;
-- __u8 bTerminalID;
-- __u16 wTerminalType;
-- __u8 bAssocTerminal;
-- __u8 bSourceID;
-- __u8 iTerminal;
--} __attribute__((__packed__));
--
--struct uvc_camera_terminal_descriptor {
-- __u8 bLength;
-- __u8 bDescriptorType;
-- __u8 bDescriptorSubType;
-- __u8 bTerminalID;
-- __u16 wTerminalType;
-- __u8 bAssocTerminal;
-- __u8 iTerminal;
-- __u16 wObjectiveFocalLengthMin;
-- __u16 wObjectiveFocalLengthMax;
-- __u16 wOcularFocalLength;
-- __u8 bControlSize;
-- __u8 bmControls[3];
--} __attribute__((__packed__));
--
--struct uvc_selector_unit_descriptor {
-- __u8 bLength;
-- __u8 bDescriptorType;
-- __u8 bDescriptorSubType;
-- __u8 bUnitID;
-- __u8 bNrInPins;
-- __u8 baSourceID[0];
-- __u8 iSelector;
--} __attribute__((__packed__));
--
--#define UVC_SELECTOR_UNIT_DESCRIPTOR(n) \
-- uvc_selector_unit_descriptor_##n
--
--#define DECLARE_UVC_SELECTOR_UNIT_DESCRIPTOR(n) \
--struct UVC_SELECTOR_UNIT_DESCRIPTOR(n) { \
-- __u8 bLength; \
-- __u8 bDescriptorType; \
-- __u8 bDescriptorSubType; \
-- __u8 bUnitID; \
-- __u8 bNrInPins; \
-- __u8 baSourceID[n]; \
-- __u8 iSelector; \
--} __attribute__ ((packed))
--
--struct uvc_processing_unit_descriptor {
-- __u8 bLength;
-- __u8 bDescriptorType;
-- __u8 bDescriptorSubType;
-- __u8 bUnitID;
-- __u8 bSourceID;
-- __u16 wMaxMultiplier;
-- __u8 bControlSize;
-- __u8 bmControls[2];
-- __u8 iProcessing;
--} __attribute__((__packed__));
--
--struct uvc_extension_unit_descriptor {
-- __u8 bLength;
-- __u8 bDescriptorType;
-- __u8 bDescriptorSubType;
-- __u8 bUnitID;
-- __u8 guidExtensionCode[16];
-- __u8 bNumControls;
-- __u8 bNrInPins;
-- __u8 baSourceID[0];
-- __u8 bControlSize;
-- __u8 bmControls[0];
-- __u8 iExtension;
--} __attribute__((__packed__));
--
--#define UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \
-- uvc_extension_unit_descriptor_##p_##n
--
--#define DECLARE_UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \
--struct UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) { \
-- __u8 bLength; \
-- __u8 bDescriptorType; \
-- __u8 bDescriptorSubType; \
-- __u8 bUnitID; \
-- __u8 guidExtensionCode[16]; \
-- __u8 bNumControls; \
-- __u8 bNrInPins; \
-- __u8 baSourceID[p]; \
-- __u8 bControlSize; \
-- __u8 bmControls[n]; \
-- __u8 iExtension; \
--} __attribute__ ((packed))
--
--struct uvc_control_endpoint_descriptor {
-- __u8 bLength;
-- __u8 bDescriptorType;
-- __u8 bDescriptorSubType;
-- __u16 wMaxTransferSize;
--} __attribute__((__packed__));
--
--#define UVC_DT_HEADER 1
--#define UVC_DT_INPUT_TERMINAL 2
--#define UVC_DT_OUTPUT_TERMINAL 3
--#define UVC_DT_SELECTOR_UNIT 4
--#define UVC_DT_PROCESSING_UNIT 5
--#define UVC_DT_EXTENSION_UNIT 6
--
--#define UVC_DT_HEADER_SIZE(n) (12+(n))
--#define UVC_DT_INPUT_TERMINAL_SIZE 8
--#define UVC_DT_OUTPUT_TERMINAL_SIZE 9
--#define UVC_DT_CAMERA_TERMINAL_SIZE(n) (15+(n))
--#define UVC_DT_SELECTOR_UNIT_SIZE(n) (6+(n))
--#define UVC_DT_PROCESSING_UNIT_SIZE(n) (9+(n))
--#define UVC_DT_EXTENSION_UNIT_SIZE(p,n) (24+(p)+(n))
--#define UVC_DT_CONTROL_ENDPOINT_SIZE 5
--
--struct uvc_input_header_descriptor {
-- __u8 bLength;
-- __u8 bDescriptorType;
-- __u8 bDescriptorSubType;
-- __u8 bNumFormats;
-- __u16 wTotalLength;
-- __u8 bEndpointAddress;
-- __u8 bmInfo;
-- __u8 bTerminalLink;
-- __u8 bStillCaptureMethod;
-- __u8 bTriggerSupport;
-- __u8 bTriggerUsage;
-- __u8 bControlSize;
-- __u8 bmaControls[];
--} __attribute__((__packed__));
--
--#define UVC_INPUT_HEADER_DESCRIPTOR(n, p) \
-- uvc_input_header_descriptor_##n_##p
--
--#define DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(n, p) \
--struct UVC_INPUT_HEADER_DESCRIPTOR(n, p) { \
-- __u8 bLength; \
-- __u8 bDescriptorType; \
-- __u8 bDescriptorSubType; \
-- __u8 bNumFormats; \
-- __u16 wTotalLength; \
-- __u8 bEndpointAddress; \
-- __u8 bmInfo; \
-- __u8 bTerminalLink; \
-- __u8 bStillCaptureMethod; \
-- __u8 bTriggerSupport; \
-- __u8 bTriggerUsage; \
-- __u8 bControlSize; \
-- __u8 bmaControls[p][n]; \
--} __attribute__ ((packed))
--
--struct uvc_output_header_descriptor {
-- __u8 bLength;
-- __u8 bDescriptorType;
-- __u8 bDescriptorSubType;
-- __u8 bNumFormats;
-- __u16 wTotalLength;
-- __u8 bEndpointAddress;
-- __u8 bTerminalLink;
-- __u8 bControlSize;
-- __u8 bmaControls[];
--} __attribute__((__packed__));
--
--#define UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \
-- uvc_output_header_descriptor_##n_##p
--
--#define DECLARE_UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \
--struct UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) { \
-- __u8 bLength; \
-- __u8 bDescriptorType; \
-- __u8 bDescriptorSubType; \
-- __u8 bNumFormats; \
-- __u16 wTotalLength; \
-- __u8 bEndpointAddress; \
-- __u8 bTerminalLink; \
-- __u8 bControlSize; \
-- __u8 bmaControls[p][n]; \
--} __attribute__ ((packed))
--
--struct uvc_format_uncompressed {
-- __u8 bLength;
-- __u8 bDescriptorType;
-- __u8 bDescriptorSubType;
-- __u8 bFormatIndex;
-- __u8 bNumFrameDescriptors;
-- __u8 guidFormat[16];
-- __u8 bBitsPerPixel;
-- __u8 bDefaultFrameIndex;
-- __u8 bAspectRatioX;
-- __u8 bAspectRatioY;
-- __u8 bmInterfaceFlags;
-- __u8 bCopyProtect;
--} __attribute__((__packed__));
--
--struct uvc_frame_uncompressed {
-- __u8 bLength;
-- __u8 bDescriptorType;
-- __u8 bDescriptorSubType;
-- __u8 bFrameIndex;
-- __u8 bmCapabilities;
-- __u16 wWidth;
-- __u16 wHeight;
-- __u32 dwMinBitRate;
-- __u32 dwMaxBitRate;
-- __u32 dwMaxVideoFrameBufferSize;
-- __u32 dwDefaultFrameInterval;
-- __u8 bFrameIntervalType;
-- __u32 dwFrameInterval[];
--} __attribute__((__packed__));
--
--#define UVC_FRAME_UNCOMPRESSED(n) \
-- uvc_frame_uncompressed_##n
--
--#define DECLARE_UVC_FRAME_UNCOMPRESSED(n) \
--struct UVC_FRAME_UNCOMPRESSED(n) { \
-- __u8 bLength; \
-- __u8 bDescriptorType; \
-- __u8 bDescriptorSubType; \
-- __u8 bFrameIndex; \
-- __u8 bmCapabilities; \
-- __u16 wWidth; \
-- __u16 wHeight; \
-- __u32 dwMinBitRate; \
-- __u32 dwMaxBitRate; \
-- __u32 dwMaxVideoFrameBufferSize; \
-- __u32 dwDefaultFrameInterval; \
-- __u8 bFrameIntervalType; \
-- __u32 dwFrameInterval[n]; \
--} __attribute__ ((packed))
--
--struct uvc_format_mjpeg {
-- __u8 bLength;
-- __u8 bDescriptorType;
-- __u8 bDescriptorSubType;
-- __u8 bFormatIndex;
-- __u8 bNumFrameDescriptors;
-- __u8 bmFlags;
-- __u8 bDefaultFrameIndex;
-- __u8 bAspectRatioX;
-- __u8 bAspectRatioY;
-- __u8 bmInterfaceFlags;
-- __u8 bCopyProtect;
--} __attribute__((__packed__));
--
--struct uvc_frame_mjpeg {
-- __u8 bLength;
-- __u8 bDescriptorType;
-- __u8 bDescriptorSubType;
-- __u8 bFrameIndex;
-- __u8 bmCapabilities;
-- __u16 wWidth;
-- __u16 wHeight;
-- __u32 dwMinBitRate;
-- __u32 dwMaxBitRate;
-- __u32 dwMaxVideoFrameBufferSize;
-- __u32 dwDefaultFrameInterval;
-- __u8 bFrameIntervalType;
-- __u32 dwFrameInterval[];
--} __attribute__((__packed__));
--
--#define UVC_FRAME_MJPEG(n) \
-- uvc_frame_mjpeg_##n
--
--#define DECLARE_UVC_FRAME_MJPEG(n) \
--struct UVC_FRAME_MJPEG(n) { \
-- __u8 bLength; \
-- __u8 bDescriptorType; \
-- __u8 bDescriptorSubType; \
-- __u8 bFrameIndex; \
-- __u8 bmCapabilities; \
-- __u16 wWidth; \
-- __u16 wHeight; \
-- __u32 dwMinBitRate; \
-- __u32 dwMaxBitRate; \
-- __u32 dwMaxVideoFrameBufferSize; \
-- __u32 dwDefaultFrameInterval; \
-- __u8 bFrameIntervalType; \
-- __u32 dwFrameInterval[n]; \
--} __attribute__ ((packed))
--
--struct uvc_color_matching_descriptor {
-- __u8 bLength;
-- __u8 bDescriptorType;
-- __u8 bDescriptorSubType;
-- __u8 bColorPrimaries;
-- __u8 bTransferCharacteristics;
-- __u8 bMatrixCoefficients;
--} __attribute__((__packed__));
--
--#define UVC_DT_INPUT_HEADER 1
--#define UVC_DT_OUTPUT_HEADER 2
--#define UVC_DT_FORMAT_UNCOMPRESSED 4
--#define UVC_DT_FRAME_UNCOMPRESSED 5
--#define UVC_DT_FORMAT_MJPEG 6
--#define UVC_DT_FRAME_MJPEG 7
--#define UVC_DT_COLOR_MATCHING 13
--
--#define UVC_DT_INPUT_HEADER_SIZE(n, p) (13+(n*p))
--#define UVC_DT_OUTPUT_HEADER_SIZE(n, p) (9+(n*p))
--#define UVC_DT_FORMAT_UNCOMPRESSED_SIZE 27
--#define UVC_DT_FRAME_UNCOMPRESSED_SIZE(n) (26+4*(n))
--#define UVC_DT_FORMAT_MJPEG_SIZE 11
--#define UVC_DT_FRAME_MJPEG_SIZE(n) (26+4*(n))
--#define UVC_DT_COLOR_MATCHING_SIZE 6
-+#include <linux/usb/video.h>
-
- extern int uvc_bind_config(struct usb_configuration *c,
- const struct uvc_descriptor_header * const *control,
---- a/drivers/usb/gadget/uvc.h
-+++ b/drivers/usb/gadget/uvc.h
-@@ -48,39 +48,6 @@ struct uvc_event
- #define UVC_INTF_STREAMING 1
-
- /* ------------------------------------------------------------------------
-- * UVC constants & structures
-- */
--
--/* Values for bmHeaderInfo (Video and Still Image Payload Headers, 2.4.3.3) */
--#define UVC_STREAM_EOH (1 << 7)
--#define UVC_STREAM_ERR (1 << 6)
--#define UVC_STREAM_STI (1 << 5)
--#define UVC_STREAM_RES (1 << 4)
--#define UVC_STREAM_SCR (1 << 3)
--#define UVC_STREAM_PTS (1 << 2)
--#define UVC_STREAM_EOF (1 << 1)
--#define UVC_STREAM_FID (1 << 0)
--
--struct uvc_streaming_control {
-- __u16 bmHint;
-- __u8 bFormatIndex;
-- __u8 bFrameIndex;
-- __u32 dwFrameInterval;
-- __u16 wKeyFrameRate;
-- __u16 wPFrameRate;
-- __u16 wCompQuality;
-- __u16 wCompWindowSize;
-- __u16 wDelay;
-- __u32 dwMaxVideoFrameSize;
-- __u32 dwMaxPayloadTransferSize;
-- __u32 dwClockFrequency;
-- __u8 bmFramingInfo;
-- __u8 bPreferedVersion;
-- __u8 bMinVersion;
-- __u8 bMaxVersion;
--} __attribute__((__packed__));
--
--/* ------------------------------------------------------------------------
- * Debugging, printing and logging
- */
-
-@@ -137,9 +104,6 @@ extern unsigned int uvc_trace_param;
- #define UVC_MAX_REQUEST_SIZE 64
- #define UVC_MAX_EVENTS 4
-
--#define USB_DT_INTERFACE_ASSOCIATION_SIZE 8
--#define USB_CLASS_MISC 0xef
--
- /* ------------------------------------------------------------------------
- * Structures
- */
---- a/drivers/usb/gadget/webcam.c
-+++ b/drivers/usb/gadget/webcam.c
-@@ -90,7 +90,7 @@ DECLARE_UVC_HEADER_DESCRIPTOR(1);
- static const struct UVC_HEADER_DESCRIPTOR(1) uvc_control_header = {
- .bLength = UVC_DT_HEADER_SIZE(1),
- .bDescriptorType = USB_DT_CS_INTERFACE,
-- .bDescriptorSubType = UVC_DT_HEADER,
-+ .bDescriptorSubType = UVC_VC_HEADER,
- .bcdUVC = cpu_to_le16(0x0100),
- .wTotalLength = 0, /* dynamic */
- .dwClockFrequency = cpu_to_le32(48000000),
-@@ -101,7 +101,7 @@ static const struct UVC_HEADER_DESCRIPTO
- static const struct uvc_camera_terminal_descriptor uvc_camera_terminal = {
- .bLength = UVC_DT_CAMERA_TERMINAL_SIZE(3),
- .bDescriptorType = USB_DT_CS_INTERFACE,
-- .bDescriptorSubType = UVC_DT_INPUT_TERMINAL,
-+ .bDescriptorSubType = UVC_VC_INPUT_TERMINAL,
- .bTerminalID = 1,
- .wTerminalType = cpu_to_le16(0x0201),
- .bAssocTerminal = 0,
-@@ -118,7 +118,7 @@ static const struct uvc_camera_terminal_
- static const struct uvc_processing_unit_descriptor uvc_processing = {
- .bLength = UVC_DT_PROCESSING_UNIT_SIZE(2),
- .bDescriptorType = USB_DT_CS_INTERFACE,
-- .bDescriptorSubType = UVC_DT_PROCESSING_UNIT,
-+ .bDescriptorSubType = UVC_VC_PROCESSING_UNIT,
- .bUnitID = 2,
- .bSourceID = 1,
- .wMaxMultiplier = cpu_to_le16(16*1024),
-@@ -131,7 +131,7 @@ static const struct uvc_processing_unit_
- static const struct uvc_output_terminal_descriptor uvc_output_terminal = {
- .bLength = UVC_DT_OUTPUT_TERMINAL_SIZE,
- .bDescriptorType = USB_DT_CS_INTERFACE,
-- .bDescriptorSubType = UVC_DT_OUTPUT_TERMINAL,
-+ .bDescriptorSubType = UVC_VC_OUTPUT_TERMINAL,
- .bTerminalID = 3,
- .wTerminalType = cpu_to_le16(0x0101),
- .bAssocTerminal = 0,
-@@ -144,7 +144,7 @@ DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(1, 2
- static const struct UVC_INPUT_HEADER_DESCRIPTOR(1, 2) uvc_input_header = {
- .bLength = UVC_DT_INPUT_HEADER_SIZE(1, 2),
- .bDescriptorType = USB_DT_CS_INTERFACE,
-- .bDescriptorSubType = UVC_DT_INPUT_HEADER,
-+ .bDescriptorSubType = UVC_VS_INPUT_HEADER,
- .bNumFormats = 2,
- .wTotalLength = 0, /* dynamic */
- .bEndpointAddress = 0, /* dynamic */
-@@ -161,7 +161,7 @@ static const struct UVC_INPUT_HEADER_DES
- static const struct uvc_format_uncompressed uvc_format_yuv = {
- .bLength = UVC_DT_FORMAT_UNCOMPRESSED_SIZE,
- .bDescriptorType = USB_DT_CS_INTERFACE,
-- .bDescriptorSubType = UVC_DT_FORMAT_UNCOMPRESSED,
-+ .bDescriptorSubType = UVC_VS_FORMAT_UNCOMPRESSED,
- .bFormatIndex = 1,
- .bNumFrameDescriptors = 2,
- .guidFormat =
-@@ -181,7 +181,7 @@ DECLARE_UVC_FRAME_UNCOMPRESSED(3);
- static const struct UVC_FRAME_UNCOMPRESSED(3) uvc_frame_yuv_360p = {
- .bLength = UVC_DT_FRAME_UNCOMPRESSED_SIZE(3),
- .bDescriptorType = USB_DT_CS_INTERFACE,
-- .bDescriptorSubType = UVC_DT_FRAME_UNCOMPRESSED,
-+ .bDescriptorSubType = UVC_VS_FRAME_UNCOMPRESSED,
- .bFrameIndex = 1,
- .bmCapabilities = 0,
- .wWidth = cpu_to_le16(640),
-@@ -199,7 +199,7 @@ static const struct UVC_FRAME_UNCOMPRESS
- static const struct UVC_FRAME_UNCOMPRESSED(1) uvc_frame_yuv_720p = {
- .bLength = UVC_DT_FRAME_UNCOMPRESSED_SIZE(1),
- .bDescriptorType = USB_DT_CS_INTERFACE,
-- .bDescriptorSubType = UVC_DT_FRAME_UNCOMPRESSED,
-+ .bDescriptorSubType = UVC_VS_FRAME_UNCOMPRESSED,
- .bFrameIndex = 2,
- .bmCapabilities = 0,
- .wWidth = cpu_to_le16(1280),
-@@ -215,7 +215,7 @@ static const struct UVC_FRAME_UNCOMPRESS
- static const struct uvc_format_mjpeg uvc_format_mjpg = {
- .bLength = UVC_DT_FORMAT_MJPEG_SIZE,
- .bDescriptorType = USB_DT_CS_INTERFACE,
-- .bDescriptorSubType = UVC_DT_FORMAT_MJPEG,
-+ .bDescriptorSubType = UVC_VS_FORMAT_MJPEG,
- .bFormatIndex = 2,
- .bNumFrameDescriptors = 2,
- .bmFlags = 0,
-@@ -232,7 +232,7 @@ DECLARE_UVC_FRAME_MJPEG(3);
- static const struct UVC_FRAME_MJPEG(3) uvc_frame_mjpg_360p = {
- .bLength = UVC_DT_FRAME_MJPEG_SIZE(3),
- .bDescriptorType = USB_DT_CS_INTERFACE,
-- .bDescriptorSubType = UVC_DT_FRAME_MJPEG,
-+ .bDescriptorSubType = UVC_VS_FRAME_MJPEG,
- .bFrameIndex = 1,
- .bmCapabilities = 0,
- .wWidth = cpu_to_le16(640),
-@@ -250,7 +250,7 @@ static const struct UVC_FRAME_MJPEG(3) u
- static const struct UVC_FRAME_MJPEG(1) uvc_frame_mjpg_720p = {
- .bLength = UVC_DT_FRAME_MJPEG_SIZE(1),
- .bDescriptorType = USB_DT_CS_INTERFACE,
-- .bDescriptorSubType = UVC_DT_FRAME_MJPEG,
-+ .bDescriptorSubType = UVC_VS_FRAME_MJPEG,
- .bFrameIndex = 2,
- .bmCapabilities = 0,
- .wWidth = cpu_to_le16(1280),
-@@ -266,7 +266,7 @@ static const struct UVC_FRAME_MJPEG(1) u
- static const struct uvc_color_matching_descriptor uvc_color_matching = {
- .bLength = UVC_DT_COLOR_MATCHING_SIZE,
- .bDescriptorType = USB_DT_CS_INTERFACE,
-- .bDescriptorSubType = UVC_DT_COLOR_MATCHING,
-+ .bDescriptorSubType = UVC_VS_COLORFORMAT,
- .bColorPrimaries = 1,
- .bTransferCharacteristics = 1,
- .bMatrixCoefficients = 4,
---- a/include/linux/usb/video.h
-+++ b/include/linux/usb/video.h
-@@ -160,5 +160,402 @@
- #define UVC_STATUS_TYPE_CONTROL 1
- #define UVC_STATUS_TYPE_STREAMING 2
-
-+/* 2.4.3.3. Payload Header Information */
-+#define UVC_STREAM_EOH (1 << 7)
-+#define UVC_STREAM_ERR (1 << 6)
-+#define UVC_STREAM_STI (1 << 5)
-+#define UVC_STREAM_RES (1 << 4)
-+#define UVC_STREAM_SCR (1 << 3)
-+#define UVC_STREAM_PTS (1 << 2)
-+#define UVC_STREAM_EOF (1 << 1)
-+#define UVC_STREAM_FID (1 << 0)
-+
-+/* ------------------------------------------------------------------------
-+ * UVC structures
-+ */
-+
-+/* All UVC descriptors have these 3 fields at the beginning */
-+struct uvc_descriptor_header {
-+ __u8 bLength;
-+ __u8 bDescriptorType;
-+ __u8 bDescriptorSubType;
-+} __attribute__((packed));
-+
-+/* 3.7.2. Video Control Interface Header Descriptor */
-+struct uvc_header_descriptor {
-+ __u8 bLength;
-+ __u8 bDescriptorType;
-+ __u8 bDescriptorSubType;
-+ __u16 bcdUVC;
-+ __u16 wTotalLength;
-+ __u32 dwClockFrequency;
-+ __u8 bInCollection;
-+ __u8 baInterfaceNr[];
-+} __attribute__((__packed__));
-+
-+#define UVC_DT_HEADER_SIZE(n) (12+(n))
-+
-+#define UVC_HEADER_DESCRIPTOR(n) \
-+ uvc_header_descriptor_##n
-+
-+#define DECLARE_UVC_HEADER_DESCRIPTOR(n) \
-+struct UVC_HEADER_DESCRIPTOR(n) { \
-+ __u8 bLength; \
-+ __u8 bDescriptorType; \
-+ __u8 bDescriptorSubType; \
-+ __u16 bcdUVC; \
-+ __u16 wTotalLength; \
-+ __u32 dwClockFrequency; \
-+ __u8 bInCollection; \
-+ __u8 baInterfaceNr[n]; \
-+} __attribute__ ((packed))
-+
-+/* 3.7.2.1. Input Terminal Descriptor */
-+struct uvc_input_terminal_descriptor {
-+ __u8 bLength;
-+ __u8 bDescriptorType;
-+ __u8 bDescriptorSubType;
-+ __u8 bTerminalID;
-+ __u16 wTerminalType;
-+ __u8 bAssocTerminal;
-+ __u8 iTerminal;
-+} __attribute__((__packed__));
-+
-+#define UVC_DT_INPUT_TERMINAL_SIZE 8
-+
-+/* 3.7.2.2. Output Terminal Descriptor */
-+struct uvc_output_terminal_descriptor {
-+ __u8 bLength;
-+ __u8 bDescriptorType;
-+ __u8 bDescriptorSubType;
-+ __u8 bTerminalID;
-+ __u16 wTerminalType;
-+ __u8 bAssocTerminal;
-+ __u8 bSourceID;
-+ __u8 iTerminal;
-+} __attribute__((__packed__));
-+
-+#define UVC_DT_OUTPUT_TERMINAL_SIZE 9
-+
-+/* 3.7.2.3. Camera Terminal Descriptor */
-+struct uvc_camera_terminal_descriptor {
-+ __u8 bLength;
-+ __u8 bDescriptorType;
-+ __u8 bDescriptorSubType;
-+ __u8 bTerminalID;
-+ __u16 wTerminalType;
-+ __u8 bAssocTerminal;
-+ __u8 iTerminal;
-+ __u16 wObjectiveFocalLengthMin;
-+ __u16 wObjectiveFocalLengthMax;
-+ __u16 wOcularFocalLength;
-+ __u8 bControlSize;
-+ __u8 bmControls[3];
-+} __attribute__((__packed__));
-+
-+#define UVC_DT_CAMERA_TERMINAL_SIZE(n) (15+(n))
-+
-+/* 3.7.2.4. Selector Unit Descriptor */
-+struct uvc_selector_unit_descriptor {
-+ __u8 bLength;
-+ __u8 bDescriptorType;
-+ __u8 bDescriptorSubType;
-+ __u8 bUnitID;
-+ __u8 bNrInPins;
-+ __u8 baSourceID[0];
-+ __u8 iSelector;
-+} __attribute__((__packed__));
-+
-+#define UVC_DT_SELECTOR_UNIT_SIZE(n) (6+(n))
-+
-+#define UVC_SELECTOR_UNIT_DESCRIPTOR(n) \
-+ uvc_selector_unit_descriptor_##n
-+
-+#define DECLARE_UVC_SELECTOR_UNIT_DESCRIPTOR(n) \
-+struct UVC_SELECTOR_UNIT_DESCRIPTOR(n) { \
-+ __u8 bLength; \
-+ __u8 bDescriptorType; \
-+ __u8 bDescriptorSubType; \
-+ __u8 bUnitID; \
-+ __u8 bNrInPins; \
-+ __u8 baSourceID[n]; \
-+ __u8 iSelector; \
-+} __attribute__ ((packed))
-+
-+/* 3.7.2.5. Processing Unit Descriptor */
-+struct uvc_processing_unit_descriptor {
-+ __u8 bLength;
-+ __u8 bDescriptorType;
-+ __u8 bDescriptorSubType;
-+ __u8 bUnitID;
-+ __u8 bSourceID;
-+ __u16 wMaxMultiplier;
-+ __u8 bControlSize;
-+ __u8 bmControls[2];
-+ __u8 iProcessing;
-+} __attribute__((__packed__));
-+
-+#define UVC_DT_PROCESSING_UNIT_SIZE(n) (9+(n))
-+
-+/* 3.7.2.6. Extension Unit Descriptor */
-+struct uvc_extension_unit_descriptor {
-+ __u8 bLength;
-+ __u8 bDescriptorType;
-+ __u8 bDescriptorSubType;
-+ __u8 bUnitID;
-+ __u8 guidExtensionCode[16];
-+ __u8 bNumControls;
-+ __u8 bNrInPins;
-+ __u8 baSourceID[0];
-+ __u8 bControlSize;
-+ __u8 bmControls[0];
-+ __u8 iExtension;
-+} __attribute__((__packed__));
-+
-+#define UVC_DT_EXTENSION_UNIT_SIZE(p, n) (24+(p)+(n))
-+
-+#define UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \
-+ uvc_extension_unit_descriptor_##p_##n
-+
-+#define DECLARE_UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \
-+struct UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) { \
-+ __u8 bLength; \
-+ __u8 bDescriptorType; \
-+ __u8 bDescriptorSubType; \
-+ __u8 bUnitID; \
-+ __u8 guidExtensionCode[16]; \
-+ __u8 bNumControls; \
-+ __u8 bNrInPins; \
-+ __u8 baSourceID[p]; \
-+ __u8 bControlSize; \
-+ __u8 bmControls[n]; \
-+ __u8 iExtension; \
-+} __attribute__ ((packed))
-+
-+/* 3.8.2.2. Video Control Interrupt Endpoint Descriptor */
-+struct uvc_control_endpoint_descriptor {
-+ __u8 bLength;
-+ __u8 bDescriptorType;
-+ __u8 bDescriptorSubType;
-+ __u16 wMaxTransferSize;
-+} __attribute__((__packed__));
-+
-+#define UVC_DT_CONTROL_ENDPOINT_SIZE 5
-+
-+/* 3.9.2.1. Input Header Descriptor */
-+struct uvc_input_header_descriptor {
-+ __u8 bLength;
-+ __u8 bDescriptorType;
-+ __u8 bDescriptorSubType;
-+ __u8 bNumFormats;
-+ __u16 wTotalLength;
-+ __u8 bEndpointAddress;
-+ __u8 bmInfo;
-+ __u8 bTerminalLink;
-+ __u8 bStillCaptureMethod;
-+ __u8 bTriggerSupport;
-+ __u8 bTriggerUsage;
-+ __u8 bControlSize;
-+ __u8 bmaControls[];
-+} __attribute__((__packed__));
-+
-+#define UVC_DT_INPUT_HEADER_SIZE(n, p) (13+(n*p))
-+
-+#define UVC_INPUT_HEADER_DESCRIPTOR(n, p) \
-+ uvc_input_header_descriptor_##n_##p
-+
-+#define DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(n, p) \
-+struct UVC_INPUT_HEADER_DESCRIPTOR(n, p) { \
-+ __u8 bLength; \
-+ __u8 bDescriptorType; \
-+ __u8 bDescriptorSubType; \
-+ __u8 bNumFormats; \
-+ __u16 wTotalLength; \
-+ __u8 bEndpointAddress; \
-+ __u8 bmInfo; \
-+ __u8 bTerminalLink; \
-+ __u8 bStillCaptureMethod; \
-+ __u8 bTriggerSupport; \
-+ __u8 bTriggerUsage; \
-+ __u8 bControlSize; \
-+ __u8 bmaControls[p][n]; \
-+} __attribute__ ((packed))
-+
-+/* 3.9.2.2. Output Header Descriptor */
-+struct uvc_output_header_descriptor {
-+ __u8 bLength;
-+ __u8 bDescriptorType;
-+ __u8 bDescriptorSubType;
-+ __u8 bNumFormats;
-+ __u16 wTotalLength;
-+ __u8 bEndpointAddress;
-+ __u8 bTerminalLink;
-+ __u8 bControlSize;
-+ __u8 bmaControls[];
-+} __attribute__((__packed__));
-+
-+#define UVC_DT_OUTPUT_HEADER_SIZE(n, p) (9+(n*p))
-+
-+#define UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \
-+ uvc_output_header_descriptor_##n_##p
-+
-+#define DECLARE_UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \
-+struct UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) { \
-+ __u8 bLength; \
-+ __u8 bDescriptorType; \
-+ __u8 bDescriptorSubType; \
-+ __u8 bNumFormats; \
-+ __u16 wTotalLength; \
-+ __u8 bEndpointAddress; \
-+ __u8 bTerminalLink; \
-+ __u8 bControlSize; \
-+ __u8 bmaControls[p][n]; \
-+} __attribute__ ((packed))
-+
-+/* 3.9.2.6. Color matching descriptor */
-+struct uvc_color_matching_descriptor {
-+ __u8 bLength;
-+ __u8 bDescriptorType;
-+ __u8 bDescriptorSubType;
-+ __u8 bColorPrimaries;
-+ __u8 bTransferCharacteristics;
-+ __u8 bMatrixCoefficients;
-+} __attribute__((__packed__));
-+
-+#define UVC_DT_COLOR_MATCHING_SIZE 6
-+
-+/* 4.3.1.1. Video Probe and Commit Controls */
-+struct uvc_streaming_control {
-+ __u16 bmHint;
-+ __u8 bFormatIndex;
-+ __u8 bFrameIndex;
-+ __u32 dwFrameInterval;
-+ __u16 wKeyFrameRate;
-+ __u16 wPFrameRate;
-+ __u16 wCompQuality;
-+ __u16 wCompWindowSize;
-+ __u16 wDelay;
-+ __u32 dwMaxVideoFrameSize;
-+ __u32 dwMaxPayloadTransferSize;
-+ __u32 dwClockFrequency;
-+ __u8 bmFramingInfo;
-+ __u8 bPreferedVersion;
-+ __u8 bMinVersion;
-+ __u8 bMaxVersion;
-+} __attribute__((__packed__));
-+
-+/* Uncompressed Payload - 3.1.1. Uncompressed Video Format Descriptor */
-+struct uvc_format_uncompressed {
-+ __u8 bLength;
-+ __u8 bDescriptorType;
-+ __u8 bDescriptorSubType;
-+ __u8 bFormatIndex;
-+ __u8 bNumFrameDescriptors;
-+ __u8 guidFormat[16];
-+ __u8 bBitsPerPixel;
-+ __u8 bDefaultFrameIndex;
-+ __u8 bAspectRatioX;
-+ __u8 bAspectRatioY;
-+ __u8 bmInterfaceFlags;
-+ __u8 bCopyProtect;
-+} __attribute__((__packed__));
-+
-+#define UVC_DT_FORMAT_UNCOMPRESSED_SIZE 27
-+
-+/* Uncompressed Payload - 3.1.2. Uncompressed Video Frame Descriptor */
-+struct uvc_frame_uncompressed {
-+ __u8 bLength;
-+ __u8 bDescriptorType;
-+ __u8 bDescriptorSubType;
-+ __u8 bFrameIndex;
-+ __u8 bmCapabilities;
-+ __u16 wWidth;
-+ __u16 wHeight;
-+ __u32 dwMinBitRate;
-+ __u32 dwMaxBitRate;
-+ __u32 dwMaxVideoFrameBufferSize;
-+ __u32 dwDefaultFrameInterval;
-+ __u8 bFrameIntervalType;
-+ __u32 dwFrameInterval[];
-+} __attribute__((__packed__));
-+
-+#define UVC_DT_FRAME_UNCOMPRESSED_SIZE(n) (26+4*(n))
-+
-+#define UVC_FRAME_UNCOMPRESSED(n) \
-+ uvc_frame_uncompressed_##n
-+
-+#define DECLARE_UVC_FRAME_UNCOMPRESSED(n) \
-+struct UVC_FRAME_UNCOMPRESSED(n) { \
-+ __u8 bLength; \
-+ __u8 bDescriptorType; \
-+ __u8 bDescriptorSubType; \
-+ __u8 bFrameIndex; \
-+ __u8 bmCapabilities; \
-+ __u16 wWidth; \
-+ __u16 wHeight; \
-+ __u32 dwMinBitRate; \
-+ __u32 dwMaxBitRate; \
-+ __u32 dwMaxVideoFrameBufferSize; \
-+ __u32 dwDefaultFrameInterval; \
-+ __u8 bFrameIntervalType; \
-+ __u32 dwFrameInterval[n]; \
-+} __attribute__ ((packed))
-+
-+/* MJPEG Payload - 3.1.1. MJPEG Video Format Descriptor */
-+struct uvc_format_mjpeg {
-+ __u8 bLength;
-+ __u8 bDescriptorType;
-+ __u8 bDescriptorSubType;
-+ __u8 bFormatIndex;
-+ __u8 bNumFrameDescriptors;
-+ __u8 bmFlags;
-+ __u8 bDefaultFrameIndex;
-+ __u8 bAspectRatioX;
-+ __u8 bAspectRatioY;
-+ __u8 bmInterfaceFlags;
-+ __u8 bCopyProtect;
-+} __attribute__((__packed__));
-+
-+#define UVC_DT_FORMAT_MJPEG_SIZE 11
-+
-+/* MJPEG Payload - 3.1.2. MJPEG Video Frame Descriptor */
-+struct uvc_frame_mjpeg {
-+ __u8 bLength;
-+ __u8 bDescriptorType;
-+ __u8 bDescriptorSubType;
-+ __u8 bFrameIndex;
-+ __u8 bmCapabilities;
-+ __u16 wWidth;
-+ __u16 wHeight;
-+ __u32 dwMinBitRate;
-+ __u32 dwMaxBitRate;
-+ __u32 dwMaxVideoFrameBufferSize;
-+ __u32 dwDefaultFrameInterval;
-+ __u8 bFrameIntervalType;
-+ __u32 dwFrameInterval[];
-+} __attribute__((__packed__));
-+
-+#define UVC_DT_FRAME_MJPEG_SIZE(n) (26+4*(n))
-+
-+#define UVC_FRAME_MJPEG(n) \
-+ uvc_frame_mjpeg_##n
-+
-+#define DECLARE_UVC_FRAME_MJPEG(n) \
-+struct UVC_FRAME_MJPEG(n) { \
-+ __u8 bLength; \
-+ __u8 bDescriptorType; \
-+ __u8 bDescriptorSubType; \
-+ __u8 bFrameIndex; \
-+ __u8 bmCapabilities; \
-+ __u16 wWidth; \
-+ __u16 wHeight; \
-+ __u32 dwMinBitRate; \
-+ __u32 dwMaxBitRate; \
-+ __u32 dwMaxVideoFrameBufferSize; \
-+ __u32 dwDefaultFrameInterval; \
-+ __u8 bFrameIntervalType; \
-+ __u32 dwFrameInterval[n]; \
-+} __attribute__ ((packed))
-+
- #endif /* __LINUX_USB_VIDEO_H */
-