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):
#!/bin/bash
MICMUTE=/sys/devices/platform/thinkpad_acpi/leds/tpacpi::micmute/brightness
ID='"Internal Mic"'
USERNAME="" #put your username here
if amixer sget "$ID"ntenter code herernal Mic" 0 | grep '\[on\]' ; then
amixer sset "$ID" 0 toggle
#echo "0 blink" > /proc/acpi/ibm/led #related to blinking power
echo 1 > $MICMUTE
su $USERNAME -c 'DISPLAY=":0.0" notify-send -t 50 \
-i microphone-sensitivity-muted-symbolic "Mic MUTED"'
echo "MUTE ON"
else
amixer sset "$ID" 0 toggle
su $USERNAME -c 'DISPLAY=":0.0" notify-send -t 50 \
-i microphone-sensitivity-high-symbolic "Mic ON"'
#echo "0 on" > /proc/acpi/ibm/led
echo 0 > $MICMUTE
echo "MUTE OFF"
fi
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:
#!/bin/bash
MICMUTE=/sys/devices/platform/thinkpad_acpi/leds/tpacpi::micmute/brightness
if amixer sget "Internal Mic" 0 | grep '\[on\]' ; then
echo 0 > $MICMUTE
elif amixer sget "Internal Mic" 0 | grep '\[off\]' ; then
echo 1 > $MICMUTE
else
echo "No Mic Detected";
fi
Gave it permission to execute
sudo chmod +x /etc/init.d/lenovo-mic-check
As lenovo-mic-check to /etc/init.d/ and then ran:
sudo update-rc.d lenovo-mic-check defauts 98 02
Also don't forget to copy to /etc/pm/sleep.d/
sudo cp /etc/init.d/lenovo-mic-check /etc/pm/sleep.d/lenovo-mic-check
Now the light is on if I reboot the computer, NOTE: the second if could just be an else.
xev
, useacpi-listen
to monitor, and press, you should get something likeibm/hotkey HKEY 00000080 0000101b
. Please post that code here.dmesg|tail