From: Daniel Mack <zonque@gmail.com>
To: Daniel Mack <zonque@gmail.com>
Cc: tiwai@suse.de, alsa-devel@alsa-project.org, clemens@ladisch.de,
joachim.gahl@web.de
Subject: Re: [PATCH] ALSA: snd-usb: sample rate detection workaround for Axe-Fx II
Date: Sun, 08 Sep 2013 19:52:40 +0200 [thread overview]
Message-ID: <522CB968.7080307@gmail.com> (raw)
In-Reply-To: <1378658119-31056-1-git-send-email-zonque@gmail.com>
On 08.09.2013 18:35, Daniel Mack wrote:
> Fractal Audio Systems Axe-Fx II and maybe other devices fail to return
> their sample rate range descriptor when only asked for the first two
> bytes.
>
> Add a workaround and assume exactly one sample rate in this case, and
> continue with the full descriptor fetch.
Please ignore this patch for now. In an off-list discussion, it turned
out that this device needs a manual firmware download each time it is
connected, and the vendor is willing to fix that bug on the firmware
side. Hence, that issue can be fixed for all users at once, and so we
won't need that nasty workaround eventually.
Thanks,
Daniel
>
> Signed-off-by: Daniel Mack <zonque@gmail.com>
> Reported-and-tested-by: Joachim Gahl <joachim.gahl@web.de>
> ---
> sound/usb/format.c | 21 +++++++++++++--------
> 1 file changed, 13 insertions(+), 8 deletions(-)
>
> diff --git a/sound/usb/format.c b/sound/usb/format.c
> index 3525231..d9de43d 100644
> --- a/sound/usb/format.c
> +++ b/sound/usb/format.c
> @@ -297,13 +297,17 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,
> snd_usb_ctrl_intf(chip) | (clock << 8),
> tmp, sizeof(tmp));
>
> - if (ret < 0) {
> - snd_printk(KERN_ERR "%s(): unable to retrieve number of sample rates (clock %d)\n",
> - __func__, clock);
> - goto err;
> - }
> + /*
> + * Some devices, including Fractal Audio Systems Axe-Fx II, fail to
> + * return only a fraction of this descriptor. If that happens, assume
> + * we have only one sample rate and continue. In case of any other
> + * error, we will bail on the full descriptor fetch below.
> + */
> + if (ret < 0)
> + nr_triplets = 1;
> + else
> + nr_triplets = combine_word(tmp);
>
> - nr_triplets = (tmp[1] << 8) | tmp[0];
> data_size = 2 + 12 * nr_triplets;
> data = kzalloc(data_size, GFP_KERNEL);
> if (!data) {
> @@ -319,8 +323,9 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,
> data, data_size);
>
> if (ret < 0) {
> - snd_printk(KERN_ERR "%s(): unable to retrieve sample rate range (clock %d)\n",
> - __func__, clock);
> + snd_printk(KERN_ERR "%s(): unable to retrieve sample rate range "
> + "(clock %d, nr_triplets %d)\n",
> + __func__, clock, nr_triplets);
> ret = -EINVAL;
> goto err_free;
> }
>
prev parent reply other threads:[~2013-09-08 17:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-08 16:35 [PATCH] ALSA: snd-usb: sample rate detection workaround for Axe-Fx II Daniel Mack
2013-09-08 17:52 ` Daniel Mack [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=522CB968.7080307@gmail.com \
--to=zonque@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=clemens@ladisch.de \
--cc=joachim.gahl@web.de \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).