Bug 101973

Summary: Selection of a card profile does not correctly set card's input
Product: PulseAudio Reporter: Denis Shulyaka <Shulyaka>
Component: alsaAssignee: pulseaudio-bugs
Status: RESOLVED FIXED QA Contact: pulseaudio-bugs
Severity: normal    
Priority: medium CC: lennart
Version: unspecified   
Hardware: ARM   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Denis Shulyaka 2017-07-30 19:10:17 UTC
Hi,

Short: I can't configure PA by setting card profile to record from SPDIF-In instead of analog input.

Long:
I have a USB sound card reported by lsusb as "0d8c:0102 C-Media Electronics, Inc. CM106 Like Sound Device". The card has several input sources, which can be managed by alsa:

[root@speaker ~]# amixer -c 2 get 'PCM Capture Source'
Simple mixer control 'PCM Capture Source',0
  Capabilities: enum
  Items: 'Mic' 'Line' 'IEC958 In' 'Mixer'
  Item0: 'IEC958 In'

Pulseaudio lists two input sources with 'pactl list cards' command (input:analog-stereo and input:iec958-stereo), however selection of the card profile always reset this to Mic:

[root@speaker ~]# amixer -c 2 set 'PCM Capture Source' 'IEC958 In'
Simple mixer control 'PCM Capture Source',0
  Capabilities: enum
  Items: 'Mic' 'Line' 'IEC958 In' 'Mixer'
  Item0: 'IEC958 In'
[root@speaker ~]# pactl set-card-profile 0 output:analog-surround-51+input:analog-stereo
[root@speaker ~]# amixer -c 2 get 'PCM Capture Source'
Simple mixer control 'PCM Capture Source',0
  Capabilities: enum
  Items: 'Mic' 'Line' 'IEC958 In' 'Mixer'
  Item0: 'Mic'
[root@speaker ~]# pactl set-card-profile 0 output:analog-surround-51+input:iec958-stereo
[root@speaker ~]# amixer -c 2 get 'PCM Capture Source'
Simple mixer control 'PCM Capture Source',0
  Capabilities: enum
  Items: 'Mic' 'Line' 'IEC958 In' 'Mixer'
  Item0: 'Mic'
[root@speaker ~]# pulseaudio --version
pulseaudio 10.0

I can also confirm by listening that after setting the card profile to "output:analog-surround-51+input:iec958-stereo" the parecord command still records from analog input instead of SPDIF, unless I reconfigure it again with amixer.
Comment 1 Tanu Kaskinen 2017-08-03 06:21:54 UTC
Hmm, the profile configuration references path iec958-stereo-input, but that path doesn't actually exist (in form of a configuration file).

Can you try creating /usr/share/pulseaudio/alsa-mixer/paths/iec958-stereo-input.conf with the following contents:

[Element PCM Capture Source]
enumeration = select

[Option PCM Capture Source:IEC958 In]
name = iec958-input
Comment 2 Denis Shulyaka 2017-08-03 19:39:19 UTC
Hi Tanu,

Thank you for the response.
Yes, that fixes the problem.

Best regards,
Denis Shulyaka
Comment 3 Tanu Kaskinen 2017-08-04 08:23:19 UTC
Thanks for testing! I sent a patch to the mailing list now:
https://patchwork.freedesktop.org/patch/170317/
Comment 4 Tanu Kaskinen 2017-08-04 10:51:27 UTC
I pushed the patch to the "next" branch now. Closing bug.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.