I was wondering and looking if someone has been able to make the following.
Led indicator ON = Microphone ON //
Led indicator OFF = Microphone OFF
I think is the way it should work, not the default way (neither in WINDOWS, I checked since I have dual boot). I just look for a solution in Linux.
I would like to have my mic OFF most of the time without the obnoxious LED. Moreover, it would be nice to have the LED remind me when my microphone is on.
I am using Linux Mint and the computer is a ThinkPad x390 Model 20Q0CTO1WW
The only thing I know is that the led is not turning on/off according to key presses, since it also turns on when I mute the mic from the GUI.
Any ideas?
More insight about the problem and some "advances":
I found this old topic related to my issue https://askubuntu.com/questions/125367/enabling-mic-mute-button-and-light-on-lenovo-thinkpads?noredirect=1&lq=1
I figured out that if I was able to enable it, I would be able to disable or change it's behavior.
I was able to map the microphone function key to the "power led" by creating a file in /etc/acpi/events/lenovo-mutemic
:
event=button/f20 F20 00000080 00000000 K
action=/etc/acpi/lenovo-mutemic.sh
And the bash script /etc/acpi/lenovo-mutemic.sh
:
#!/bin/bash
INPUT_DEVICE="'Capture'"
YOUR_USERNAME=$USER
if amixer sget $INPUT_DEVICE,0 | grep '\[on\]' ; then
amixer sset $INPUT_DEVICE,0 toggle
echo "0 on" > /proc/acpi/ibm/led
su $YOUR_USERNAME -c 'DISPLAY=":0.0" notify-send -t 50 \
-i microphone-sensitivity-muted-symbolic "Mic MUTED"'
else
amixer sset $INPUT_DEVICE,0 toggle
su $YOUR_USERNAME -c 'DISPLAY=":0.0" notify-send -t 50 \
-i microphone-sensitivity-high-symbolic "Mic ON"'
echo "0 blink" > /proc/acpi/ibm/led
fi
By doing this I am able to make the power button blink when the mic is on, and stay steady when mic is off. But the microphone LED works as default. Moreover when I press the microphone mute key both processes are triggered (the original which turns it off, and also the new one that turns it on again.)
I could remove from the script above the amixer sset
command and have a reminder that the mic is on by having the power button blink, but this does not solve the annoying mic LED button when the mic is off.
What this post suggests to control the mic led is to modify a kernel module:
Add MICMUTE=/sys/devices/platform/thinkpad_acpi/leds/tpacpi::micmute/brightness
to the previous script and echo 1 > $MICMUTE
// echo 0 > $MICMUTE
to control this led.
Here is what I have trouble with:
They suggest installing headers and built tools for your kernel with:
sudo apt-get install linux-headers-$(uname -r) build-essential
Make a temporary dir for trying the modified module:
mkdir ~/tpacpi && cd ~/tpacpi
Download the source file thinkpad_acpi.c from the Ubuntu Kernel git repository:
wget -Othinkpad_acpi.c "http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-$(lsb_release -sc).git;\
a=blob_plain;f=drivers/platform/x86/thinkpad_acpi.c;hb=HEAD"
- Patch it with (copy and paste the full line):
sed -i -e 's/"tpacpi::thinkvantage",/"tpacpi::thinkvantage",\n\t"tpacpi::unknown_led4",\n\t"tpacpi::micmute",/g' -e 's/0x1081U/0x5081U/g' -e 's/0x1fffU/0x5fffU/g' thinkpad_acpi.c
- Download a "Makefile":
wget -OMakefile http://pastebin.com/raw.php?i=ybpnxeUT
- Type
make
to compile it:
Here is what I have trouble with. First the thinkpad_acpi.c
file is not downloaded with the wget
command and I haven't been able to compile the ones I have downloaded even without patching them.
My kernel is: 5.3.0-46-generic