Closed MathisMARION closed 1 year ago
It's rather a bug than feature. The EINVAL return code should be returned in this case, because 'card:' devices do not exist.
Fixes in 7e678d70c20e5d9f55b72ef0da6d8c0b38067b17 .
BTW: Use snd_card_next()
and other snd_card
functions to enumerate the ALSA cards. The procfs should not be used.
Hello,
I have been experimenting with the
alsa
library, and I tried to use thesnd_device_name_hint()
function to print information about devices. It doesn't seem documented here so I looked up for examples online, and explored the source code as well.Looking at the source code, it seems like the function should be able to take
"card"
as a valid interface. However when I run this function, it returnsENOENT
. I ran my program withgdb
and found that this call toadd_card()
was returning the error.add_card
callssnd_config_search
which loops through a list to find a match. In my case I found out that the list contained"cards"
(with ans
), while the code was searching for"card"
so I am left wondering if this was done on purpose. Moreover I can get info about my sound cards using/proc/asound/cards
(with ans
again) so it makes me doubt even more...I am running Ubuntu 20.04.5, and have installed
libasound2-dev
version1.2.2-2.1ubuntu2.5
. I can give more info about my setup if needed, I am just unsure what other info would help as of right now.Here's a simple program reproducing my issue:
Putting
"cards"
instead results inEINVAL
: