Skip to content

Commit

Permalink
include: usb: audio: specify exact endiannes of descriptors
Browse files Browse the repository at this point in the history
USB spec says that multiple byte fields are stored in
little-endian order (see chapter 8.1 of USB2.0 spec and
chapter 7.1 of USB3.0 spec), thus mark such fields as LE
for UAC1 and UAC2 headers

Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
  • Loading branch information
rbilovol authored and Felipe Balbi committed Jul 18, 2017
1 parent ab1d53d commit 8bd226f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions include/linux/usb/audio-v2.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ struct uac2_input_terminal_descriptor {
__u8 bDescriptorType;
__u8 bDescriptorSubtype;
__u8 bTerminalID;
__u16 wTerminalType;
__le16 wTerminalType;
__u8 bAssocTerminal;
__u8 bCSourceID;
__u8 bNrChannels;
__u32 bmChannelConfig;
__le32 bmChannelConfig;
__u8 iChannelNames;
__u16 bmControls;
__le16 bmControls;
__u8 iTerminal;
} __attribute__((packed));

Expand All @@ -132,11 +132,11 @@ struct uac2_output_terminal_descriptor {
__u8 bDescriptorType;
__u8 bDescriptorSubtype;
__u8 bTerminalID;
__u16 wTerminalType;
__le16 wTerminalType;
__u8 bAssocTerminal;
__u8 bSourceID;
__u8 bCSourceID;
__u16 bmControls;
__le16 bmControls;
__u8 iTerminal;
} __attribute__((packed));

Expand Down Expand Up @@ -164,9 +164,9 @@ struct uac2_as_header_descriptor {
__u8 bTerminalLink;
__u8 bmControls;
__u8 bFormatType;
__u32 bmFormats;
__le32 bmFormats;
__u8 bNrChannels;
__u32 bmChannelConfig;
__le32 bmChannelConfig;
__u8 iChannelNames;
} __attribute__((packed));

Expand Down
6 changes: 3 additions & 3 deletions include/uapi/linux/usb/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ struct uac_processing_unit_descriptor {
__u8 bDescriptorType;
__u8 bDescriptorSubtype;
__u8 bUnitID;
__u16 wProcessType;
__le16 wProcessType;
__u8 bNrInPins;
__u8 baSourceID[];
} __attribute__ ((packed));
Expand Down Expand Up @@ -491,8 +491,8 @@ struct uac_format_type_ii_ext_descriptor {
__u8 bDescriptorType;
__u8 bDescriptorSubtype;
__u8 bFormatType;
__u16 wMaxBitRate;
__u16 wSamplesPerFrame;
__le16 wMaxBitRate;
__le16 wSamplesPerFrame;
__u8 bHeaderLength;
__u8 bSideBandProtocol;
} __attribute__((packed));
Expand Down

0 comments on commit 8bd226f

Please sign in to comment.