[alsa-devel] [PATCH 0/2] 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(+)
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 tiwai@suse.de --- include/linux/usb/audio-v2.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h index ba4b3e3327ff..cb9900b34b67 100644 --- a/include/linux/usb/audio-v2.h +++ b/include/linux/usb/audio-v2.h @@ -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 {
On Thu, 13 Feb 2020 12:20:58 +0100, Takashi Iwai wrote:
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 tiwai@suse.de
include/linux/usb/audio-v2.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h index ba4b3e3327ff..cb9900b34b67 100644 --- a/include/linux/usb/audio-v2.h +++ b/include/linux/usb/audio-v2.h @@ -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 {
Greg, I suppose you are OK with this addition?
thanks,
Takashi
On Mon, Feb 17, 2020 at 03:18:34PM +0100, Takashi Iwai wrote:
On Thu, 13 Feb 2020 12:20:58 +0100, Takashi Iwai wrote:
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 tiwai@suse.de
include/linux/usb/audio-v2.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h index ba4b3e3327ff..cb9900b34b67 100644 --- a/include/linux/usb/audio-v2.h +++ b/include/linux/usb/audio-v2.h @@ -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 {
Greg, I suppose you are OK with this addition?
Yes, that's fine with me:
Acked-by: Greg Kroah-Hartman gregkh@linuxfoundation.org
On Mon, 17 Feb 2020 15:22:38 +0100, Greg Kroah-Hartman wrote:
On Mon, Feb 17, 2020 at 03:18:34PM +0100, Takashi Iwai wrote:
On Thu, 13 Feb 2020 12:20:58 +0100, Takashi Iwai wrote:
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 tiwai@suse.de
include/linux/usb/audio-v2.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h index ba4b3e3327ff..cb9900b34b67 100644 --- a/include/linux/usb/audio-v2.h +++ b/include/linux/usb/audio-v2.h @@ -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 {
Greg, I suppose you are OK with this addition?
Yes, that's fine with me:
Acked-by: Greg Kroah-Hartman gregkh@linuxfoundation.org
Thanks, I'll queue the patches to sound git tree.
Takashi
During 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.
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206147 Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/usb/mixer.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index 81b2db0edd5f..56d0878e4999 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c @@ -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;
participants (2)
-
Greg Kroah-Hartman
-
Takashi Iwai