Fix Mic Mute Button and LED on Lenovo ThinkPad (Linux)
When pressing the microphone mute button, the evtest reports KEY_MICMUTE while xev does not recognize the key press. Below are the steps to fix the issue that worked on Lenovo Thinkad T14s Gen 4 running Debian.
-
Check permissions:
ls -l /sys/class/leds/platform\:\:micmute/brightnessThe output will show the user and group ownership. The group should be input.
-
Add your user to the input group:
usermod -aG input <username>Replace <username> with your actual username.
Important: Log out and log back in after adding yourself to a new group.
-
Check the key code and device path with evtest:
evtestFind your keyboard input device and press the mic mute button. You should see:
Event: type 1 (EV_KEY), code 248 (KEY_MICMUTE), value 1For example:
- Input device: /dev/input/event12
- Key code: KEY_MICMUTE
-
Write the Bash script:
Create a new file .micmute.sh with the following content:
#!/bin/bash device_name="ThinkPad Extra Buttons" DEVICE="" # Read /proc/bus/input/devices and extract the event device DEVICE=$(awk -v name="$device_name" ' BEGIN { found = 0 } /^N:/ { found = ($0 ~ name) } /^H:/ && found { if (match($0, /event[0-9]+/)) { print "/dev/input/" substr($0, RSTART, RLENGTH) exit } }' /proc/bus/input/devices) LED_PATH="/sys/class/leds/platform::micmute/brightness" # Internal state STATE=0 # Trap Ctrl+C to exit cleanly trap "echo; echo Exiting.; exit 0" SIGINT # Main loop evtest "$DEVICE" | while read -r line; do # Look for KEY_MICMUTE press (value 1) if echo "$line" | grep -q "KEY_MICMUTE.*value 1"; then # Toggle state pactl set-source-mute @DEFAULT_SOURCE@ toggle STATE=$((1 - STATE)) echo "$STATE" > "$LED_PATH" fi doneMake it executable:
chmod +x .micmute.shRun the script:
./.micmute.shAdd this script to your window manager. For i3:
exec --no-startup-id ~/.micmute.shNow pressing the mic mute button will toggle the microphone mute state and LED.