Naming USB card sources with same vendor/product/serial id

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm replying to myself for others that may have this issue in the future.

I've looked at the pulseaudio source and found a solution, It can be done
with udev, here is a complete udev rules file to make it happen.

https://gist.github.com/mpaolino/91c3587045fa8d1a9353b74bf102c83b

Any comments/improvements are welcome.

On Tue, Nov 29, 2016 at 6:20 PM, Miguel Paolino <mpaolino at gmail.com> wrote:

> Hi all,
>
> I have several USB cards, cheap ones, all have the same vendor, product
> and serial id. The cards are all assigned different names using udev rules
> based on the usb port they are plugged in.
>
> $ cat /proc/asound/cards:
>
> ...
>
>  1 [MyCard1     ]: USB-Audio - USB Audio Device
>                       GeneralPlus USB Audio Device at
> usb-0000:00:1d.0-1.3.5, full speed
>  2 [MyCard2     ]: USB-Audio - USB Audio Device
>                       GeneralPlus USB Audio Device at
> usb-0000:00:1d.0-1.3.7, full speed
>
>
> The problem I'm having is that I cannot get a reliable config that allows
> me to name and use the sources of these cards with libpulseaudio. If I use
> module-udev card and source naming depends on the order they are plugged in
> like:
>
> alsa_input.usb-GeneralPlus_USB_Audio_Device-00.analog-mono.0
> alsa_input.usb-GeneralPlus_USB_Audio_Device-00.analog-mono.2
>
> The closest I could get was configuring the sources statically using
> module-alsa-source naming them with the 'name' argument and using
> device=hw:MyCard[1,2].
> This works but the problem is if I unplug one of the cards and I need to
> plug it again and restart pulseaudio because the moment the card is
> unplugged pulseaudio unloads the module. The only way to get it working
> again is restarting, and if I don't plug the card back pulseaudio refuses
> to start because the system is missing a card that's in the config. This
> of course have the additional and most important inconvenience of
> cancelling any audio capture I might be doing using the other cards.
>
> I tried all sorts of things with udev trying to accomplish this using only
> module-udev and I failed miserably.
>
> Is there a way to accomplish what I want?
>
> I'm using:
>
> pulseaudio 9.0
> udev 231
> kernel 4.8.0
>
> Thanks!
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20161130/1013834a/attachment.html>


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux