Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lennart Poettering <mznyfn@0pointer.de>
To: 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 14:32:30 +0200	[thread overview]
Message-ID: <20090512123229.GB29607@tango.0pointer.de> (raw)
In-Reply-To: <alpine.LNX.2.00.0905121336130.25064@eeebox2.perex-int.cz>

On Tue, 12.05.09 13:40, Jaroslav Kysela (perex@perex.cz) wrote:

> 
> On Tue, 12 May 2009, Jaroslav Kysela wrote:
> 
> > On Tue, 12 May 2009, Lennart Poettering wrote:
> >
> >> Heya!
> >> 
> >> Traditionally low-level ALSA devices are opened with device strings like
> >> 'hw:CARD' where CARD is either a numeric index or a card name. This
> >> patch introduces a third syntax that allows you to specify the file name
> >> of the control device node. The purpose for this is to make ALSA a bit
> >> more like other Linux devices and allow implementaiton of udev device
> >> symlinks similar to how disks are currently handled, with
> >> /dev/disk/by-path/xxxx /dev/disk/by-id/xxxx and so on.
> >> 
> >> With this patch this line:
> >>
> >>  aplay -f CD -D hw:/dev/snd/controlC0 < /dev/urandom
> >> 
> >> becomes equivalent to this line:
> >>
> >>  aplay -f CD -D hw:0 < /dev/urandom
> >> 
> >> A more useful example is this:
> >>
> >>  aplay -f CD -D hw:/dev/snd/by-path/pci-0000:00:1a.7-usb-0:2:1.2
> >> 
> >> (this line requires a a few additional udev rules)
> >> 
> >> This only works for control devices nodes, not for PCM or any other
> >> device nodes. Since the control device node is used as 'entry point'
> >> when opening PCM devices this is no limitation.
> >
> > NAK. Passing control device to open() functions is not a good idea. The 
> > snd_card_get_index() function might be extended to allow /dev style argument. 
> > Returned card index can be used as argument for hw: devices without this 
> > massive change.
> >
> > http://git.alsa-project.org/?p=alsa-lib.git;a=commit;h=33ab0b5381c87e151e87e5000964edd868484886
> 
> I just noticed that snd_card_get_index() is used to parse "card" 
> configuration item when it's string, so control device name can be passed 
> instead card identification to all open() functions in alsa-lib with my 
> above patch, too. But it's preferred to use direct card index to reduce
> control device open/close sequences.

With my original patch there are no superfluous opens.

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4

  reply	other threads:[~2009-05-12 12:32 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 [this message]
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
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=20090512123229.GB29607@tango.0pointer.de \
    --to=mznyfn@0pointer.de \
    --cc=alsa-devel@alsa-project.org \
    /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