Dne 13. 02. 19 v 15:13 sylvain.bertrand@gmail.com napsal(a):
On Wed, Feb 13, 2019 at 07:25:13AM +0100, Takashi Iwai wrote:
It's only the matter of alsa-lib card config. Just due to heuristic reason, the secondary device is assigned as iec958 as default. There are explicit whitelist setup in alsa-lib/src/conf/cards/USB-Audio.conf for the card that behave differently. You'd need to adjust accordingly.
Tell me if I did understand you right:
I cannot trust the hint system to select proper pcm devices for, let's say the mic of my USB cam.
As Takashi noted, we can fix this for your device in the alsa-lib's configuration file to not show the extra invalid surround devices, but it does not mean that the other USB devices are not affected. We are always a little bit behind the hardware. The library does not do any probing for the available channels when the devices are enumerated.
I would have to ignore "mostly" the configuration system (the major exception would be the default pcm device) and build myself the pcm devices from the info I can get from the hardware device (hardware mixing, input and/or output, number of channels/etc).
I would have to cherry pick configuration defined pcm devices for specific modes, like surroundX, only if the "basic user" explicitely requests such modes.
The advanced user should override the default pcm device if he/she wants to do/fix tricky sound thingies.
To summarize:
- show always the pcm default
- build custom pcm devices based on hardware info, and show them
- for "special" modes, likes surroundX, show the related configuration defined pcm devices only if the "basic" user want to fool around with them.
This is not optimal. It would be better to settle something in the one place. I would start to fix the blacklists in /usr/share/alsa/cards/USB-Audio.conf for your device (and post the alsa-lib's patch here).
Perhaps the USB driver might forward also more hints/parameters about the device characteristics to improve this hint system.
Jaroslav