From: Lennart Poettering <mznyfn@0pointer.de>
To: Jaroslav Kysela <perex@perex.cz>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH] control, hw, rawmidi: accept control device node as card identifier when opening
Date: Tue, 12 May 2009 18:04:37 +0200 [thread overview]
Message-ID: <20090512160436.GA14622@tango.0pointer.de> (raw)
In-Reply-To: <alpine.LNX.2.00.0905121610420.25064@eeebox2.perex-int.cz>
On Tue, 12.05.09 16:40, Jaroslav Kysela (perex@perex.cz) wrote:
> > With my patch that costs exactly two open() calls. It's also more
> > flexible since it will handle arbitrary device strings, doesn't need
> > to hardcode "hw:".
>
> The mentioned code will work with my patch as well. There is no
> difference, because extended snd_card_get_index() is called from _*open()
> callbacks when card argument is a string.
Yes, it will work. But at the price of one extra open.
> > You seem to suggest this:
> >
> > <snip>
> > i = snd_card_index("hw:/dev/snd/by-path/yaddayadda");
>
> It should be: i = snd_card_index("/dev/snd/by-path/yaddayadda");
Yes, of course.
>
> > snd_hw_open(&hw, snprint("hw:%i", i));
>
> You mean probably snd_pcm_open() here.
Yes, you are right.
> > snd_ctl_open(&ctl, snprint("hw:%i", i));
> > </snip>
> >
> > Which your patch that costs three open()s.
>
> It's similar to your patch. Two open calls. snd_pcm_open() does not use
> ctl device if a direct card index is specified.
Hmm? The first thing snd_pcm_hw_open() does is calling
snd_ctl_hw_open(). So with your code, the name will bre resolved and
the ctl device opened and closed for that. And then shortly after the
device will be reopened right-away and then kept open. In my code
after the resolving I'd just keep the device open.
Your code requires three open()s for this, mine required two.
> > And hardcodes "hw".
>
> It's not relevant. Your code also hardcodes "hw" (and application should
> decide if hw: is a proper interface not alsa-lib - any defined device
> which accepts the card argument will work).
The example code I gave doesn't hardcode it. You can specify any
device as long as the stream info knows the card parameter properly.
> > I really would like to know why my patch was so bad?
>
> I do not think that an addition of extra argument to open() calls is good
> in this case. The card identification for open() calls is string anyway,
> because you may use syntax like 'hw:FirstHDACard' - see 'cat
> /proc/asound/cards' for string identification. All other extensions
> should be in the configuration area (in .conf files or configuration
> parsing code).
Hmm? The whole point of my patch was to make ALSA devices a bit more
like other devices, i.e. with persistancy of device symlinks and
stuff. Also, AFAICS the snd_pcm_hw_open() call (and friends) are
internal anyway?
Anyway, given that your code has the same effect as mine, it's
probably not worth dicussing this any further...
Lennart
--
Lennart Poettering Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/ GnuPG 0x1A015CC4
next prev parent reply other threads:[~2009-05-12 16:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-11 22:41 [PATCH] control, hw, rawmidi: accept control device node as card identifier when opening Lennart Poettering
2009-05-12 6:09 ` Jaroslav Kysela
2009-05-12 11:40 ` Jaroslav Kysela
2009-05-12 12:32 ` Lennart Poettering
2009-05-12 12:42 ` Jaroslav Kysela
2009-05-12 13:24 ` Lennart Poettering
2009-05-12 14:40 ` Jaroslav Kysela
2009-05-12 16:04 ` Lennart Poettering [this message]
2009-05-12 16:54 ` Jaroslav Kysela
2009-05-12 12:29 ` Lennart Poettering
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=20090512160436.GA14622@tango.0pointer.de \
--to=mznyfn@0pointer.de \
--cc=alsa-devel@alsa-project.org \
--cc=perex@perex.cz \
/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