2

I use a Lenovo T420. It has mute mic button, but it cannot be assigned to any action, because I got error "The key you just pressed is not supported by Qt" when I'm trying to assign to any action. The ThinkVantage button can be assigned to an action, and I want to assign it to mute the mic. I tried everything to make mic mute via command line, but nothing worked for me. For example, I tried these commands, the most helpful for other users, but didn't work for me:

root@qet-PC: /home/qet# amixer sset 'Internal Mic',0 mute
No protocol specified
xcb_connection_has_error() returned true
No protocol specified
xcb_connection_has_error() returned true
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Access denied
amixer: Mixer attach default error: Connection refused

root@qet-PC: /home/qet# amixer set Capture toggle
No protocol specified
xcb_connection_has_error() returned true
No protocol specified
xcb_connection_has_error() returned true
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Access denied
amixer: Mixer attach default error: Connection refused

root@qet-PC: /home/qet# amixer -c 0 sset Mic toggle
No protocol specified
xcb_connection_has_error() returned true
amixer: Unable to find simple control 'Mic',0

results of /proc/asound/cards and lspci | grep Audio:

root@qet-PC: /home/qet# cat /proc/asound/cards
 0 [PCH            ]: HDA-Intel - HDA Intel PCH
                      HDA Intel PCH at 0xf2520000 irq 47
29 [ThinkPadEC     ]: ThinkPad EC - ThinkPad Console Audio Control
                      ThinkPad Console Audio Control at EC reg 0x30, fw unknown
root@qet-PC: /home/qet# lspci | grep Audio
00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 04)

How do I mute mic using command line, which I can assign to the ThinkVantage button in "System Settings -> Shortcuts and Gestures"? Or maybe there is another way to mute mic pressing that button?

UPDATE:

Turns out it does not work when I run the command as root. With user permissions, it works fine -- mic is muted, except I still get some errors in the terminal:

qet@qet-PC:~$ amixer set Capture toggle
Failed to create secure directory (/run/user/1000/pulse): Permission denied
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 80
  Front Left: Capture 80 [100%] [6.00dB] [off]
  Front Right: Capture 80 [100%] [6.00dB] [off]
qet@qet-PC:~$ amixer set Capture toggle
Failed to create secure directory (/run/user/1000/pulse): Operation not permitted
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 80
  Front Left: Capture 80 [100%] [6.00dB] [on]
  Front Right: Capture 80 [100%] [6.00dB] [on]
1
  • Try alsamixer. That is not a command line tool but a very nice curses based terminal client. Your amixer seems to need some X server.
    – ikrabbe
    Jul 4, 2015 at 13:51

2 Answers 2

4

On my system I get

amixer -c MID sget Capture
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 46
  Front Left: Capture 42 [91%] [25.00dB] [on]
  Front Right: Capture 42 [91%] [25.00dB] [on]

amixer -c MID sset Capture 23
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 46
  Front Left: Capture 23 [50%] [6.00dB] [on]
  Front Right: Capture 23 [50%] [6.00dB] [on]

That should control the mic volume. Check the alsamixer F4 Capture Frontend for other settings that effect Mic Volume, such as Digital and Mic Boost.

Read the output of

amixer scontrols

for names of simple controls. The finer grained controls are given by the whole identifier:

amixer contents|grep -i cap
amixer cget numid=11,iface=MIXER,name='Capture Switch'
amixer cset numid=11,iface=MIXER,name='Capture Switch' off

The last disables the Capture completely. With the alsamixer command you can debug your amixer operations.

0

KDE-specific answer, coming late, but for the record: On KDE, users may prefer to use Kmix via qdbus.

$ qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "mic_mute"

This will actually toggle the microphone. (Source)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .