Skip to contentSkip to conversation

snd_card_load

DISCUSSION Immanuel Litzroth 2 participants 2 messages Jun 24, 2005 – Jun 28, 2005

lore
Share & tools
lore
#0 lore raw

I am currently writing some C++ classes around parts of the alsa api. I have a lot of work figuring out the semantics of the alsa calls and am using a combination of the doxygen documentation, the alsalib source and the sources to programs that use alsa.
The problem I ran into yesterday concerns the snd_card_load function.
1) the documentation states that that functions returns 0 if the driver is not present and 1 if it is. The code at the end of the function goes:

if (open_dev >= 0) {
        close (open_dev);
	return 0;
	}

return open_dev ? 1 : 0;

it seems to me that 0 is returned if the driver is loaded and 1 if it is not. moreover the last expression (return open_dev ? 1 : 0;) is superflous and should be just "return 1;"
2) somewhat further in snd_card_get_index the following tests are made if(snd_card_load(card) >= 0) --> always true if(snd_card_load(card) < 0) --> always false

Am I missing something?
Immanuel

***************************************************************************
I can, I can't.
Tubbs Tattsyrup

--
Immanuel Litzroth
Software Development Engineer
Enfocus Software
Antwerpsesteenweg 41-45
9000 Gent
Belgium
Voice: +32 9 269 23 90
Fax : +32 9 269 16 91
Email: [email protected]
web : www.enfocus.be
***************************************************************************

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click

#1 lore raw

At 24 Jun 2005 13:28:08 +0200,

Quoted 20 lines · Immanuel Litzroth

I am currently writing some C++ classes around parts of the alsa api. I have a lot of work figuring out the semantics of the alsa calls and am using a combination of the doxygen documentation, the alsalib source and the sources to programs that use alsa.
The problem I ran into yesterday concerns the snd_card_load function.
1) the documentation states that that functions returns 0 if the driver is not present and 1 if it is. The code at the end of the function goes:

if (open_dev >= 0) {
        close (open_dev);
	return 0;
	}

return open_dev ? 1 : 0;

it seems to me that 0 is returned if the driver is loaded and 1 if it is not. moreover the last expression (return open_dev ? 1 : 0;) is superflous and should be just "return 1;"

Quoted 5 lines

2) somewhat further in snd_card_get_index the following tests are made if(snd_card_load(card) >= 0) --> always true if(snd_card_load(card) < 0) --> always false

Am I missing something?

On both you're right, it's definitely a bug of alsa-lib. Fixed on CVS. snd_card_load() follows to the behavior described in the document now.

Thanks for spotting out this.

Takashi

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click