我用的是联想T420。它有静音麦克风按钮,但无法将其分配给任何操作,因为当我尝试分配给任何操作时,出现错误“Qt 不支持您刚刚按下的键”。 ThinkVantage 按钮可以分配给一个操作,我想将其分配为使麦克风静音。我尝试了通过命令行使麦克风静音的所有方法,但没有任何效果。例如,我尝试了这些命令,这对其他用户最有帮助,但对我不起作用:
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
结果/proc/asound/cards和LSPCI | grep 音频:
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)
如何使用命令行将麦克风静音,并将其分配给“系统设置 -> 快捷方式和手势”中的 ThinkVantage 按钮?或者也许还有另一种方法可以按下该按钮使麦克风静音?
更新:
事实证明,当我以 root 身份运行该命令时,它不起作用。有了用户权限,它工作得很好——麦克风被静音,但我仍然在终端中收到一些错误:
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
在我的系统上我得到
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]
这应该控制麦克风音量。检查 alsamixer F4
Capture Frontend 的其他影响麦克风音量的设置,例如数字和麦克风增强。
读取输出
amixer scontrols
用于简单控件的名称。更细粒度的控制由整个标识符给出:
amixer contents|grep -i cap
amixer cget numid=11,iface=MIXER,name='Capture Switch'
amixer cset numid=11,iface=MIXER,name='Capture Switch' off
最后一个完全禁用捕获。使用该alsamixer
命令您可以调试您的amixer
操作。
答案2
KDE 特定的答案,迟到了,但为了记录:在 KDE 上,用户可能更喜欢通过 qdbus 使用 Kmix。
$ qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "mic_mute"
这实际上会切换麦克风。 (来源)