Re: [ANNOUNCE] ndevfs - a "nano" devfs

From: Jim Crilly
Date: Tue Jun 28 2005 - 19:07:33 EST


On 06/28/05 03:23:18PM -0700, Mike Bell wrote:
> On Tue, Jun 28, 2005 at 05:49:29PM -0400, Jim Crilly wrote:
> > I took a quick look and for OSS devices linphone seems to just loop over
> > /dev/dsp* so if the names were moved, I doubt it would work.
> >
> > But it also seems to have ALSA support and in that case it uses
> > snd_card_get_name in a for loop to build a list of available cards, since
> > all ALSA functions use card index numbers they should work fine independent
> > of device file names.
>
> No, they shouldn't. Try it and see. Yes, your /program/ uses the sound
> card index, but that's because the ALSA library internally assumes that
> sound card index 0 corresponds to certain device nodes.

I stand corrected then. I didn't actually try anything with linphone, the
ALSA API just makes it look like the device nodes don't matter.

>
> Eventually every program has to be able to find the device node. That's
> just obvious, if you don't need the device node why have it in the first
> place? And if it can't predict what that device node will be named, the
> only thing it can do (short of creating its own private device node,
> which breaks all sorts of stuff /and/ is dumb /and/ doesn't work unless
> you're root) is search over every single device node in /dev to find the
> one with the correct major/minor. Or ask the user to type it in
> manually, which is all well and good for maybe an admin configuring some
> system, but is completely broken for anything GUI or automatic.
>
> Hence my conclusion, predictable device file names are a requirement.
> udev's "name the device whatever you want" works fine for running vi on
> /etc/fstab, but when you want a program to do anything intelligent like
> present a list of available choices, you need to be able to find the
> device node.

Well it looks like the ALSA library already abstracts the device node
enough that the app itself doesn't know what file is being used because it
just calls snd_card_get_name, snd_open_pcm, etc with the ALSA index. So
wouldn't it be feasible to make ALSA a little bit smarter so that it could
track/find the device nodes no matter what name they have? I'm not
advocating for or against it, but from my cursory look at the API it looks
possible to do without breaking any ALSA apps.

Jim.
-
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/