5

Linux systems have been having a historical (>5 yrs) problem in configuring audio devices especially commonplace headphones with combo jacks. Since many people want to use their favorite linux systems for video chatting, there are records of frustrating unresolved problems all across various forums.

I get that the drivers for the external mic (in headphones with combo jacks) are not currently available (or not developed(?)).

So given that, the user should be able to use the internal microphone for input and headphone for output.

Along this line I went down the rabbit hole (digged up upto 5-6 yr old issues) and tried lot of things only to get no success in the end (I am using common combo jack headphones and hp laptop running ubuntu 16.04).

Many people have variously reported this issue. Here's what commonly happens..

When headphone is not connected,

Internal microphone and speakers work well.

PulseAudio shows: enter image description here

pacmd list-cards shows:

    ports:
    analog-input-internal-mic: Internal Microphone (priority 8900, latency offset 0 usec, available: unknown)
        properties:
            device.icon_name = "audio-input-microphone"
    analog-input-mic: Microphone (priority 8700, latency offset 0 usec, available: no)
        properties:
            device.icon_name = "audio-input-microphone"
    analog-output-speaker: Speakers (priority 10000, latency offset 0 usec, available: unknown)
        properties:
            device.icon_name = "audio-speakers"
    analog-output-headphones: Headphones (priority 9000, latency offset 0 usec, available: no)
        properties:
            device.icon_name = "audio-headphones"

When headphone is connected,

Output through headphones work well. But external microphone (located on headphone) does not work (stuttering noise, drivers not present, alright), but then Internal microphone is 'unplugged' too. (So there is no way to record any sound.)

PulseAudio shows: enter image description here

pacmd list-cards shows:

    ports:
    analog-input-internal-mic: Internal Microphone (priority 8900, latency offset 0 usec, available: no)
        properties:
            device.icon_name = "audio-input-microphone"
    analog-input-mic: Microphone (priority 8700, latency offset 0 usec, available: yes)
        properties:
            device.icon_name = "audio-input-microphone"
    analog-output-speaker: Speakers (priority 10000, latency offset 0 usec, available: no)
        properties:
            device.icon_name = "audio-speakers"
    analog-output-headphones: Headphones (priority 9000, latency offset 0 usec, available: yes)
        properties:
            device.icon_name = "audio-headphones"

So, headphones gives the output, that's great, but is there any way to force internal microphone for input? (somehow make available: yes)

6

Linux doesn't have a "historical problem in configuring audio devices". The problem actually are the manufacturers of devices, mostly laptops, who just ship the laptop with pre-installed Windows drivers that can be configured acurately to deal with the laptop hardware, because the manufacturer of course knows exactly how the hardware is set up. On the other hand, the manufacturer doesn't want to share the details, doesn't document them and keeps them secret; after all, they have supplied the Windows driver. That's why often all non-standard features of laptops have to be found out through painful and time-consuming reverse engineering to be able to use them under Linux.

With regard to audio, basically all modern devices uses the Intel HDA architecture, which is self-describing and provides a graph representation of the codec (the analog audio chip). In principle, the BIOS is supposed to supply the "pin configuration", i.e. which pin of the codec chip is connected to internal speakers and mics, to line-in, line-out and headphone or headphone combo jacks.

However, especially in the last years, manufacturers didn't seem to find it necessary to correctly configure the BIOS (after all, they already supplied the Windows driver). So the cycle is: New laptop model comes out, somebody with the actual hardware and enough technical understanding figures out how the BIOS is lying and what the configuration should really look like, the kernel developers add a quirk (special treatment of that hardware) in the drivers to deal with that, with the newest driver the other people who use the same hardware don't notice and are happy. Until the next model comes out, and the cycle starts again. In the meantime, lots of unhappy users where it doesn't work leave their traces all over the internet asking in forums everywhere, often without getting the right answer.

So yes, drivers for the external mic are developed and available (in fact, they are the same drivers as for the rest of the codec). You can see all the quirks (non-standard behaviour) that have accumulated by inspecting the kernel source files in /sound/pci/hda/ and grep for "quirk".

Which means if you happen to have a laptop where the external headphone mic is not working, someone (maybe you?) has to dive into the technical details, make it work, and report it to the ALSA kernel developers.

You can look at what the codec chips report about their internal structure with

cat /proc/asound/card*/codec\#*

This gives the internal graph, you can follow it manually, or try programs like codecgraph to visualize it (doesn't always give good results). The "Pin complex" represent the pins. Look at the one you have, try to guess which might represent the external mic, even though it's mislabeled. Use hdajackretask to correctly label the pin if you've identified it (or guess until you do). There are ways to make this relabelling default on boot until the driver gets updated.

As for combining internal mic and headphones: ALSA has a mixer element called "Auto-Mute mode". This will cause ALSA to mute internal mic/speaker and unmute external mic/headphone (or vice versa) when the headphone jack is plugged or unplugged. Disable this in alsamixer or amixer, mute and unmute internal and external mic/speaker/headphone as desired.

You can also configure this in Pulseaudio: Start pavucontrol, select the right ports in the input and output tab.

If both internal and external "ports" are not available, or if you want to make it the default, that's also possible, though it's a bit of a pain to do: Look at the files in /usr/share/pulseaudio/alsa-mixer/, read the comments that explain how they work. You need a new "configuration" for your soundcard that combines two "paths", one for the internal mic, and one for the external headphone, using the correct ALSA mixer elements. This will probably take some time to make it work correctly, Pulseaudio is not very intuitive in this resepect.

No, there's no easy way to do what you want; you'll have to get your hands dirty.

  • As I found recently (at the end of many trials and errors) that bluetooth headphones (connected using bluetoothctl) is a nice workaround to this problem. – rraadd88 Aug 3 '17 at 6:07
0

After many trials and tests I found that this issue can be solved through hardware rather than software. Using a 'USB Headphone/Microphone Splitter', I was able to force internal mic for input and headphones for output.

Output need to be set to 'USB Audio Device'. enter image description here Input would be default built-in internal speakers. Just need to make sure that it is ON. enter image description here It works with skype too. Just need to set input and output to default and turn off the automatic adjustments of microphone. enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.