[alsa-devel] [PATCH] control, hw, rawmidi: accept control device node as card identifier when opening

Jaroslav Kysela perex at perex.cz
Tue May 12 08:09:20 CEST 2009

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.



Jaroslav Kysela <perex at perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.

More information about the Alsa-devel mailing list