USB Video Class Support This patch holds USB constants and structures defined by the USB Device Class Definition for Video Devices. Signed-off-by: Ragner N Magalhaes <[EMAIL PROTECTED]> ---
Index: 2.6-dev/include/linux/usb/video.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ 2.6-dev/include/linux/usb/video.h 2007-03-20 14:17:56.000000000 -0400 @@ -0,0 +1,423 @@ +/* + * <linux/usb/video.h> -- USB Video definitions. + * + * Copyright (C) 2007 Instituto Nokia de Tecnologia - INdT + * Developed for INdT by Ragner N Magalhaes + * Ragner N Magalhaes <[EMAIL PROTECTED]> + * + * This software is distributed under the terms of the GNU General Public + * License ("GPL") version 2, as published by the Free Software Foundation. + * + * This file holds USB constants and structures defined + * by the USB Device Class Definition for Video Devices. + * Comments below reference relevant sections of that document: + * + * http://www.usb.org/developers/devclass_docs/USB_Video_Class_1_1.zip + */ + +#ifndef __LINUX_USB_VIDEO_H +#define __LINUX_USB_VIDEO_H + +#include <linux/types.h> + +/* Video Interface Subclass Codes */ +#define USB_SC_VIDEOCONTROL 0x01 +#define USB_SC_VIDEOSTREAMING 0x02 +#define USB_SC_INTERFACE_COLLECTION 0x03 + +/* Video Interface Protocol Codes */ +#define USB_PROTOCOL_UNDEFINED 0x00 + +/* Video Class-Specific VC Interface Descriptor Subtypes */ +#define USB_VC_HEADER 0x01 +#define USB_VC_INPUT_TERMINAL 0x02 +#define USB_VC_OUTPUT_TERMINAL 0x03 +#define USB_VC_SELECTOR_UNIT 0x04 +#define USB_VC_PROCESSING_UNIT 0x05 +#define USB_VC_EXTERNSION_UNIT 0x06 + +/* Video Class-Specific VS Interface Descriptor Subtype */ +#define USB_VS_INPUT_HEADER 0x01 +#define USB_VS_OUTPUT_HEADER 0x02 +#define USB_VS_STILL_IMAGE_FRAME 0x03 +#define USB_VS_FORMAT_UNCOMPRESSED 0x04 +#define USB_VS_FRAME_UNCOMPRESSED 0x05 +#define USB_VS_FORMAT_MJPEG 0x06 +#define USB_VS_FRAME_MJPEG 0x07 +/* Reserved 0x08 */ +/* Reserved 0x09 */ +#define USB_VS_FORMAT_MPEG2TS 0x0a +/* Reserved 0x0B */ +#define USB_VS_FORMAT_DV 0x0c +#define USB_VS_COLORFORMAT 0x0d +/* Reserved 0x0e */ +/* Reserved 0x0f */ +#define USB_VS_FORMAT_FRAME_BASED 0x10 +#define USB_VS_FRAME_FRAME_BASED 0x11 +#define USB_VS_FORMAT_STREAM_BASED 0x12 + +/* Video Class-Specific Endpoint Descriptor Subtype */ +#define USB_EP_GENERAL 0x01 +#define USB_EP_ENDPOINT 0x02 +#define USB_EP_INTERRUPT 0x03 + +/* Video Class-Specific Request Codes */ +#define USB_REQ_SET_CUR 0x01 +#define USB_REQ_GET_CUR 0x81 +#define USB_REQ_GET_MIN 0x82 +#define USB_REQ_GET_MAX 0x83 +#define USB_REQ_GET_RES 0x84 +#define USB_REQ_GET_LEN 0x85 +#define USB_REQ_GET_INFO 0x86 +#define USB_REQ_GET_DEF 0x87 + +/* VideoControl Interface Control Selectors */ +#define USB_VC_VID_POWER_MOD_CONTROL 0x01 +#define USB_VC_REQ_ERROR_CODE_CONTROL 0x02 +/* Reserved 0x03 */ + +/* Selector Unit Control Selectors */ +#define USB_INPUT_SELECT_CONTROL 0x01 + +/* Camera Terminal Controls Selectors */ +#define USB_CT_SCANNING_MOD_CONTROL 0x01 +#define USB_CT_AE_MOD_CONTROL 0x02 +#define USB_CT_AE_PRIORITY_CONTROL 0x03 +#define USB_CT_EXPO_TIME_ABS_CONTROL 0x04 +#define USB_CT_EXPO_TIME_REL_CONTROL 0x05 +#define USB_CT_FOCUS_ABS_CONTROL 0x06 +#define USB_CT_FOCUS_REL_CONTROL 0x07 +#define USB_CT_IRIS_ABS_CONTROL 0x08 +#define USB_CT_IRIS_REL_CONTROL 0x0a +#define USB_CT_ZOOM_ABS_CONTROL 0x0b +#define USB_CT_ZOOM_REL_CONTROL 0x0c +#define USB_CT_PANTILT_ABS_CONTROL 0x0d +#define USB_CT_PANTILT_REL_CONTROL 0x0e +#define USB_CT_ROLL_ABS_CONTROL 0x0f +#define USB_CT_ROLL_REL_CONTROL 0x10 +#define USB_CT_PRIVACY_CONTROL 0x11 + +/* Processing Unit Control Selectors */ +#define USB_PU_BL_CMPENSATION_CONTROL 0x01 +#define USB_PU_BRIGHTNESS_CONTROL 0x02 +#define USB_PU_CONTRAST_CONTROL 0x03 +#define USB_PU_GAIN_CONTROL 0x04 +#define USB_PU_POWER_LINE_FREQ_CONTROL 0x05 +#define USB_PU_HUE_CONTROL 0x06 +#define USB_PU_SATURATION_CONTROL 0x07 +#define USB_PU_SHARPNESS_CONTROL 0x08 +#define USB_PU_GAMMA_CONTROL 0x09 +#define USB_PU_WT_BL_TMP_CONTROL 0x0a +#define USB_PU_WT_BL_TMP_AUT_CONTROL 0x0b +#define USB_PU_WT_BL_CMP_CONTROL 0x0c +#define USB_PU_WT_BL_CMP_AUT_CONTROL 0x0d +#define USB_PU_DIG_MULT_CONTROL 0x0e +#define USB_PU_DIG_MULT_LIM_CONTROL 0x0f +#define USB_PU_HUE_AUTO_CONTROL 0x10 +#define USB_PU_ANALOG_V_STAND_CONTROL 0x11 +#define USB_PU_ANALOG_LCK_STAT_CONTROL 0x12 + +/* VideoStream Interface Control Selectors */ +#define USB_VS_PROBE_CONTROL 0x01 +#define USB_VS_COMMIT_CONTROL 0x02 +#define USB_VS_STILL_PROBE_CONTROL 0x03 +#define USB_VS_STILL_COMMIT_CONTROL 0x04 +#define USB_VS_STILL_IMG_TRIGG_CONTROL 0x05 +#define USB_VS_STRM_ERR_CONDE_CONTROL 0x06 +#define USB_VS_GEN_KEY_FRAME_CONTROL 0x07 +#define USB_VS_UPDT_FRAME_SEG_CONTROL 0x08 +#define USB_VS_SYNCH_DELAY_CONTROL 0x09 + +/* USB Terminal Types */ +#define USB_TT_VENDOR_SPECIFIC 0x0100 +#define USB_TT_STREAMING 0x0101 + +/* Input Terminal Types */ +#define USB_ITT_VENDOR_SPECIFIC 0x0200 +#define USB_ITT_CAMERA 0x0201 +#define SUB_ITT_MEDIA_TRANSP_INPUT 0x0202 + +/* Output Terminal Types */ +#define USB_OTT_VENDOR_SPECIFIC 0x0300 +#define USB_OTT_DISPLAY 0x0301 +#define USB_OTT_MEDIA_TRANSP_OUTPUT 0x0302 + +/* External Terminal Types */ +#define USB_EXTERNAL_VENDOR_SPECIFIC 0x0400 +#define USB_COMPOSITE_CONNECTOR 0x0401 +#define USB_SVIDEO_CONNECTOR 0x0402 +#define USB_COMPONENT_CONNECTOR 0x0403 + +/* Class-specific VC Interface Header Descriptor */ +struct usb_vc_header_descriptor { + __u8 bLength; /* 12+n bytes */ + __u8 bDescriptorType; /* CS_INTERFACE */ + + __u8 bDescriptorSubtype; /* VC_HEADER */ + __le16 bcdUVC; + __le16 wTotalLength; + __le32 dwClockFrequency; + __u8 bInCollection; /* n */ + __u8 baInterfaceNr[]; /* [n] */ +} __attribute__ ((packed)); + +#define USB_VC_HEADER_SIZE(n) (12+(n)) + +/* As above, but more useful for defining your own descriptors: */ +#define DECLARE_USB_VC_HEADER_DESCRIPTOR(n) \ +struct usb_vc_header_descriptor_##n { \ + __u8 bLength; \ + __u8 bDescriptorType; \ + __u8 bDescriptorSubtype; \ + __le16 bcdUVC; \ + __le16 wTotalLength; \ + __le32 dwClockFrequency; \ + __u8 bInCollection; \ + __u8 baInterfaceNr[n]; \ +} __attribute__ ((packed)) + +#endif + +/* Input Terminal Descriptor */ +struct usb_input_terminal_descriptor { + __u8 bLength; /* 8 bytes */ + __u8 bDescriptorType; /* CS_INTERFACE */ + + __u8 bDescriptorSubtype; /* VC_INPUT_TERMINAL */ + __u8 bTerminalID; + __le16 wTerminalType; + __u8 bAssocTerminal; + __u8 iTerminal; + +/* Depending on the Terminal Type, certain Input Terminal descriptors have + * additional fields. The descriptors for these special Terminal types are + * described in separate sections specific to those Terminals, and in + * accompanying documents. + */ +} __attribute__ ((packed)); + +#define USB_INPUT_TERMINAL_SIZE 8 + +/* Output Terminal Descriptor */ +struct usb_output_terminal_descriptor { + __u8 bLength; /* 9 bytes */ + __u8 bDescriptorType; /* CS_INTERFACE */ + + __u8 bDescriptorSubtype; /* VC_OUTPUT_TERMINAL */ + __u8 bTerminalID; + __le16 wTerminalType; + __u8 bAssocTerminal; + __u8 bSourceID; + __u8 iTerminal; + +/* Depending on the Terminal Type, certain Output Terminal descriptors have + * additional fields. The descriptors for these special Terminal types are + * described in separate sections specific to those Terminals, and in + * accompanying documents. + */ +} __attribute__ ((packed)); + +#define USB_OUTPUT_TERMINAL_SIZE 9 + +/* Camera Terminal Descriptor */ +struct usb_cam_terminal_descriptor { + __u8 bLength; /* 15+n bytes */ + __u8 bDescriptorType; /* CS_INTERFACE */ + + __u8 bDescriptorSubType; /* VC_INPUT_TERMINAL */ + __u8 bTerminalID; + __le16 wTerminalType; /* ITT_CAMERA */ + __u8 bAssocTerminal; + __u8 iTerminal; + __le16 wObjectFocalLengthMin; + __le16 wObjectFocalLengthMax; + __le16 wOcularFocalLength; + __u8 bControlSize; /* n */ + __u8 bmControls[]; /* [n] */ +} __attribute__ ((packed)); + +#define USB_CAM_TERMINAL_SIZE(n) (15+(n)) + +/* As above, but more useful for defining your own descriptors: */ +#define DECLARE_USB_CAM_TERMINAL_DESCRIPTOR(n) \ +struct usb_cam_terminal_descriptor_##n { \ + __u8 bLength; \ + __u8 bDescriptorType; \ + __u8 bDescriptorSubType; \ + __u8 bTerminalID; \ + __le16 wTerminalType; \ + __u8 bAssocTerminal; \ + __u8 iTerminal; \ + __le16 wObjectFocalLengthMin; \ + __le16 wObjectFocalLengthMax; \ + __le16 wOcularFocalLength; \ + __u8 bControlSize; \ + __u8 bmControls[n]; \ +} __attribute__ ((packed)) + +/* Selector Unit Descriptor */ +#define USB_SELECTOR_UNIT_SIZE(p) (6+(p)) + +#define DECLARE_USB_SELECTOR_UNIT_DESCRIPTOR(p) \ +struct usb_selector_unit_descriptor_##p { \ + __u8 bLength; /* 6+p bytes */ \ + __u8 bDescriptorType; /* CS_INTERFACE */ \ + \ + __u8 bDescriptorSubType; /* VC_SELECTOR_UNIT */ \ + __u8 bUnitID; \ + __u8 bNrInPins; /* p */ \ + __u8 baSourceID[p]; \ + __u8 iSelector; \ +} __attribute__ ((packed)) + +/* Processing Unit Descriptor */ +#define USB_PROCESSING_UNIT_SIZE(n) (10+(n)) + +#define DECLARE_USB_PROCESSING_UNIT_DESCRIPTOR(n) \ +struct usb_processing_unit_descriptor_##n { \ + __u8 bLength; /* 10+n bytes */ \ + __u8 bDescriptorType; /* CS_INTERFACE */ \ + \ + __u8 bDescriptorSubType; /* VC_PROCESSING_UNIT */\ + __u8 bUnitID; \ + __u8 bSourceID; \ + __le16 wMaxMultiplier; \ + __u8 bControlSize; /* n */ \ + __u8 bmControls[n]; \ + __u8 iProcessing; \ + __u8 bmVideoStandards; \ +} __attribute__ ((packed)) + +/* Extension Unit Descriptor */ +#define USB_EXTENSION_UNIT_SIZE(p,n) (24+(p)+(n)) + +#define DECLARE_USB_EXTENSION_UNIT_DESCRIPTOR(p,n) \ +struct usb_extension_unit_desciptor_##p_##n { \ + __u8 bLength; /* 24+p+n bytes */ \ + __u8 bDescriptorType; /* CS_INTERFACE */ \ + \ + __u8 bDescriptorSubType; /* VC_EXTENSION_UNIT */ \ + __u8 bUnitID; \ + __u8 guidExtensionCode[16]; \ + __u8 bNumControls; \ + __u8 bNrInPins; /* p */ \ + __u8 baSouceID[p]; \ + __u8 bControlSize; /* n */ \ + __u8 bmControls[n]; \ + __u8 iExtension; \ +} __attribute__ ((packed)) + +/* Class-specific VC Interrupt Endpoint Descriptor */ +struct usb_vc_interrupt_endpoint_descriptor { + __u8 bLength; /* 5 bytes */ + __u8 bDescriptorType; /* CS_ENDPOINT */ + + __u8 bDescriptorSubType; /* EP_INTERRUPT */ + __le16 wMaxTransferSize; +} __attribute__ ((packed)); + +#define USB_VC_INTERRUPT_ENDPOINT_SIZE 5 + +/* Class-specific VS Interface Input Header Descriptor */ +struct usb_vs_input_header_descriptor { + __u8 bLength; /* 13+(p*n) bytes */ + __u8 bDescriptorType; /* CS_INTERFACE */ + + __u8 bDescriptorSubType; /* VS_INPUT_HEADER */ + __u8 bNumFormats; /* p */ + __le16 wTotalLength; + __u8 bEndpointAddress; + __u8 bmInfo; + __u8 bTerminalLink; + __u8 bStillCaptureMethod; + __u8 bTriggerSupport; + __u8 bTriggerUsage; + __u8 bControlSize; /* n */ + __u8 bmaControls[]; /* [p][n] */ +} __attribute__ ((packed)); + +#define USB_VS_INPUT_HEADER_SIZE(p,n) (13+((p)*(n))) + +/* As above, but more useful for defining your own descriptors: */ +#define DECLARE_USB_VS_INPUT_HEADER_DESCRIPTOR(p,n) \ +struct usb_vs_input_header_descriptor_##px##n { \ + __u8 bLength; /* 13+(p*n) bytes */ \ + __u8 bDescriptorType; /* CS_INTERFACE */ \ + \ + __u8 bDescriptorSubType; /* VS_INPUT_HEADER */ \ + __u8 bNumFormats; /* p */ \ + __le16 wTotalLength; \ + __u8 bEndpointAddress; \ + __u8 bmInfo; \ + __u8 bTerminalLink; \ + __u8 bStillCaptureMethod; \ + __u8 bTriggerSupport; \ + __u8 bTriggerUsage; \ + __u8 bControlSize; /* n */ \ + __u8 bmaControls[p*n]; /* [p][n] */ \ +} __attribute__ ((packed)) + +/* Class-specific VS Interface Output Header Descriptor */ +struct usb_vs_output_header_descriptor { \ + __u8 bLength; /* 9+(p*n) bytes */ + __u8 bDescriptorType; /* CS_INTERFACE */ + + __u8 bDescriptorSubType; /* VS_OUTPUT_HEADER */ + __u8 bNumFormats; /* p */ + __le16 wTotalLength; + __u8 bEndpointAddress; + __u8 bTerminalLink; + __u8 bControlSize; /* n */ + __u8 bmaControls[]; /* [p][n] */ +} __attribute__ ((packed)); + +#define USB_VS_OUTPUT_HEADER_SIZE(p,n) (9+((p)*(n))) + +/* As above, but more useful for defining your own descriptors: */ +#define DECLARE_USB_VS_OUTPUT_HEADER_DESCRIPTOR(p,n) \ +struct usb_vs_output_header_descriptor_##px##n { \ + __u8 bLength; /* 9+(p*n) bytes */ \ + __u8 bDescriptorType; /* CS_INTERFACE */ \ + \ + __u8 bDescriptorSubType; /* VS_OUTPUT_HEADER */ \ + __u8 bNumFormats; /* p */ \ + __le16 wTotalLength; \ + __u8 bEndpointAddress; \ + __u8 bTerminalLink; \ + __u8 bControlSize; /* n */ \ + __u8 bmaControls[p*n]; /* [p][n] */ \ +} __attribute__ ((packed)) + +/* Still Image Frame Descriptor */ +#define USB_STILL_IMAGE_FRAME_SIZE(n,m) (5+(4*(n))+(m)) + +struct usb_image_pattern { + __le16 wWidth; + __le16 wHeight; +}; + +#define DECLARE_USB_STILL_IMAGE_FRAME_DESCRIPTOR(n,m) \ +struct usb_still_image_frame_descriptor_##n_##m { \ + __u8 bLength; /* 10+(4*n)-4+m-1 bytes */ \ + __u8 bDescriptorType; /* CS_INTERFACE */ \ + \ + __u8 bDescriptorSubType; /* VS_STILL_IMAGE_FRAME */ \ + __u8 bNumImageSizePatterns; /* n */ \ + struct usb_image_pattern p[n]; /* [n] */ \ + __u8 bNumCompressionPattern; /* m */ \ + __u8 bCompression[m]; /* [m] */ \ +} __attribute__ ((packed)) + +/* Color Matching Descriptor */ +struct usb_color_matching_descriptor { + __u8 bLength; /* 6 bytes */ + __u8 bDescriptorType; /* CS_INTERFACE */ + + __u8 bDescriptorSubType; /* VS_COLORFORMAT */ + __u8 bColorPrimaries; + __u8 bTransferCharacteristics; + __u8 bMatrixCoefficients; +} __attribute__ ((packed)); + +#define USB_COLOR_MATCHING_SIZE 6 + ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel