usb: video: Fix endianness mismatches in descriptor structures
All UVC descriptors use little-endian format, update the data structures accordingly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Tested-by: Paul Elder <paul.elder@ideasonboard.com>
This commit is contained in:
parent
d865d00db9
commit
f823b75f43
|
@ -195,9 +195,9 @@ struct uvc_header_descriptor {
|
|||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u16 bcdUVC;
|
||||
__u16 wTotalLength;
|
||||
__u32 dwClockFrequency;
|
||||
__le16 bcdUVC;
|
||||
__le16 wTotalLength;
|
||||
__le32 dwClockFrequency;
|
||||
__u8 bInCollection;
|
||||
__u8 baInterfaceNr[];
|
||||
} __attribute__((__packed__));
|
||||
|
@ -212,9 +212,9 @@ struct UVC_HEADER_DESCRIPTOR(n) { \
|
|||
__u8 bLength; \
|
||||
__u8 bDescriptorType; \
|
||||
__u8 bDescriptorSubType; \
|
||||
__u16 bcdUVC; \
|
||||
__u16 wTotalLength; \
|
||||
__u32 dwClockFrequency; \
|
||||
__le16 bcdUVC; \
|
||||
__le16 wTotalLength; \
|
||||
__le32 dwClockFrequency; \
|
||||
__u8 bInCollection; \
|
||||
__u8 baInterfaceNr[n]; \
|
||||
} __attribute__ ((packed))
|
||||
|
@ -225,7 +225,7 @@ struct uvc_input_terminal_descriptor {
|
|||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u8 bTerminalID;
|
||||
__u16 wTerminalType;
|
||||
__le16 wTerminalType;
|
||||
__u8 bAssocTerminal;
|
||||
__u8 iTerminal;
|
||||
} __attribute__((__packed__));
|
||||
|
@ -238,7 +238,7 @@ struct uvc_output_terminal_descriptor {
|
|||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u8 bTerminalID;
|
||||
__u16 wTerminalType;
|
||||
__le16 wTerminalType;
|
||||
__u8 bAssocTerminal;
|
||||
__u8 bSourceID;
|
||||
__u8 iTerminal;
|
||||
|
@ -252,12 +252,12 @@ struct uvc_camera_terminal_descriptor {
|
|||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u8 bTerminalID;
|
||||
__u16 wTerminalType;
|
||||
__le16 wTerminalType;
|
||||
__u8 bAssocTerminal;
|
||||
__u8 iTerminal;
|
||||
__u16 wObjectiveFocalLengthMin;
|
||||
__u16 wObjectiveFocalLengthMax;
|
||||
__u16 wOcularFocalLength;
|
||||
__le16 wObjectiveFocalLengthMin;
|
||||
__le16 wObjectiveFocalLengthMax;
|
||||
__le16 wOcularFocalLength;
|
||||
__u8 bControlSize;
|
||||
__u8 bmControls[3];
|
||||
} __attribute__((__packed__));
|
||||
|
@ -298,7 +298,7 @@ struct uvc_processing_unit_descriptor {
|
|||
__u8 bDescriptorSubType;
|
||||
__u8 bUnitID;
|
||||
__u8 bSourceID;
|
||||
__u16 wMaxMultiplier;
|
||||
__le16 wMaxMultiplier;
|
||||
__u8 bControlSize;
|
||||
__u8 bmControls[2];
|
||||
__u8 iProcessing;
|
||||
|
@ -346,7 +346,7 @@ struct uvc_control_endpoint_descriptor {
|
|||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u16 wMaxTransferSize;
|
||||
__le16 wMaxTransferSize;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#define UVC_DT_CONTROL_ENDPOINT_SIZE 5
|
||||
|
@ -357,7 +357,7 @@ struct uvc_input_header_descriptor {
|
|||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u8 bNumFormats;
|
||||
__u16 wTotalLength;
|
||||
__le16 wTotalLength;
|
||||
__u8 bEndpointAddress;
|
||||
__u8 bmInfo;
|
||||
__u8 bTerminalLink;
|
||||
|
@ -379,7 +379,7 @@ struct UVC_INPUT_HEADER_DESCRIPTOR(n, p) { \
|
|||
__u8 bDescriptorType; \
|
||||
__u8 bDescriptorSubType; \
|
||||
__u8 bNumFormats; \
|
||||
__u16 wTotalLength; \
|
||||
__le16 wTotalLength; \
|
||||
__u8 bEndpointAddress; \
|
||||
__u8 bmInfo; \
|
||||
__u8 bTerminalLink; \
|
||||
|
@ -396,7 +396,7 @@ struct uvc_output_header_descriptor {
|
|||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u8 bNumFormats;
|
||||
__u16 wTotalLength;
|
||||
__le16 wTotalLength;
|
||||
__u8 bEndpointAddress;
|
||||
__u8 bTerminalLink;
|
||||
__u8 bControlSize;
|
||||
|
@ -414,7 +414,7 @@ struct UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) { \
|
|||
__u8 bDescriptorType; \
|
||||
__u8 bDescriptorSubType; \
|
||||
__u8 bNumFormats; \
|
||||
__u16 wTotalLength; \
|
||||
__le16 wTotalLength; \
|
||||
__u8 bEndpointAddress; \
|
||||
__u8 bTerminalLink; \
|
||||
__u8 bControlSize; \
|
||||
|
@ -478,14 +478,14 @@ struct uvc_frame_uncompressed {
|
|||
__u8 bDescriptorSubType;
|
||||
__u8 bFrameIndex;
|
||||
__u8 bmCapabilities;
|
||||
__u16 wWidth;
|
||||
__u16 wHeight;
|
||||
__u32 dwMinBitRate;
|
||||
__u32 dwMaxBitRate;
|
||||
__u32 dwMaxVideoFrameBufferSize;
|
||||
__u32 dwDefaultFrameInterval;
|
||||
__le16 wWidth;
|
||||
__le16 wHeight;
|
||||
__le32 dwMinBitRate;
|
||||
__le32 dwMaxBitRate;
|
||||
__le32 dwMaxVideoFrameBufferSize;
|
||||
__le32 dwDefaultFrameInterval;
|
||||
__u8 bFrameIntervalType;
|
||||
__u32 dwFrameInterval[];
|
||||
__le32 dwFrameInterval[];
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#define UVC_DT_FRAME_UNCOMPRESSED_SIZE(n) (26+4*(n))
|
||||
|
@ -500,14 +500,14 @@ struct UVC_FRAME_UNCOMPRESSED(n) { \
|
|||
__u8 bDescriptorSubType; \
|
||||
__u8 bFrameIndex; \
|
||||
__u8 bmCapabilities; \
|
||||
__u16 wWidth; \
|
||||
__u16 wHeight; \
|
||||
__u32 dwMinBitRate; \
|
||||
__u32 dwMaxBitRate; \
|
||||
__u32 dwMaxVideoFrameBufferSize; \
|
||||
__u32 dwDefaultFrameInterval; \
|
||||
__le16 wWidth; \
|
||||
__le16 wHeight; \
|
||||
__le32 dwMinBitRate; \
|
||||
__le32 dwMaxBitRate; \
|
||||
__le32 dwMaxVideoFrameBufferSize; \
|
||||
__le32 dwDefaultFrameInterval; \
|
||||
__u8 bFrameIntervalType; \
|
||||
__u32 dwFrameInterval[n]; \
|
||||
__le32 dwFrameInterval[n]; \
|
||||
} __attribute__ ((packed))
|
||||
|
||||
/* MJPEG Payload - 3.1.1. MJPEG Video Format Descriptor */
|
||||
|
@ -534,14 +534,14 @@ struct uvc_frame_mjpeg {
|
|||
__u8 bDescriptorSubType;
|
||||
__u8 bFrameIndex;
|
||||
__u8 bmCapabilities;
|
||||
__u16 wWidth;
|
||||
__u16 wHeight;
|
||||
__u32 dwMinBitRate;
|
||||
__u32 dwMaxBitRate;
|
||||
__u32 dwMaxVideoFrameBufferSize;
|
||||
__u32 dwDefaultFrameInterval;
|
||||
__le16 wWidth;
|
||||
__le16 wHeight;
|
||||
__le32 dwMinBitRate;
|
||||
__le32 dwMaxBitRate;
|
||||
__le32 dwMaxVideoFrameBufferSize;
|
||||
__le32 dwDefaultFrameInterval;
|
||||
__u8 bFrameIntervalType;
|
||||
__u32 dwFrameInterval[];
|
||||
__le32 dwFrameInterval[];
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#define UVC_DT_FRAME_MJPEG_SIZE(n) (26+4*(n))
|
||||
|
@ -556,14 +556,14 @@ struct UVC_FRAME_MJPEG(n) { \
|
|||
__u8 bDescriptorSubType; \
|
||||
__u8 bFrameIndex; \
|
||||
__u8 bmCapabilities; \
|
||||
__u16 wWidth; \
|
||||
__u16 wHeight; \
|
||||
__u32 dwMinBitRate; \
|
||||
__u32 dwMaxBitRate; \
|
||||
__u32 dwMaxVideoFrameBufferSize; \
|
||||
__u32 dwDefaultFrameInterval; \
|
||||
__le16 wWidth; \
|
||||
__le16 wHeight; \
|
||||
__le32 dwMinBitRate; \
|
||||
__le32 dwMaxBitRate; \
|
||||
__le32 dwMaxVideoFrameBufferSize; \
|
||||
__le32 dwDefaultFrameInterval; \
|
||||
__u8 bFrameIntervalType; \
|
||||
__u32 dwFrameInterval[n]; \
|
||||
__le32 dwFrameInterval[n]; \
|
||||
} __attribute__ ((packed))
|
||||
|
||||
#endif /* __LINUX_USB_VIDEO_H */
|
||||
|
|
Loading…
Reference in New Issue