Bug 90781 - Microphone is visible by ALSA, but not recognized by PulseAudio
Summary: Microphone is visible by ALSA, but not recognized by PulseAudio
Status: RESOLVED FIXED
Alias: None
Product: PulseAudio
Classification: Unclassified
Component: misc (show other bugs)
Version: unspecified
Hardware: Other Linux (All)
: medium normal
Assignee: pulseaudio-bugs
QA Contact: pulseaudio-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-30 10:50 UTC by Nazar Mokrynskyi
Modified: 2015-06-26 02:13 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Nazar Mokrynskyi 2015-05-30 10:50:57 UTC
I have USB sound card Creative SoundBlaster Omni Surround 5.1.
ALSA seems to see it's microphone:
nazar-pc@nazar-pc ~>  arecord --list-devices
**** Список CAPTURE пристроїв ****
картка 1: PCH [HDA Intel PCH], пристрій 0: ALC892 Analog [ALC892 Analog]
  Підприлади: 1/1
  Підприлад #0: subdevice #0
картка 1: PCH [HDA Intel PCH], пристрій 2: ALC892 Alt Analog [ALC892 Alt Analog]
  Підприлади: 1/1
  Підприлад #0: subdevice #0
картка 2: U0x47f0xad01 [USB Device 0x47f:0xad01], пристрій 0: USB Audio [USB Audio]
  Підприлади: 0/1
  Підприлад #0: subdevice #0
картка 3: S51 [SB Omni Surround 5.1], пристрій 1: USB Audio [USB Audio #1]
  Підприлади: 1/1
  Підприлад #0: subdevice #0

But PulseAudio doesn't. I'm on Ubuntu 15.10 x64

`lsusb -v` also mentioning Mic support:
...
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID            10
        wTerminalType      0x0201 Microphone
        bAssocTerminal          0
        bNrChannels             2
        wChannelConfig     0x0003
          Left Front (L)
          Right Front (R)
        iChannelNames           0 
        iTerminal               0 
...
Comment 1 Nazar Mokrynskyi 2015-05-30 11:26:53 UTC
I've added:

load-module module-alsa-source device=hw:3,1

Into /etc/puse/default.pa before line:
.ifexists module-udev-detect.so

And microphone appears in Pulseaudio and works fine.

Any chance to make this working out of the box?
Comment 2 Raymond 2015-05-30 12:15:13 UTC
you have to post output of alsa-info.sh

and pulseaudio verbose log in order to find out why there is no pulseaudio source
Comment 3 Nazar Mokrynskyi 2015-05-30 13:02:30 UTC
Here is alsa-info.sh: http://www.alsa-project.org/db/?f=383a06006246483550e8bd94edf4d2ccba9bdcdb

And verbose log: http://pastebin.com/gqmakZ3f

I've removed my edits from /etc/puse/default.pa in order to provide clean output
Comment 4 Raymond 2015-05-30 16:22:36 UTC
 
card 2: S51 [SB Omni Surround 5.1], device 1: USB Audio [USB Audio #1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

seem capture device id device 1 instead of device 0



http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/conf/cards/USB-Audio.conf;hb=HEAD


You need to define your sound card in USB-Audio.conf

seem use full name instead of S51

USB-Audio."S51".pcm.front {
           @args [ CARD ]
          @args.CARD { type string }
           type asym
          playback.pcm {
                 
                          type hw
                          card $CARD
                          device 0
                
          }
          capture.pcm {

                          type hw
                          card $CARD
                          device 1
                  
        }


hw:2 'S51'/'Creative Technology Ltd SB Omni Surround 5.1 at usb-0000:00:14.0-6.2, full spee'
  Mixer name	: 'USB Mixer'
  Components	: 'USB041e:322c'
  Controls      : 12
  Simple ctrls  : 5
Simple mixer control 'PCM',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 128
  Mono: Playback 91 [71%] [-18.50dB] [on]
Simple mixer control 'PCM Capture Source',0
  Capabilities: enum
  Items: 'Mic' 'Line'
  Item0: 'Mic'
Simple mixer control 'Line',0
  Capabilities: cvolume cswitch cswitch-joined
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 48
  Front Left: Capture 24 [50%] [0.00dB] [on]
  Front Right: Capture 24 [50%] [0.00dB] [on]
Simple mixer control 'Mic',0
  Capabilities: cvolume cswitch cswitch-joined
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 48
  Front Left: Capture 24 [50%] [0.00dB] [on]
  Front Right: Capture 24 [50%] [0.00dB] [on]
Simple mixer control 'Auto Gain Control',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]










(   0.072|   0.000) D: [pulseaudio] alsa-mixer.c: Looking at profile input:analog-mono

(   0.072|   0.000) D: [pulseaudio] alsa-mixer.c: Checking for recording on Analog Mono (analog-mono)

(   0.072|   0.000) D: [pulseaudio] alsa-util.c: Trying hw:2 with SND_PCM_NO_AUTO_FORMAT ...

(   0.072|   0.000) I: [pulseaudio] (alsa-lib)pcm_hw.c: open '/dev/snd/pcmC2D0c' failed (-2)

(   0.072|   0.000) I: [pulseaudio] alsa-util.c: Error opening PCM device hw:2: No such file or directory

(   0.072|   0.000) D: [pulseaudio] alsa-mixer.c: Caching failure to open input:analog-mono

(   0.072|   0.000) D: [pulseaudio] alsa-mixer.c: Looking at profile input:analog-stereo

(   0.072|   0.000) D: [pulseaudio] alsa-mixer.c: Checking for recording on Analog Stereo (analog-stereo)

(   0.072|   0.000) D: [pulseaudio] alsa-util.c: Trying front:2 with SND_PCM_NO_AUTO_FORMAT ...

(   0.072|   0.000) I: [pulseaudio] (alsa-lib)pcm_hw.c: open '/dev/snd/pcmC2D0c' failed (-2)

(   0.072|   0.000) I: [pulseaudio] alsa-util.c: Error opening PCM device front:2: No such file or directory

(   0.072|   0.000) D: [pulseaudio] alsa-util.c: Trying hw:2 with SND_PCM_NO_AUTO_FORMAT ...

(   0.073|   0.000) I: [pulseaudio] (alsa-lib)pcm_hw.c: open '/dev/snd/pcmC2D0c' failed (-2)

(   0.073|   0.000) I: [pulseaudio] alsa-util.c: Error opening PCM device hw:2: No such file or directory

(   0.073|   0.000) D: [pulseaudio] alsa-mixer.c: Caching failure to open input:analog-stereo
Comment 5 Raymond 2015-05-30 16:22:53 UTC
 
card 2: S51 [SB Omni Surround 5.1], device 1: USB Audio [USB Audio #1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

seem capture device id device 1 instead of device 0



http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/conf/cards/USB-Audio.conf;hb=HEAD


You need to define your sound card in USB-Audio.conf

seem use full name instead of S51

USB-Audio."S51".pcm.front {
           @args [ CARD ]
          @args.CARD { type string }
           type asym
          playback.pcm {
                 
                          type hw
                          card $CARD
                          device 0
                
          }
          capture.pcm {

                          type hw
                          card $CARD
                          device 1
                  
        }


hw:2 'S51'/'Creative Technology Ltd SB Omni Surround 5.1 at usb-0000:00:14.0-6.2, full spee'
  Mixer name	: 'USB Mixer'
  Components	: 'USB041e:322c'
  Controls      : 12
  Simple ctrls  : 5
Simple mixer control 'PCM',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 128
  Mono: Playback 91 [71%] [-18.50dB] [on]
Simple mixer control 'PCM Capture Source',0
  Capabilities: enum
  Items: 'Mic' 'Line'
  Item0: 'Mic'
Simple mixer control 'Line',0
  Capabilities: cvolume cswitch cswitch-joined
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 48
  Front Left: Capture 24 [50%] [0.00dB] [on]
  Front Right: Capture 24 [50%] [0.00dB] [on]
Simple mixer control 'Mic',0
  Capabilities: cvolume cswitch cswitch-joined
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 48
  Front Left: Capture 24 [50%] [0.00dB] [on]
  Front Right: Capture 24 [50%] [0.00dB] [on]
Simple mixer control 'Auto Gain Control',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]










(   0.072|   0.000) D: [pulseaudio] alsa-mixer.c: Looking at profile input:analog-mono

(   0.072|   0.000) D: [pulseaudio] alsa-mixer.c: Checking for recording on Analog Mono (analog-mono)

(   0.072|   0.000) D: [pulseaudio] alsa-util.c: Trying hw:2 with SND_PCM_NO_AUTO_FORMAT ...

(   0.072|   0.000) I: [pulseaudio] (alsa-lib)pcm_hw.c: open '/dev/snd/pcmC2D0c' failed (-2)

(   0.072|   0.000) I: [pulseaudio] alsa-util.c: Error opening PCM device hw:2: No such file or directory

(   0.072|   0.000) D: [pulseaudio] alsa-mixer.c: Caching failure to open input:analog-mono

(   0.072|   0.000) D: [pulseaudio] alsa-mixer.c: Looking at profile input:analog-stereo

(   0.072|   0.000) D: [pulseaudio] alsa-mixer.c: Checking for recording on Analog Stereo (analog-stereo)

(   0.072|   0.000) D: [pulseaudio] alsa-util.c: Trying front:2 with SND_PCM_NO_AUTO_FORMAT ...

(   0.072|   0.000) I: [pulseaudio] (alsa-lib)pcm_hw.c: open '/dev/snd/pcmC2D0c' failed (-2)

(   0.072|   0.000) I: [pulseaudio] alsa-util.c: Error opening PCM device front:2: No such file or directory

(   0.072|   0.000) D: [pulseaudio] alsa-util.c: Trying hw:2 with SND_PCM_NO_AUTO_FORMAT ...

(   0.073|   0.000) I: [pulseaudio] (alsa-lib)pcm_hw.c: open '/dev/snd/pcmC2D0c' failed (-2)

(   0.073|   0.000) I: [pulseaudio] alsa-util.c: Error opening PCM device hw:2: No such file or directory

(   0.073|   0.000) D: [pulseaudio] alsa-mixer.c: Caching failure to open input:analog-stereo
Comment 6 Nazar Mokrynskyi 2015-05-30 16:57:26 UTC
I've appended

USB-Audio."S51".pcm.front {
       @args [ CARD ]
      @args.CARD { type string }
       type asym
      playback.pcm {
             
                      type hw
                      card $CARD
                      device 0
            
      }
      capture.pcm {

                      type hw
                      card $CARD
                      device 1
              
    }
}

to the end of /usr/share/alsa/cards/USB-Audio.conf, but it doesn't change anything (applied `sudo alsa force-reload && sudo service pulseaudio restart && pulseaudio --kill && pulseaudio --start`).
Comment 7 Raymond 2015-06-01 03:59:27 UTC
Try 

arecord -Dplughw:CARD=S51,1 -f CD  test.wav

USB-Audio." SB Omni Surround 5.1 ".pcm.front {
           @args [ CARD ]
          @args.CARD { type string }
           type asym
          playback.pcm {
                 
                          type hw
                          card $CARD
                          device 0
                
          }
          capture.pcm {

                          type hw
                          card $CARD
                          device 1
                  
        }
Comment 8 Nazar Mokrynskyi 2015-06-01 08:29:15 UTC
With this command:

arecord -Dplughw:CARD=S51,1 -f CD  test.wav

Sound is recorded properly.

However:

USB-Audio."SB Omni Surround 5.1".pcm.front {
           @args [ CARD ]
          @args.CARD { type string }
           type asym
          playback.pcm {

                          type hw
                          card $CARD
                          device 0

          }
          capture.pcm {

                          type hw
                          card $CARD
                          device 1

        }
}

and many other variations I've tried doesn't help.

I do not quite understand why there is a need to edit ALSA's file, since it records sound properly out of the box, the problem seems to be inside PulseAudio which doesn't see the output.
In alsamixer I can even switch between Line and Mic for <PCM Capture Source> and both work properly with line added to /etc/puse/default.pa
Comment 9 Raymond 2015-06-01 11:32:43 UTC
http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/profile-sets


you can define a conf file which contain sterero surround51 playback and sterei capture uding device 1 and add your usb id in 90-pulseaudio.rules
Comment 10 Nazar Mokrynskyi 2015-06-01 16:07:00 UTC
I'm not familiar with PulseAudio so that it would be possible for me to do by myself.
Any extensive documentation about syntax of that files or additional hints (I've searched but didn't found any)?
When solution found it should be ideally fixed upstream as well.
Comment 11 Raymond 2015-06-01 16:12:41 UTC
[General]
auto-profiles = no

[Mapping analog-stereo-output]
description = Analog Stereo Output
device-strings = hw:%f,0,0
channel-map = left,right
skip-probe = yes

[Mapping analog-surround-51]
device-strings = surround51:%f
channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe
paths-output = analog-output analog-output-lineout analog-output-speaker
priority = 8
direction = output
skip-probe = yes

[Mapping analog-stereo-input]
description = Analog Stereo
device-strings = hw:%f,0,1
channel-map = left,right
direction = input
skip-probe = yes
Comment 12 Raymond 2015-06-01 16:19:39 UTC
it is rather stange that snd-usb-audio create device 1

post the output of 

lsusb -vvvv


you need to ask alsa developet what is the correct name to define front device as 1 for your usb sound card

i.e.

arecord -Dfront:CARD=S51 -f CD test.wav
Comment 13 Raymond 2015-06-01 16:21:07 UTC
should be


[Mapping analog-stereo-input]
description = Analog Stereo
device-strings = hw:%f,1,0
channel-map = left,right
direction = input
skip-probe = yes
Comment 14 Raymond 2015-06-01 16:31:56 UTC
ATTRS{idVendor}=="041e", ATTRS{idProduct}=="322c", ENV{PULSE_PROFILE_SET}=" sb-omni-surround-51.conf"
Comment 15 Nazar Mokrynskyi 2015-06-01 17:07:11 UTC
Here is lsusb output relevant to this sound card: http://pastebin.com/Ts0Qn89s

I've made some progress by customizing default.conf (copied into new file, of course), with block:

[Mapping analog-stereo-input]
device-strings = hw:%f,1,0
paths-input = analog-input analog-input-mic analog-input-linein
channel-map = left,right
direction = input

I see Line in and Mic, but both work as Mic, need to separate them.
Comment 16 Nazar Mokrynskyi 2015-06-01 17:09:31 UTC
Behavior is changed into opposite when changing <PCM Capture Source> to Line in alsamixer. How to fix this, having Line in and Mic separately and working as expected?
Comment 17 Nazar Mokrynskyi 2015-06-01 18:46:16 UTC
I wanted to try to push patch to mailing list, but before that I want to fix Line in somehow.

Sound card have 3 inputs. Mon microphone and stereo Line in. However, currently I can't use them both because I need to switch <PCM Capture Source> in alsamixer and though both of them appear in sound control menu they both are working either as Mic of Line in.

Now the question is how to explain ALSA that they are 2 different inputs, one Mono Mic and another Stereo Line In?

BTW, I can't find list of possible values for paths-input, channel-map and other keys.
Comment 18 Raymond 2015-06-02 01:04:28 UTC

Simple mixer control 'PCM Capture Source',0
  Capabilities: enum
  Items: 'Mic' 'Line'
  Item0: 'Mic'

http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/paths/analog-input.conf.common

you have to add [Element PCM Capture] , [Option PCM Capture Source:Mic] and [Option PCM Capture Source:Line] to above conf
Comment 19 Raymond 2015-06-02 01:13:47 UTC
      AudioControl Interface Descriptor:

        bLength                12

        bDescriptorType        36

        bDescriptorSubtype      2 (INPUT_TERMINAL)

        bTerminalID             4

        wTerminalType      0x0101 USB Streaming

        bAssocTerminal          0

        bNrChannels             2

        wChannelConfig     0x0003

          Left Front (L)

          Right Front (R)

        iChannelNames           0 

        iTerminal               0 

      AudioControl Interface Descriptor:

        bLength                 9

        bDescriptorType        36

        bDescriptorSubtype      3 (OUTPUT_TERMINAL)

        bTerminalID             6

        wTerminalType      0x0602 Digital Audio Interface

        bAssocTerminal          0

        bSourceID               4

        iTerminal               0



you have to ask alsa developer how to define digital out if it is not using device zero



http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;h=a9b1299556598fed12d0d42c80aaa933aced8a42;hp=efda3e2bc766b4147f35f4b006d315ea7b3c55fe
Comment 20 Raymond 2015-06-02 01:14:00 UTC
      AudioControl Interface Descriptor:

        bLength                12

        bDescriptorType        36

        bDescriptorSubtype      2 (INPUT_TERMINAL)

        bTerminalID             4

        wTerminalType      0x0101 USB Streaming

        bAssocTerminal          0

        bNrChannels             2

        wChannelConfig     0x0003

          Left Front (L)

          Right Front (R)

        iChannelNames           0 

        iTerminal               0 

      AudioControl Interface Descriptor:

        bLength                 9

        bDescriptorType        36

        bDescriptorSubtype      3 (OUTPUT_TERMINAL)

        bTerminalID             6

        wTerminalType      0x0602 Digital Audio Interface

        bAssocTerminal          0

        bSourceID               4

        iTerminal               0



you have to ask alsa developer how to define digital out if it is not using device zero



http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;h=a9b1299556598fed12d0d42c80aaa933aced8a42;hp=efda3e2bc766b4147f35f4b006d315ea7b3c55fe
Comment 21 Raymond 2015-06-02 01:21:00 UTC
card 2: S51 [SB Omni Surround 5.1], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: S51 [SB Omni Surround 5.1], device 1: USB Audio [USB Audio #1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: S51 [SB Omni Surround 5.1], device 2: USB Audio [USB Audio #2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

what are the function of these three playback devices


aplay -D hw:CARD=S51,DEV=1  --dump-hw-params stereo.wav
aplay -D hw:CARD=S51,DEV=2  --dump-hw-params stereo.wav
Comment 22 Nazar Mokrynskyi 2015-06-02 01:28:03 UTC
This is 5.1 surround sound card, so 2 RCA (or headphones 3.5mm jack) for Front, one 3.5mm jack for Rear and one 3.5mm jack for Center/LFE.

I'm completely new to all this things, added:

[Element PCM Capture]
enumeration = select

[Option PCM Capture Source:Mic]
name = input-microphone

[Option PCM Capture Source:Line]
name = input-linein

to /usr/share/pulseaudio/alsa-mixer/paths/analog-input.conf.common - no changes, should I attach somehow to sound card in some other config?

sb-omni-surround-5.1.conf contains similar records, but they are a bit different anyway (input-microphone vs analog-input-mic), so that should be some other place.

About digital output - I'll leave it as now, it is detected, but I do not have any hardware to check whether S/PDIF works properly.
Comment 23 Nazar Mokrynskyi 2015-06-02 01:49:50 UTC
[Element PCM Capture Source]

Doesn't workeither
Comment 24 Nazar Mokrynskyi 2015-06-02 02:00:22 UTC
Please, take a look at screenshot: https://imgur.com/JiwQ4DI
Even though Line was captured, PCM Caprute Source is still Mic, I think this might be wrong and actually the reason why it works this way. It doesn't change real source when I choose it in UI.
Comment 25 Raymond 2015-06-02 08:01:05 UTC
how do your modified conf look like ?


paths-input should contain analog-mic and analog-linein
Comment 26 Raymond 2015-06-02 08:03:11 UTC
(In reply to Nazar Mokrynskyi from comment #24)
> Please, take a look at screenshot: https://imgur.com/JiwQ4DI
> Even though Line was captured, PCM Caprute Source is still Mic, I think this
> might be wrong and actually the reason why it works this way. It doesn't
> change real source when I choose it in UI.

pactl list sources
Comment 27 Raymond 2015-06-02 08:16:49 UTC
seem only support stereo capture


AudioControl Interface Descriptor:

        bLength                12

        bDescriptorType        36

        bDescriptorSubtype      2 (INPUT_TERMINAL)

        bTerminalID            10

        wTerminalType      0x0201 Microphone

        bAssocTerminal          0

        bNrChannels             2

        wChannelConfig     0x0003

          Left Front (L)

          Right Front (R)

        iChannelNames           0 

        iTerminal               0 

      AudioControl Interface Descriptor:

        bLength                10

        bDescriptorType        36

        bDescriptorSubtype      6 (FEATURE_UNIT)

        bUnitID                11

        bSourceID              10

        bControlSize            1

        bmaControls( 0)      0x41

          Mute Control

          Automatic Gain Control

        bmaControls( 1)      0x02

          Volume Control

        bmaControls( 2)      0x02

          Volume Control

        iFeature                0 

      AudioControl Interface Descriptor:

        bLength                12

        bDescriptorType        36

        bDescriptorSubtype      2 (INPUT_TERMINAL)

        bTerminalID            12

        wTerminalType      0x0603 Line Connector

        bAssocTerminal          0

        bNrChannels             2

        wChannelConfig     0x0003

          Left Front (L)

          Right Front (R)

        iChannelNames           0 

        iTerminal               0 

      AudioControl Interface Descriptor:

        bLength                10

        bDescriptorType        36

        bDescriptorSubtype      6 (FEATURE_UNIT)

        bUnitID                13

        bSourceID              12

        bControlSize            1

        bmaControls( 0)      0x01

          Mute Control

        bmaControls( 1)      0x02

          Volume Control

        bmaControls( 2)      0x02

          Volume Control

        iFeature                0 

      AudioControl Interface Descriptor:

        bLength                 8

        bDescriptorType        36

        bDescriptorSubtype      5 (SELECTOR_UNIT)

        bUnitID                16

        bNrInPins               2

        baSource( 0)           11

        baSource( 1)           13

        iSelector               0 

      AudioControl Interface Descriptor:

        bLength                 9

        bDescriptorType        36

        bDescriptorSubtype      3 (OUTPUT_TERMINAL)

        bTerminalID            17

        wTerminalType      0x0101 USB Streaming

        bAssocTerminal          0

        bSourceID              16

        iTerminal               0
Comment 28 Raymond 2015-06-02 08:53:37 UTC
seem support 5.1 playback 

AudioControl Interface Descriptor:

        bLength                12

        bDescriptorType        36

        bDescriptorSubtype      2 (INPUT_TERMINAL)

        bTerminalID             1

        wTerminalType      0x0101 USB Streaming

        bAssocTerminal          0

        bNrChannels             6

        wChannelConfig     0x003f

          Left Front (L)

          Right Front (R)

          Center Front (C)

          Low Freqency Enhancement (LFE)

          Left Surround (LS)

          Right Surround (RS)

        iChannelNames           0 

        iTerminal               0 

      AudioControl Interface Descriptor:

        bLength                14

        bDescriptorType        36

        bDescriptorSubtype      6 (FEATURE_UNIT)

        bUnitID                 2

        bSourceID               1

        bControlSize            1

        bmaControls( 0)      0x03

          Mute Control

          Volume Control

        bmaControls( 1)      0x00

        bmaControls( 2)      0x00

        bmaControls( 3)      0x00

        bmaControls( 4)      0x00

        bmaControls( 5)      0x00

        bmaControls( 6)      0x00

        iFeature                0 

      AudioControl Interface Descriptor:

        bLength                 9

        bDescriptorType        36

        bDescriptorSubtype      3 (OUTPUT_TERMINAL)

        bTerminalID             3

        wTerminalType      0x0301 Speaker

        bAssocTerminal          0

        bSourceID               2

        iTerminal               0
Comment 29 Raymond 2015-06-02 09:30:03 UTC
  Unit: 11
    Control: name="Mic Capture Volume", index=0
    Info: id=11, control=2, cmask=0x3, channels=2, type="S16"
    Volume: min=-3072, max=3072, dBmin=-1200, dBmax=1200
  Unit: 11
    Control: name="Mic Capture Switch", index=0
    Info: id=11, control=1, cmask=0x0, channels=1, type="INV_BOOLEAN"
    Volume: min=0, max=1, dBmin=0, dBmax=0
  Unit: 13
    Control: name="Line Capture Volume", index=0
    Info: id=13, control=2, cmask=0x3, channels=2, type="S16"
    Volume: min=-3072, max=3072, dBmin=-1200, dBmax=1200
  Unit: 13
    Control: name="Line Capture Switch", index=0
    Info: id=13, control=1, cmask=0x0, channels=1, type="INV_BOOLEAN"
    Volume: min=0, max=1, dBmin=0, dBmax=0

do  dB range match with pulseaudio paths in pulseaudio verbose log ?
Comment 30 Nazar Mokrynskyi 2015-06-02 12:07:25 UTC
There are 2 INPUT_TERMINAL connectors:
* Microphone
* Line Connector

> do  dB range match with pulseaudio paths in pulseaudio verbose log ?
I'm not sure how to check this, can't find it in verbose log.

analog-input.cong.common records doesn't seem to help, PCM Capture Source remains fixed and doesn't change except manually from alsamixer in any case.
Comment 31 Raymond 2015-06-02 13:02:24 UTC
you have to post pulseaudio to show how it find capture device 1 ?

pactl list sources
Comment 32 Nazar Mokrynskyi 2015-06-02 13:13:07 UTC
Here is relevant block of `pactl list sources` output: http://pastebin.com/eMCJkt8H
PulseAudio recognize that there are 2 ports:
* analog-input-mic
* analog-input-linein

But choosing one or another doesn't actually matter, they currently work as the same, only depending on PCM Capture Source setting in alsamixer.

Here is my current sb-omni-surround-5.1.conf contents: http://pastebin.com/kFeQzk0r
Comment 33 Raymond 2015-06-02 13:16:05 UTC
check your pulseaudio log for message similar to your onboard mic

   0.153|   0.000) D: [pulseaudio] alsa-mixer.c: Path analog-input-internal-mic (Internal Microphone), direction=2, priority=89, probed=yes, supported=yes, has_mute=yes, has_volume=yes, has_dB=yes, min_volume=0, max_volume=46, min_dB=-16, max_dB=60
Comment 34 Nazar Mokrynskyi 2015-06-02 13:26:42 UTC
Doesn't seem that range matches, fresh verbose log: http://pastebin.com/TaGeQ7fB
Comment 35 Raymond 2015-06-02 13:44:23 UTC
this look like alsa bug but why pulseaudio just ignore this fatal error


0.122|   0.000) D: [pulseaudio] alsa-util.c: Maximum hw buffer size is 3640 ms

(   0.123|   0.000) I: [pulseaudio] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_HW_PARAMS failed (-5)

(   0.123|   0.000) I: [pulseaudio] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_HW_PARAMS failed (-5)

(   0.123|   0.000) I: [pulseaudio] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_HW_PARAMS failed (-5)

(   0.124|   0.000) I: [pulseaudio] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_HW_PARAMS failed (-5)

(   0.124|   0.000) D: [pulseaudio] alsa-util.c: Set neither period nor buffer size.

(   0.124|   0.000) I: [pulseaudio] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_HW_PARAMS failed (-5)

(   0.124|   0.000) I: [pulseaudio] alsa-util.c: snd_pcm_hw_params failed: Input/output error

(   0.124|   0.000) D: [pulseaudio] alsa-util.c: Trying hw:2,1,0 without SND_PCM_NO_AUTO_FORMAT ...

(   0.125|   0.000) D: [pulseaudio] alsa-util.c: Managed to open hw:2,1,0

(   0.125|   0.000) I: [pulseaudio] alsa-util.c: Disabling tsched mode since BATCH flag is set

(   0.125|   0.000) D: [pulseaudio] alsa-util.c: Maximum hw buffer size is 3640 ms

(   0.125|   0.000) I: [pulseaudio] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_HW_PARAMS failed (-5)

(   0.125|   0.000) I: [pulseaudio] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_HW_PARAMS failed (-5)

(   0.126|   0.000) I: [pulseaudio] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_HW_PARAMS failed (-5)

(   0.126|   0.000) I: [pulseaudio] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_HW_PARAMS failed (-5)

(   0.126|   0.000) D: [pulseaudio] alsa-util.c: Set neither period nor buffer size.

(   0.127|   0.000) I: [pulseaudio] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_HW_PARAMS failed (-5)

(   0.127|   0.000) I: [pulseaudio] alsa-util.c: snd_pcm_hw_params failed: Input/output error
Comment 36 Raymond 2015-06-02 14:27:32 UTC
087|   0.000) D: [pulseaudio] alsa-mixer.c: Available mixer paths (after tidying):

(   0.087|   0.000) D: [pulseaudio] alsa-mixer.c: Path Set 0xe45c60, direction=2

(   0.087|   0.000) D: [pulseaudio] alsa-mixer.c: Path analog-input-mic (Microphone), direction=2, priority=87, probed=yes, supported=yes, has_mute=yes, has_volume=yes, has_dB=yes, min_volume=0, max_volume=48, min_dB=-12, max_dB=12

(   0.087|   0.000) D: [pulseaudio] alsa-mixer.c: Element Mic, direction=2, switch=1, volume=1, volume_limit=-1, enumeration=0, required=0, required_any=4, required_absent=0, mask=0x3600000000f66, n_channels=2, override_map=yes

(   0.087|   0.000) D: [pulseaudio] alsa-mixer.c: Element Line, direction=2, switch=2, volume=2, volume_limit=-1, enumeration=0, required=0, required_any=0, required_absent=0, mask=0x6, n_channels=2, override_map=no

(   0.087|   0.000) D: [pulseaudio] alsa-mixer.c: Jack Mic, alsa_name='Mic Jack', detection unavailable

(   0.087|   0.000) D: [pulseaudio] alsa-mixer.c: Jack Mic Phantom, alsa_name='Mic Phantom Jack', detection unavailable

(   0.087|   0.000) D: [pulseaudio] alsa-mixer.c: Path analog-input-linein (Line In), direction=2, priority=81, probed=yes, supported=yes, has_mute=yes, has_volume=yes, has_dB=yes, min_volume=0, max_volume=48, min_dB=-12, max_dB=12

(   0.087|   0.000) D: [pulseaudio] alsa-mixer.c: Element Line, direction=2, switch=1, volume=1, volume_limit=-1, enumeration=0, required=0, required_any=4, required_absent=0, mask=0x3600000000f66, n_channels=2, override_map=yes

(   0.087|   0.000) D: [pulseaudio] alsa-mixer.c: Element Mic, direction=2, switch=2, volume=2, volume_limit=-1, enumeration=0, required=0, required_any=0, required_absent=0, mask=0x6, n_channels=2, override_map=no

(   0.087|   0.000) D: [pulseaudio] alsa-mixer.c: Jack Line, alsa_name='Line Jack', detection unavailable

(   0.087|   0.000) D: [pulseaudio] alsa-mixer.c: Jack Line Phantom, alsa_name='Line Phantom Jack', detection unavailable

seem both paths are available
Comment 37 Raymond 2015-06-02 14:37:15 UTC
(In reply to Nazar Mokrynskyi from comment #32)
> Here is relevant block of `pactl list sources` output:
> http://pastebin.com/eMCJkt8H
> PulseAudio recognize that there are 2 ports:
> * analog-input-mic
> * analog-input-linein
> 
> But choosing one or another doesn't actually matter, they currently work as
> the same, only depending on PCM Capture Source setting in alsamixer.
> 
> Here is my current sb-omni-surround-5.1.conf contents:
> http://pastebin.com/kFeQzk0r

Did you add the following to analog-input-mic.conf

[Element PCM Capture Source]
enumeration = select

[Option PCM Capture Source:Mic]
name = analog-input-microphone
required-any = any

you also need to add similar to analog-input-linein.conf
Comment 38 Nazar Mokrynskyi 2015-06-02 15:07:10 UTC
Just tried all possible combinations - PCM Capture Source, just Capture Source, analog-input-microphone, analog-input-mic, input-microphone, the same for Line in - nothing changed.

I'm guessing here, can you say what is real connection and distinction between analog-input-mic from one file and input-microphone from another? I can't find any documentation for that, only some separate messages on forums without soutions.

All this seems to be a Black Magic available to few people in the whole world rather than something reliable and described in specification.
Comment 39 Raymond 2015-06-02 15:56:15 UTC
 in theory , pulseaudio should show the following during prob phase

D: [pulseaudio] alsa-mixer.c: Probe of element 'PCM Capture Source' succeeded (volume=0, switch=0, enumeration=1).

how about

 analog-input.conf.common ?
Comment 40 Nazar Mokrynskyi 2015-06-02 15:58:14 UTC
Already tried analog-input.conf.common as you suggested before with all possible combinations I was able to generate - no luck.
Comment 41 Raymond 2015-06-02 16:05:19 UTC
http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/paths

are there any conf contain "Capture Source" but no "PCM Capture Source" ?
Comment 42 Nazar Mokrynskyi 2015-06-02 16:23:55 UTC
Yes:

nazar-pc@nazar-pc /u/s/p/a/paths> grep -rl 'Capture Source'
analog-input-rear-mic.conf
analog-input-front-mic.conf
analog-input-dock-mic.conf
analog-input-headphone-mic.conf
analog-input-internal-mic-always.conf
analog-input-headset-mic.conf
analog-input-internal-mic.conf
analog-input-mic.conf
analog-input-linein.conf
analog-input.conf.common
nazar-pc@nazar-pc /u/s/p/a/paths> grep -rl 'PCM Capture Source'
nazar-pc@nazar-pc /u/s/p/a/paths>
Comment 44 Raymond 2015-06-02 16:47:50 UTC
Simple mixer control 'PCM Capture Source',0
  Capabilities: enum
  Items: 'Mic' 'Line'
  Item0: 'Mic'


seem bug in alsa lib, normally capabities should be cenum instead of enum

but enum mean both playback and capture
Comment 45 Nazar Mokrynskyi 2015-06-02 17:08:58 UTC
I saw that file already, however it doesn't answer on question how all that works together and relates to each other.

Could we invite someone from ALSA developers here or do we need to post another issue somewhere?
Comment 46 Raymond 2015-06-03 01:19:08 UTC
http://support.creative.com/kb/ShowArticle.aspx?sid=123043

seem have internal microphone array, line in and mic jacks
Comment 47 Nazar Mokrynskyi 2015-06-03 01:23:40 UTC
Yes, built-in mic turns off when external connected to jack.
Comment 48 Raymond 2015-06-03 01:31:06 UTC
http://git.alsa-project.org/?p=alsa-utils.git;a=blob;f=alsactl/init/default;hb=HEAD

you can set Mic as default in PCM Capture Source by alsactl
Comment 49 Nazar Mokrynskyi 2015-06-03 01:38:45 UTC
I know, in fact it is already by default.
The problem is that when I choose Line in (in UI) - it still works as Mic until I switch PCM Capture Source to Line. Just wanted to fix everything completely and contribute back to PulseAudio, so that next releases will include this fix out of the box.
Comment 50 Raymond 2015-06-03 03:23:29 UTC
	 https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/plain/sound/usb/mixer.c

alternative workaround is to change PCM Capture Source" to "Capture Source" in snd-usb-audio


-    	else if ((state->oterm.type & 0xff00) == 0x0100)
+   	else if ((state->oterm.type & 0xff00) == 0x0100) {
			append_ctl_name(kctl, " Capture Source");
+          if (strlcmp(kctl->name,"PCM Capture Source") == 0)
+               strlcpy(kctl->name,"Capture Source");
+      }
		else
			append_ctl_name(kctl, " Playback Source");
Comment 51 Raymond 2015-06-03 06:37:14 UTC
(In reply to Nazar Mokrynskyi from comment #47)
> Yes, built-in mic turns off when external connected to jack.

in theory, there should be three ports 

internal mic, mic and line jackd


but it is unlikely for alsa driver to provide any jack detection kctl
Comment 52 Raymond 2015-06-03 11:33:35 UTC
(In reply to Nazar Mokrynskyi from comment #42)
> Yes:
> 
> nazar-pc@nazar-pc /u/s/p/a/paths> grep -rl 'Capture Source'
> analog-input-rear-mic.conf
> analog-input-front-mic.conf
> analog-input-dock-mic.conf
> analog-input-headphone-mic.conf
> analog-input-internal-mic-always.conf
> analog-input-headset-mic.conf
> analog-input-internal-mic.conf
> analog-input-mic.conf
> analog-input-linein.conf
> analog-input.conf.common
> nazar-pc@nazar-pc /u/s/p/a/paths> grep -rl 'PCM Capture Source'
> nazar-pc@nazar-pc /u/s/p/a/paths>

can you post what you added to these three conf files ?

analog-input-mic.conf
analog-input-linein.conf
analog-input.conf.common
Comment 53 Nazar Mokrynskyi 2015-06-03 12:56:26 UTC
analog-input.conf.common:
[Element PCM Capture Source]
enumeration = select

[Option PCM Capture Source:Mic]
name = input-microphone

[Option PCM Capture Source:Line]
name = input-linein

analog-input-mic.conf:
[Element PCM Capture Source]
enumeration = select

[Option PCM Capture Source:Mic]
name = input-microphone
required-any = any

analog-input-linein.conf
[Element PCM Capture Source]
enumeration = select

[Option PCM Capture Source:Line]
name = input-linein
required-any = any

Tried analog-input.conf.common only, all except analog-input.conf.common, all together.
Also tried to add to existing Capture Source (without PCM prefix) in analog-input.conf.common.
Comment 54 Raymond 2015-06-03 14:34:46 UTC
take a look at conf files

[Option Capture Source:Line]
name = analog-input-linein
required-any = any

your entry should use analog-input-linein instead og input-linein


[Option PCM Capture Source:Line]
name = analog-input-linein
required-any = any
Comment 55 Nazar Mokrynskyi 2015-06-03 14:43:45 UTC
I'm quite sure I've already tried that, but now it works!
Pure magic)
The only thing left is that volume level of Mic and Line seems to be the same for both, but that is the thing I can easily live with)
Thank you so much!
I'll prepare patch for PulseAudio with corresponding changes.
Comment 56 Nazar Mokrynskyi 2015-06-03 15:49:48 UTC
Here is patch: http://lists.freedesktop.org/archives/pulseaudio-discuss/2015-June/023994.html
Comment 57 Raymond 2015-06-05 05:54:43 UTC
(In reply to Nazar Mokrynskyi from comment #55)
>
> The only thing left is that volume level of Mic and Line seems to be the
> same for both,


try remove volume from 

http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/paths/analog-input-mic.conf.common


[Element Line]
switch = off
-volume = off



http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/paths/analog-input-linein.conf



[Element Mic]
switch = off
-volume = off
Comment 58 Nazar Mokrynskyi 2015-06-05 13:35:25 UTC
It helps, but only partially.

It seems that this change will affect other configurations as well

They are still interconnected, when I switch back and forth it sometimes preserves level, sometimes change each other, but most of times switching just makes them equal (I'm looking at levels in alsamixer, can make screencast if needed). Probably, UI bug, I'm not sure.
Comment 59 Raymond 2015-06-26 02:00:30 UTC
when sound card has  capture source/pcm caoture source but no jack detection kctl

pulseaudio won't use the alsa selected source to activate the path since it does not use snd_mixer_selem_get_enum_item() to get the index and only use snd_mixer_selem_set_enum_item when user change path


this mean you either need module provide an option to change capture port when you you pluggec your usb audio or need module_device_restore your preferred path
Comment 60 Raymond 2015-06-26 02:02:42 UTC
modeule_switch_on_connect need an option to set the capture port when you plugged usb audio device
Comment 61 Raymond 2015-06-26 02:08:45 UTC
seem sound preference list all source port except those unavailable ports

line in is listed before mic
Comment 62 Raymond 2015-06-26 02:13:53 UTC
this mean that you need to split your patch by function

1) add Element PCM Capture Souce into conf
2) add omni.conf to use device 1 for capture


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.