Activate the Microphone on a Lenovo Carbon X1 Running Debian
When I bought my Carbon X1 laptop a few years ago, the sound card was new and not yet well supported by Linux. (I knew that before I bought, and decided it was a good gamble that support would improve soon.)
Early on, there was a long thread on Lenovo's forum discussing, in particular, how to get the microphone working. The key, apparently, was the SOF (Sound Open Firmware) support, which was standard in the 5.3 Linux kernel that came with Ubuntu 10.10, but needed an elaborate script to get working in earlier kernels.
It worked fine on Ubuntu. But under Debian, the built-in mic didn't work. (Not a huge deal since I have a USB Samson Go, as recommended on the Embedded podcast; but sometimes it's nice to use the laptop on its own without extra hardware hanging off of it.)
pacmd list-sources
showed something that looked like a
source, but it didn't show up as a usable source in pavucontrol and
I couldn't seem to enable it as a microphone.
I found a page on the Debian wiki, InstallingDebianOnThinkpadX1 Carbon 7th Gen that gave me most of the steps. The important part was updating the firmware:
# apt install firmware-intel-sound firmware-sof-signed # apt install fwupd fwupd-signed udisks2 # fwupdmgr
This didn't seem to do anything — it said my system's firmware
was all up to date — but after rebooting,
pacmd list-sources
had a whole new list of devices.
(If you're trying to enable an audio device, I recommend saving the output of
pacmd list-sources
before making any big changes.)
It's not necessarily easy to figure out which audio source is a usable
microphone. After the firmware update, and with no external audio
pacmd list-sources
lists four sources. The device.description field seems to be
the one pulseaudio's GUI, pavucontrol, shows, so I will too
$ pacmd list-sources | grep device.description device.description = "Monitor of Cannon Point-LP High Definition Audio Controller" device.description = "Cannon Point-LP High Definition Audio Controller" device.description = "Monitor of Cannon Point-LP High Definition Audio Controller Stereo" device.description = "Cannon Point-LP High Definition Audio Controller Stereo"
Two of them have "monitor" in their name, and so can be ignored. But which of the other two — alsa_input.hw_0_6 or alsa_input.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.stereo-fallback — is the actual microphone?
pavucontrol shows both devices, but for the second device, it shows a menu containing only one item: "Microphone (unplugged)". This seems to be the audio jack for the built-in sound card. The built-in microphone is the other device, the one without a Port option, "Cannon Point-LP High Definition Audio Controller" rather than "Cannon Point-LP High Definition Audio Controller Stereo". Clear as mud, right?
Fortunately pavucontrol makes it pretty easy to test which device is the built-in microphone. Ynmute the first one (unmute is the leftmost of the three buttons to the right of the device name), make some noise and see if it shows up in the level indicator (the slider underneath the device's volume control). Then mute it, unmute the other one and try again.
Determining which device is the built-in speakers is not so easy, because when pavucontrol is running, you can't play any sounds. Anything sound-generating app (aplay, music players) will hang until pavucontrol exits. So on Debian, it takes some fiddling to get the right devices enabled and everything else disabled.
This was easier on Ubuntu. I can play sounds while pavucontrol was running, and the device names are clearer. The built-in speakers have a device name of "Cannon Point-LP High Definition Audio Controller Speaker + Headphones", and the built-in mic is "Cannon Point-LP High Definition Audio Controller Digital Microphone". On Debian, the built-in mic is "Cannon Point-LP High Definition Audio Controller", and there's a sink with the exact same name, but it's not the actual built-in speakers; those are another device named "Cannon Point-LP High Definition Audio Controller Stereo", the same name but with "Stereo" appended. I'm not sure where the differences lie, whether they're in the kernel or in some pulseaudio configuration.
If you find yourself unable to figure out which audio sink corresponds
to the built-in speakers and pavucontrol is blocking sounds,
use pacmd list-sinks
to find the pulseaudio name and number
for the device you want to enable (the name: field),
then you can use commands like
pactl set-default-sink alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.stereo-fallback pactl set-sink-mute alsa_output.hw_0_0 1
I find all these pacmd and pactl commands impossible to remember,
and using pavucontrol every time requires way too much clicking around,
so I wrote a pulsehelper
script that lets me make aliases for various audio hardware I use,
and I can say things like pulsehelper --sink spkr --source gomic
[ 11:15 Mar 20, 2022 More linux/laptop | permalink to this entry | ]