* Salsa-lib : doesn't handle multiple device
@ 2008-09-30 12:11 Matthieu CASTET
2008-09-30 12:55 ` Takashi Iwai
0 siblings, 1 reply; 4+ messages in thread
From: Matthieu CASTET @ 2008-09-30 12:11 UTC (permalink / raw)
To: Takashi Iwai; +Cc: ALSA devel
Hi,
it seems there is a bug in card parsing (snd_card_get_index).
If the device name is "hw:0,1", then in _snd_dev_get_device,
snd_card_get_index will be called with "0,1".
But snd_card_get_index expect to be called with only the card string
number or name : it first check that the string is a number [1], and
then try for each card to compare with the card name [2]
I don't know what suppose to do snd_card_get_index, but I thing a easy
way to fix it is to pass to snd_card_get_index only the string before
the first comma.
Matthieu
[1]
(isdigit(*string) && *(string + 1) == 0) ||
(isdigit(*string) && isdigit(*(string + 1)) && *(string + 2) == 0
[2]
if (!strcmp((const char *)info.id, string))
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Salsa-lib : doesn't handle multiple device
2008-09-30 12:11 Salsa-lib : doesn't handle multiple device Matthieu CASTET
@ 2008-09-30 12:55 ` Takashi Iwai
2008-09-30 13:09 ` Matthieu CASTET
0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2008-09-30 12:55 UTC (permalink / raw)
To: Matthieu CASTET; +Cc: ALSA devel
At Tue, 30 Sep 2008 14:11:30 +0200,
Matthieu CASTET wrote:
>
> Hi,
>
> it seems there is a bug in card parsing (snd_card_get_index).
>
> If the device name is "hw:0,1", then in _snd_dev_get_device,
> snd_card_get_index will be called with "0,1".
>
> But snd_card_get_index expect to be called with only the card string
> number or name : it first check that the string is a number [1], and
> then try for each card to compare with the card name [2]
Indeed.
> I don't know what suppose to do snd_card_get_index, but I thing a easy
> way to fix it is to pass to snd_card_get_index only the string before
> the first comma.
I think the patch below is much simpler.
Could you check whether this works?
thanks,
Takashi
diff -r 7ca6ae3d3edb src/cards.c
--- a/src/cards.c Tue Sep 30 14:46:16 2008 +0200
+++ b/src/cards.c Tue Sep 30 14:51:10 2008 +0200
@@ -99,10 +99,7 @@
if (!string || *string == '\0')
return -EINVAL;
- if ((isdigit(*string) && *(string + 1) == 0) ||
- (isdigit(*string) && isdigit(*(string + 1)) && *(string + 2) == 0)) {
- if (sscanf(string, "%i", &card) != 1)
- return -EINVAL;
+ if (sscanf(string, "%i", &card) == 1) {
if (card < 0 || card > 31)
return -EINVAL;
if (snd_card_load(card))
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Salsa-lib : doesn't handle multiple device
2008-09-30 12:55 ` Takashi Iwai
@ 2008-09-30 13:09 ` Matthieu CASTET
2008-09-30 13:41 ` Takashi Iwai
0 siblings, 1 reply; 4+ messages in thread
From: Matthieu CASTET @ 2008-09-30 13:09 UTC (permalink / raw)
To: Takashi Iwai; +Cc: ALSA devel
Takashi Iwai a écrit :
> At Tue, 30 Sep 2008 14:11:30 +0200,
> Matthieu CASTET wrote:
>> Hi,
>>
>> it seems there is a bug in card parsing (snd_card_get_index).
>>
>> If the device name is "hw:0,1", then in _snd_dev_get_device,
>> snd_card_get_index will be called with "0,1".
>>
>> But snd_card_get_index expect to be called with only the card string
>> number or name : it first check that the string is a number [1], and
>> then try for each card to compare with the card name [2]
>
> Indeed.
>
>> I don't know what suppose to do snd_card_get_index, but I thing a easy
>> way to fix it is to pass to snd_card_get_index only the string before
>> the first comma.
>
> I think the patch below is much simpler.
> Could you check whether this works?
thanks, this patch also work.
Matthieu
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Salsa-lib : doesn't handle multiple device
2008-09-30 13:09 ` Matthieu CASTET
@ 2008-09-30 13:41 ` Takashi Iwai
0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2008-09-30 13:41 UTC (permalink / raw)
To: Matthieu CASTET; +Cc: ALSA devel
At Tue, 30 Sep 2008 15:09:57 +0200,
Matthieu CASTET wrote:
>
> Takashi Iwai a écrit :
> > At Tue, 30 Sep 2008 14:11:30 +0200,
> > Matthieu CASTET wrote:
> >> Hi,
> >>
> >> it seems there is a bug in card parsing (snd_card_get_index).
> >>
> >> If the device name is "hw:0,1", then in _snd_dev_get_device,
> >> snd_card_get_index will be called with "0,1".
> >>
> >> But snd_card_get_index expect to be called with only the card string
> >> number or name : it first check that the string is a number [1], and
> >> then try for each card to compare with the card name [2]
> >
> > Indeed.
> >
> >> I don't know what suppose to do snd_card_get_index, but I thing a easy
> >> way to fix it is to pass to snd_card_get_index only the string before
> >> the first comma.
> >
> > I think the patch below is much simpler.
> > Could you check whether this works?
> thanks, this patch also work.
Thanks for checking. Released as version 0.0.19 now.
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-09-30 13:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-30 12:11 Salsa-lib : doesn't handle multiple device Matthieu CASTET
2008-09-30 12:55 ` Takashi Iwai
2008-09-30 13:09 ` Matthieu CASTET
2008-09-30 13:41 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.