From: Gregor Jasny <jasny@vidsoft.de>
To: alsa-devel@lists.sourceforge.net
Subject: Need help with patch for #2724 (usbaudio, core)
Date: Sat, 27 Jan 2007 14:24:45 +0100 [thread overview]
Message-ID: <20070127132445.GA11859@vidsoft.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 1082 bytes --]
Hi,
I've tried to write a patch for bug #2724. The problem is that some
Logitech webcams have interface alternatives with a rate of 0:
Interface 3
Altset 1
Format: 0x2
Channels: 1
Endpoint: 6 IN (ASYNC)
Rates: 0
Interface 3
Altset 2
Format: 0x2
Channels: 1
Endpoint: 6 IN (ASYNC)
Rates: 0
Interface 3
Altset 3
Format: 0x2
Channels: 1
Endpoint: 6 IN (ASYNC)
Rates: 16000
The ALSA Kernel driver seems to be somewhat unhappy about this and
oopses in snd_interval_list which gets called with:
i: dc4f0928 count: 3635438588 list: ffffffff mask 4294967295
I've tried to track down the origin of -1 in constraint_list->list but got
lost in the depths of the hw param stuff.
The attached patch skips all alternatives with no valid rates. With this
patch my Quickcam 5000 works like a charm. But I'm unsure if this is the
right approach to fix this bug.
I think the right way to go is to fix also the cause of the oops, so
that the ALSA core doesn't oops when no valid rate is given.
Thanks for your comments,
Gregor
[-- Attachment #2: logitech.diff --]
[-- Type: text/plain, Size: 1255 bytes --]
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index 19bdcc7..661e557 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -2455,7 +2455,7 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform
/*
* build the rate table and bitmap flags
*/
- int r, idx, c;
+ int r, idx, c, nonzero_rates = 0;
/* this table corresponds to the SNDRV_PCM_RATE_XXX bit */
static unsigned int conv_rates[] = {
5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000,
@@ -2478,6 +2478,7 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform
fp->altsetting == 5 && fp->maxpacksize == 392)
rate = 96000;
fp->rate_table[r] = rate;
+ nonzero_rates |= rate;
if (rate < fp->rate_min)
fp->rate_min = rate;
else if (rate > fp->rate_max)
@@ -2493,6 +2494,10 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform
if (!found)
fp->needs_knot = 1;
}
+ if (!nonzero_rates) {
+ hwc_debug("No rate was nonzero. Skipping format!\n");
+ return -1;
+ }
if (fp->needs_knot)
fp->rates |= SNDRV_PCM_RATE_KNOT;
} else {
[-- Attachment #3: Type: text/plain, Size: 347 bytes --]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
[-- Attachment #4: Type: text/plain, Size: 161 bytes --]
_______________________________________________
Alsa-devel mailing list
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel
next reply other threads:[~2007-01-27 13:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-27 13:24 Gregor Jasny [this message]
2007-01-30 16:57 ` Need help with patch for #2724 (usbaudio, core) Takashi Iwai
2007-01-31 11:22 ` Gregor Jasny
2007-01-31 11:34 ` Takashi Iwai
2007-01-31 13:14 ` Gregor Jasny
2007-01-31 13:22 ` Takashi Iwai
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=20070127132445.GA11859@vidsoft.de \
--to=jasny@vidsoft.de \
--cc=alsa-devel@lists.sourceforge.net \
/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).