Re: sysfs & ALSA card

From: Kay Sievers
Date: Sat Oct 07 2006 - 08:59:54 EST


On Sat, 2006-10-07 at 00:44 -0700, Greg KH wrote:
> > On Fri, Oct 06, 2006 at 04:00:27PM +0200, Jaroslav Kysela wrote:
> > > I would like to discuss where is the right root for soundcards in
> > > the sysfs tree. I would like to put card specific variables like id there
> > > (see /proc/asound/card0/id).

> > > Also, I plan to create link from
> > > /sys/class/sound tree to the appropriate card to show relationship.
> > > Something like:
> > >
> > > /sys/<somewhere>/soundcard/0
> > >
> > > /sys/class/sound/controlC0/soundcard -> ../../../<somewhere>/soundcard/0
> > >
> > > Any comments and suggestions?

No, please no links if you have stuff that can be expressed in a tree,
which you perfectly can in this case. Just create a parent "card-device"
to hold the generic card attributes, and put the stuff like pcmC0* below
that device. Userspace is fine with that and will not break,
cause /sys/class/sound/* is still just a flat directory with all devices
in one directory, only the link targets will point to a hierarchy (note
that the link target of "pcmC1D0c" includes" Audigy2". )

> Here's what /sys/class/sound now looks like for me:
> $ tree /sys/class/sound/
> /sys/class/sound/
> |-- Audigy2 -> ../../devices/pci0000:00/0000:00:1e.0/0000:06:0d.0/Audigy2
> |-- admmidi1 -> ../../devices/pci0000:00/0000:00:1e.0/0000:06:0d.0/Audigy2/admmidi1
> |-- amidi1 -> ../../devices/pci0000:00/0000:00:1e.0/0000:06:0d.0/Audigy2/amidi1
> |-- controlC1 -> ../../devices/pci0000:00/0000:00:1e.0/0000:06:0d.0/Audigy2/controlC1
> |-- dmmidi1 -> ../../devices/pci0000:00/0000:00:1e.0/0000:06:0d.0/Audigy2/dmmidi1
> |-- hwC1D0 -> ../../devices/pci0000:00/0000:00:1e.0/0000:06:0d.0/Audigy2/hwC1D0
> |-- midi1 -> ../../devices/pci0000:00/0000:00:1e.0/0000:06:0d.0/Audigy2/midi1
> |-- midiC1D0 -> ../../devices/pci0000:00/0000:00:1e.0/0000:06:0d.0/Audigy2/midiC1D0
> |-- midiC1D1 -> ../../devices/pci0000:00/0000:00:1e.0/0000:06:0d.0/Audigy2/midiC1D1
> |-- pcmC1D0c -> ../../devices/pci0000:00/0000:00:1e.0/0000:06:0d.0/Audigy2/pcmC1D0c
> |-- pcmC1D0p -> ../../devices/pci0000:00/0000:00:1e.0/0000:06:0d.0/Audigy2/pcmC1D0p
> |-- pcmC1D1c -> ../../devices/pci0000:00/0000:00:1e.0/0000:06:0d.0/Audigy2/pcmC1D1c
> |-- pcmC1D2c -> ../../devices/pci0000:00/0000:00:1e.0/0000:06:0d.0/Audigy2/pcmC1D2c
> |-- pcmC1D2p -> ../../devices/pci0000:00/0000:00:1e.0/0000:06:0d.0/Audigy2/pcmC1D2p
> |-- pcmC1D3p -> ../../devices/pci0000:00/0000:00:1e.0/0000:06:0d.0/Audigy2/pcmC1D3p
> |-- pcmC1D4c -> ../../devices/pci0000:00/0000:00:1e.0/0000:06:0d.0/Audigy2/pcmC1D4c
> |-- pcmC1D4p -> ../../devices/pci0000:00/0000:00:1e.0/0000:06:0d.0/Audigy2/pcmC1D4p
> `-- timer -> ../../devices/virtual/sound/timer
>
>
> Yeah, I picked the wrong name for the card, it should be "card1" instead
> of "Audigy2" here, but you get the idea.

That looks nice. Yeah, it should something that matches to the C1 in the
other names.

> Please also note that you will need the latest versions of udev to get
> this to work properly for your sysfs nodes.

This should be fine for all recent releases including SLE.

Thanks,
Kay

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/