Home


Fix Mic Mute Button and LED on Lenovo ThinkPad (Linux)

12 Apr 2025

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.

  1. Check permissions:

    ls -l /sys/class/leds/platform\:\:micmute/brightness

    The output will show the user and group ownership. The group should be input.

  2. 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.

  3. Check the key code and device path with evtest:

    evtest

    Find your keyboard input device and press the mic mute button. You should see:

    Event: type 1 (EV_KEY), code 248 (KEY_MICMUTE), value 1

    For example:

  4. Write the Bash script:

    Create a new file .micmute.sh with the following content:

    #!/bin/bash
    
    # CONFIG
    DEVICE="/dev/input/event12"  # <-- change this to your correct event device
    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 microphone mute
            pactl set-source-mute @DEFAULT_SOURCE@ toggle
            # Toggle LED state
            STATE=$((1 - STATE))
            echo "$STATE" > "$LED_PATH"
        fi
    done

    Make it executable:

    chmod +x .micmute.sh

    Run the script:

    ./.micmute.sh

    Add this script to your window manager. For i3:

    exec --no-startup-id ~/.micmute.sh

    Now pressing the mic mute button will toggle the microphone mute state and LED.