At Wed, 13 Jul 2011 02:13:25 +0200, Daniel Mack wrote:
There are cards that the mixer code fails to create controls for, and currently, the whole sound device creation fails in such cases. This patch changes the code so that it just spits out warnings and continues looking at other functions of the descriptor set which might work just fine.
It depends. If a serious error like -ENOMEM, we should abort immediately. It means something is really bad.
The worst thing that can happen now is that people see soundcards that don't have all funcions supported, but rejecting the whole device is not any better.
Then it'd be better to check some "easy" errors to be ignored (or check serious errors to abort). I don't like ignoring all errors blindly.
thanks,
Takashi
Signed-off-by: Daniel Mack zonque@gmail.com
sound/usb/card.c | 5 ++--- sound/usb/mixer.c | 9 ++++++--- 2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/sound/usb/card.c b/sound/usb/card.c index 220c616..8990b49 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -512,9 +512,8 @@ static void *snd_usb_audio_probe(struct usb_device *dev, if (err > 0) { /* create normal USB audio interfaces */ if (snd_usb_create_streams(chip, ifnum) < 0 ||
snd_usb_create_mixer(chip, ifnum, ignore_ctl_error) < 0) {
goto __error;
}
snd_usb_create_mixer(chip, ifnum, ignore_ctl_error) < 0)
snd_printk(KERN_WARNING "snd_usb_create_mixer() failed\n");
}
/* we are allowed to call snd_card_register() many times */
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index c22fa76..c43dbea 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c @@ -1967,7 +1967,8 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) state.oterm.name = desc->iTerminal; err = parse_audio_unit(&state, desc->bSourceID); if (err < 0)
return err;
snd_printk(KERN_WARNING "Unable to parse terminal with bSourceID %d\n",
} else { /* UAC_VERSION_2 */ struct uac2_output_terminal_descriptor *desc = p;desc->bSourceID);
@@ -1979,12 +1980,14 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) state.oterm.name = desc->iTerminal; err = parse_audio_unit(&state, desc->bSourceID); if (err < 0)
return err;
snd_printk(KERN_WARNING "Unable to parse terminal with bSourceID %d\n",
desc->bSourceID); /* for UAC2, use the same approach to also add the clock selectors */ err = parse_audio_unit(&state, desc->bCSourceID); if (err < 0)
return err;
snd_printk(KERN_WARNING "Unable to parse clock terminal with bCSourceID %d\n",
} }desc->bCSourceID);
-- 1.7.5.4
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel