[pulseaudio-discuss] Soundcard devices detection problem

piotrek.kuzio piotrek.kuzio at poczta.onet.pl
Fri Feb 15 09:45:20 UTC 2019


Hello,
 
Assume my 2 weeks experience around pulseaudio and sound system in Linux. 
My group try to adapt specialized USB soundcard pre-prototype built temporarily on Arduino (only registration part, no real audio processing so far).
In order to overcome some issues not relevant to this topic we decided to build soudcard that consists of 3 devices as presented below:
 
device 1: 4 outputs, 2 inputs
device 2: 4 outputs, 1 input
device 3: 2 inputs
 
We see them correctly detected on Windows. On linux (CentOS 7) we see them as follows:
 
cat /proc/asound/cards
 
 0 [PCH            ]: HDA-Intel - HDA Intel PCH
                      HDA Intel PCH at 0xd4730000 irq 35
-> 1 [Leonardo       ]: USB-Audio - Arduino Leonardo
                      Arduino LLC Arduino Leonardo at usb-0000:00:1a.0-1.2, full speed
 
ls /proc/asound/card1/
 
id  pcm0c  pcm0p  pcm1c  pcm1p  pcm2c  stream0  stream1  stream2  usbbus  usbid  usbmixer
 
cat /proc/asound/card1/stream0
 
 Arduino LLC Arduino Leonardo at usb-0000:00:1a.0-1.2, full speed : USB Audio
 
Playback:
  Status: Running
...
    Format: S16_LE
    Channels: 4
    Endpoint: 10 OUT (NONE)
    Rates: 8000
 
Capture:
  Status: Running
...
    Format: S16_LE
    Channels: 2
    Endpoint: 7 IN (NONE)
    Rates: 8000
 
cat /proc/asound/card1/stream1
 Playback:
  Status: Running
....
    Format: S16_LE
    Channels: 4
    Endpoint: 11 OUT (NONE)
    Rates: 8000
 
Capture:
  Status: Running
...
    Format: S16_LE
    Channels: 1
    Endpoint: 8 IN (NONE)
 
cat /proc/asound/card1/stream2
 Capture:
  Status: Running
...
    Format: S16_LE
    Channels: 2
    Endpoint: 9 IN (NONE)
    Rates: 8000
 
However, default linux behavior is to present only device #1. There are missing devices 2 and 3 - seems like not detected or configured by pulseaudio. Pavucontrol shows only single device with 4 outputs and stereo inputs.
 
If I run commands: 
    pacmd load-module module-alsa-sink device=hw:1,1
    pacmd load-module module-alsa-source device=hw:1,1
    pacmd load-module module-alsa-source device=hw:1,2
 
pavucontrol will show missing devices. Seems good, but this is USB device. After reconnecting I have to run commands again and even adding them to /etc/pulse/default.pa is not working for this scenario.
So, I tried to automate this by udev rules and running bash script, but it looks like wrong method. 
 
I created rule /usr/lib/udev/rules.d/99-pulseaudio-myrule.rules:
ACTION=="change", SUBSYSTEM=="sound", ATTRS{id}=="Leonardo", RUN+="/root/myscript.sh &"
 
Scripts executes missing 3 commands, but it looks that soundcard is not detected (loaded) by pulseaudio and device #1 is not added:
 
Compare manual adding (w/o udev) vs automated by udev:
MANUAL:
pactl list modules short
...
288     module-alsa-card        device_id="1" name="usb-Arduino_LLC_Arduino_Leonardo-03-Leonardo" card_name="alsa_card.usb-Arduino_LLC_Arduino_Leonardo-03-Leonardo" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes card_properties="module-udev-detect.discovered=1"
289     module-alsa-sink        device=hw:1,1
290     module-alsa-source      device=hw:1,2
291     module-alsa-source      device=hw:1,1
 
AUTOMATED:
pactl list modules short
...
<no soundcard !>
285     module-alsa-sink        device=hw:1,1
286     module-alsa-source      device=hw:1,1
287     module-alsa-source      device=hw:1,2
 
What is interesting - when I unload sink and sources by:
    pactl unload-module module-alsa-sink
    pactl unload-module module-alsa-source
 
soundcard is automatically detected and appears after "pactl list modules"
 
Can you help me understand proper way to configure this soundcard to be fully visible by pulseaudio?
 
Thank you,
Piotrek
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20190215/3833f261/attachment.html>


More information about the pulseaudio-discuss mailing list