ALSA: usb-audio: UAC2 effect unit parsing
cover ALSA: usb-audio: UAC2 effect unit parsing
Hi,
UAC2 Effect Unit needs different parsing from Processing Unit and co, and this patch set implements the partial support for that.
As it's the fix on top of the latest USB-audio fix, I'd like to apply through sound git tree. So please review and ack if USB header change is OK.
thanks,
Takashi
===
Takashi Iwai (2):
usb: audio-v2: Add uac2_effect_unit_descriptor definition
ALSA: usb-audio: Parse source ID of UAC2 effect unit
include/linux/usb/audio-v2.h | 12 ++++++++++++ sound/usb/mixer.c | 6 ++++++ 2 files changed, 18 insertions(+)
Signature · 1 line
2.16.4
PATCH 1/2 usb: audio-v2: Add uac2_effect_unit_descriptor definition
The UAC2 Effect Unit Descriptor has a slightly different definition from other similar ones like Processing Unit or Extension Unit. Define it here so that it can be used in USB-audio driver in a later patch.
--- include/linux/usb/audio-v2.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
include/linux/usb/audio-v2.h +12 -0
@@ -156,6 +156,18 @@ struct uac2_feature_unit_descriptor {__u8 bmaControls[0 ];/* variable length */ } __attribute__((packed)); +/* 4.7.2.10 Effect Unit Descriptor */ + +struct uac2_effect_unit_descriptor { +__u8 bLength; +__u8 bDescriptorType; +__u8 bDescriptorSubtype; +__u8 bUnitID; +__le16 wEffectType; +__u8 bSourceID; +__u8 bmaControls[];/* variable length */ +} __attribute__((packed)); +/* 4.9.2 Class-Specific AS Interface Descriptor */ struct uac2_as_header_descriptor {
Signature · 1 line
2.16.4
Re: [PATCH 1/2] usb: audio-v2: Add uac2_effect_unit_descriptor definition
Quoted 24 lines · Takashi Iwai
The UAC2 Effect Unit Descriptor has a slightly different definition from other similar ones like Processing Unit or Extension Unit. Define it here so that it can be used in USB-audio driver in a later patch.
Signed-off-by Takashi Iwai <[email protected]>--- include/linux/usb/audio-v2.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)include/linux/usb/audio-v2.h +5
-0@@ -156,6 +156,18 @@ struct uac2_feature_unit_descriptor {__u8 bmaControls[0 ];/* variable length */ } __attribute__((packed)); +/* 4.7.2.10 Effect Unit Descriptor */ + +struct uac2_effect_unit_descriptor { +__u8 bLength; +__u8 bDescriptorType;
include/linux/usb/audio-v2.h struct uac2_feature_unit_descriptor { · line 173
Quoted 10 lines
include/linux/usb/audio-v2.h +7
-0+__u8 bDescriptorSubtype; +__u8 bUnitID; +__le16 wEffectType; +__u8 bSourceID; +__u8 bmaControls[];/* variable length */ +} __attribute__((packed)); +/* 4.9.2 Class-Specific AS Interface Descriptor */ struct uac2_as_header_descriptor {
Greg, I suppose you are OK with this addition?
thanks,
Takashi
Re: [PATCH 1/2] usb: audio-v2: Add uac2_effect_unit_descriptor definition
Quoted 35 lines · Takashi Iwai
Quoted 33 lines · Takashi Iwai
The UAC2 Effect Unit Descriptor has a slightly different definition from other similar ones like Processing Unit or Extension Unit. Define it here so that it can be used in USB-audio driver in a later patch.
Signed-off-by Takashi Iwai <[email protected]>--- include/linux/usb/audio-v2.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)include/linux/usb/audio-v2.h +12
-0@@ -156,6 +156,18 @@ struct uac2_feature_unit_descriptor {__u8 bmaControls[0 ];/* variable length */ } __attribute__((packed)); +/* 4.7.2.10 Effect Unit Descriptor */ + +struct uac2_effect_unit_descriptor { +__u8 bLength; +__u8 bDescriptorType; +__u8 bDescriptorSubtype; +__u8 bUnitID; +__le16 wEffectType; +__u8 bSourceID; +__u8 bmaControls[];/* variable length */ +} __attribute__((packed)); +/* 4.9.2 Class-Specific AS Interface Descriptor */
Quoted 5 lines
include/linux/usb/audio-v2.h struct uac2_feature_unit_descriptor { · line 173
Quoted 1 line
include/linux/usb/audio-v2.h +0
-0struct uac2_as_header_descriptor {Greg, I suppose you are OK with this addition?
Yes, that's fine with me:
Re: [PATCH 1/2] usb: audio-v2: Add uac2_effect_unit_descriptor definition
Quoted 43 lines · Greg Kroah-Hartman
Quoted 35 lines · Takashi Iwai
Quoted 33 lines · Takashi Iwai
The UAC2 Effect Unit Descriptor has a slightly different definition from other similar ones like Processing Unit or Extension Unit. Define it here so that it can be used in USB-audio driver in a later patch.
Signed-off-by Takashi Iwai <[email protected]>--- include/linux/usb/audio-v2.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)include/linux/usb/audio-v2.h +12
-0@@ -156,6 +156,18 @@ struct uac2_feature_unit_descriptor {__u8 bmaControls[0 ];/* variable length */ } __attribute__((packed)); +/* 4.7.2.10 Effect Unit Descriptor */ + +struct uac2_effect_unit_descriptor { +__u8 bLength; +__u8 bDescriptorType; +__u8 bDescriptorSubtype; +__u8 bUnitID; +__le16 wEffectType; +__u8 bSourceID; +__u8 bmaControls[];/* variable length */ +} __attribute__((packed)); +/* 4.9.2 Class-Specific AS Interface Descriptor */ Quoted 5 lines
include/linux/usb/audio-v2.h struct uac2_feature_unit_descriptor { · line 173
Quoted 1 line
include/linux/usb/audio-v2.h +0
-0struct uac2_as_header_descriptor {Greg, I suppose you are OK with this addition?
Quoted 3 lines
Yes, that's fine with me:
Thanks, I'll queue the patches to sound git tree.
Takashi
PATCH 2/2 ALSA: usb-audio: Parse source ID of UAC2 effect unit
In reply to Takashi IwaiDuring parsing the input source, we currently cut off at the Effect Unit node without parsing further its source id. It's no big problem, so far, but it should be more consistent to parse it properly.
This patch adds the recursive parsing in parse_term_effect_unit(). It doesn't add anything in the audio unit parser itself, and the effect unit itself is still skipped, though.
--- sound/usb/mixer.c | 6 ++++++ 1 file changed, 6 insertions(+)
sound/usb/mixer.c +6 -0
@@ -901,6 +901,12 @@ static int parse_term_effect_unit(struct mixer_build *state,struct usb_audio_term *term, void *p1, int id) { + struct uac2_effect_unit_descriptor *d = p1; +int err; + + err =__check_input_term (state, d->bSourceID, term); +if (err <0 ) +return err; term->type =UAC3_EFFECT_UNIT <<16 ;/* virtual type */ term->id = id;return 0 ;
Signature · 1 line
2.16.4