I have a mic mute button on my Lenovo Thinkpad T420 , but it doesn't work.
So I tried xev
command to monitor press event, and that key wasn't captured.
Is there anyway to fix it , like add raw key code ?
OS & Laptop
Ubuntu 12.04
, also hope it works on Arch Linux , but doesn't matter much ;-P
Thinkpad Module: X220 4290LY9
Kernel patch for Arch Linux
FINALLY
It's a little tricky , but with the kernel patch and acpid script , it works now.
The rest I need is a notify daemon like the one for output mute , but it doesn't matter much now.
This solution should work for all Thinkpads with a mute button which also has a built-in light. It may also work for other Thinkpads.
Apart from the notification bubbles:
There are two possible "hardware" indicators (to show that mute is on or off):
The Mic mute button light (orange) will be on or off to show mute status (just like in Windows)
Solution 2 requires a patched
thinkpad_acpi
kernel module, and is only recommended for advanced users who know what they are doing. This is because the patch is not included by the thinkpad_acpi developers by default, (See this discussion for more details).Common Steps
a. Determining the Mic-Mute hotkey code and Mic input device
Ctrl+Alt+T
acpi_listen
, and press the mute keyNote the result, which should be something like:
ibm/hotkey HKEY 00000080 0000101b
Then run
amixer scontrols
, you should see one of the following in the output:or
Depending on what you see, "Internal Mic" or "Capture" is your input device.
b. Create the Mic-Mute ACPI event handler
gksudo gedit /etc/acpi/events/lenovo-mutemic
to open the editor.acpi_listen
:Choosing either the Power Light or Mic Mute indicators
c-1. Mic-Mute script with Power Button indicator
gksudo gedit /etc/acpi/lenovo-mutemic.sh
In the editor, paste:
Replace value of INPUT_DEVICE variable with
Capture
if that is your input device name (leave all the ticks intact).c-2. Mic-mute with official Mic-mute Indicator Light
Setting up the script
thinkpad_acpi
module and has been verified to work with Ubuntu Precise 12.04 and Quantal 12.10, kernels 3.2.0-23 and 3.2.0-24 and 3.5.0-21.Let's create the script first:
/etc/acpi/lenovo-mutemic.sh
should be as in section c-1, with the following additions:Insert this line after the header (
#!/bin/bash
):After the first
echo...
line, insert:And after the second
echo...
line, insert:You can find an example of what the full script should look like in this paste
Then:
Confirm that pressing the mute button results in a blinking power light; pressing again gives a steady power light.
Building, testing and installing the kernel module
Install (or ensure) you have the headers and built tools for your currently running kernel with:
Make a temporary directory and change to it:
Download the source file
thinkpad_acpi.c
from the Ubuntu Kernel git repository:Patch it with (copy and paste the full line):
In the same folder where
thinkpad_acpi.c
has been downloaded, you will need a "Makefile". You can download it directly from this Pastebin, using:OR paste the below into a file called
Makefile
:Now type
make
to create the module; you will see athinkpad_acpi.ko
file in the folder when done.Test the patched module after loading it with:
Now confirm that pressing the mic button will turn the orange mic light on/off AND the power light blinking/steady.
If confirmed, do the following to replace your current
thinkpad_acpi
module:Comment out or delete the power led lines in
lenovo-micmute.sh
d. Testing
Now have fun pressing the Mic Mute button, you should see it reflected in:
Installing
indicator-sound
solved the problem for me.I couldn't get it to work straight away on Ubuntu 12.10 first time using a linux desktop environment as well.
It was fixed with just adding quotes and removing the comma (and adding my username):
and then followed your steps in compiling the thinkpad_acpi.
All on a Thinkpad T520 with NVS 4200M, Ubuntu 12.10. Haven't rebooted yet but I tested with the test step you have outlined and it works with turning the mute LED on and OFF and actually muting it (with the notification). Jumping the gun a little bit seems to work fine. Thanks.
Well rebooted, the script itself works fine muting and unmuting but I didn't install the patched thinkpad_acpi... oops
Okay, rebooted again after installing it properly this time and the LED lights up as well. Should probably have a start-up script to check if the mic is muted or not and turn the light on/off, since the current setup will only turn the light on/off when the button is pushed.
To get the light to show if it's been muted or not at start-up instead of when the button is first pushed, I just saved:
Gave it permission to execute
As lenovo-mic-check to /etc/init.d/ and then ran:
Also don't forget to copy to /etc/pm/sleep.d/
Now the light is on if I reboot the computer, NOTE: the second if could just be an else.