On Sat, Apr 17, 2021 at 07:18:31AM +0700, Robert Elz wrote: > Is it practical to use audiocfg that way, as the likely commands > (most likely only reasonable commands) to use in /etc/audio.conf > are "set" and "default", and both of those control a device > specified by a numeric index, which seems to be something that the > kerel assigns semi-arbitrarily at boot time ? > > I think audiocfg would need to grow commands to allow the device > to be specified by name, rather than by index, for this to be > practical. > > Or perhaps have this script accept the devices by name, convert the > name to index using the output of "audiocfg index" and then use the
The existing mixerctl rc script uses the same kernel-provided device IDs, but works by saving device-specific settings on shutdown and reading them on boot for each device, so might be safer. We could do this, since I think the "default" command has less value anyway. We could also adjust audiocfg(1) to generate IDs in a more reproducible way. I think this is a good idea, but I'm not really sure how to proceed. Maybe hashing the contents of struct audio_device would be possible, but we'd need to make sure no drivers would return dplicates if you have two of the same sound card.