Using PULSE_NAME to override USB audio card names

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

 



On Thu, Sep 7, 2017 at 5:00 AM, Tanu Kaskinen <tanuk at iki.fi> wrote:
> On Wed, 2017-09-06 at 14:34 -0700, Lucas Rangit Magasweran wrote:
>> Hello devs,
>>
>> Is it okay to use PULSE_NAME in a udev rule to override the card name
>> used by PulseAudio? PULSE_NAME is used by
>> `module-udev-detect.c:card_change()` but is undocumented.
>>
>> I found this solution when I needed a way to override the USB audio
>> card name created by udev (e.g. ID_ID). Because it contains the USB
>> device serial number in the name it is not possible to write a general
>> `pacmd <card_name>` that works for all units.
>
> I'm curious, why do you need the same pacmd command work for multiple
> sounds cards? The purpose of any identifier is to distinguish between
> instances, after all...

I'm configuring PulseAudio (default.pa) to set the default source for a
custom USB microphone so I needed a card name that didn't include its
serial number. Since wildcards are not supported I would have had to
include a line for every possible serial number. Like this for example:

$ cat .config/pulse/default.pa
.include /etc/pulse/default.pa

.nofail

set-default-source alsa_input.usb-My_USB_Mic_0001-00.analog-stereo
set-default-source alsa_input.usb-My_USB_Mic_0002-00.analog-stereo
set-default-source alsa_input.usb-My_USB_Mic_0003-00.analog-stereo
# etc...

.fail

Also, I found that the microphone would not always capture until it was
toggled (deselected then selected) manually in the OS sound control
panel or if it was set as the default source.

>> Below is the udev rule I created. It works but I'm wondering if there
>> are side effects to no longer having unique card names or not having
>> the ID_ID udev property. I tested having multiple identical (except
>> the serial number) USB sound cards attached and they work
>> simultaneously.
>
> If the cards work simultaneously, surely they have different names, so
> you're back to square one? It's not possible to have two cards with the
> same name.

You are correct. I didn't look carefully. I see PulseAudio appends a ".2" to
the second sound card with the same name. This works for my purpose
since I only care about the first identical USB microphone attached and
ensures the card names are unique for PulseAudio.

Thanks for sharing your expertise and maintaining PulseAudio!

Lucas


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

  Powered by Linux