My laptop is Thinkpad Edge series, of which laptop will produce a beep when the power supply being unplugged. But I noticed that the beep has been blocked if the alsa is turned to mute.

So, I wonder if I can add an exception of "mute rules".


The wide variety of sound cards and ac adapters may make this difficult for a universal answer, but the basics are:

  • Create a daemon process that monitors /proc/acpi/ac_adapter/state for "offline" (grep will do fine)
  • Use that to trigger setting volume to X (see alsactl --help) and playing a sound/beep (aplay, beep, ...)
  • Return sound to system setting (the alsa settings are in /etc/asound.state)

Note: if you don't have /proc/acpi/ac_adapter/state, use something else that would change when the cord is pulled ... like /proc/acpi/battery/BAT1/state (the charging state would become discharging)

  • A good idea, but I have no ac_adapter in /proc/acpi directory. – Determinant Mar 26 '12 at 8:55
  • I updated with an alternative file to monitor in /proc/acpi ... it would help if you gave a listing of /proc/acpi and more detailed info of your applicable hardware in general (hardinfo will work ). – technosaurus Mar 27 '12 at 3:59
  • I'll have a try on it. The acpi of my laptop is poorly supported. Thank you anyway. – Determinant Mar 27 '12 at 12:59

You can not. Alsa mutes using hardware mixer so well that not even a mouse whisper passes.

  • 1
    Any other approach to my problem? Any other low-level solutions that can make sound using the device directly? – Determinant Mar 20 '12 at 13:00
  • 10 years ago there were speaker pins on all motherboards. now they are silently routed to a builtin soundcard. You may find connector en.wikipedia.org/wiki/PC_speaker#Pinouts or you need to solder one. remember that 4-pin connector is sometimes serial 12V and will burn headphones. – ZaB Mar 20 '12 at 13:32
  • 2
    Well..My computer is a laptop and I mean I need a software-level way to achieve that (maybe some kernel hacking on sound devices). – Determinant Mar 20 '12 at 14:03
  • well snd-hda-intel file has it. replace master channel mute by mute of all but speaker.... – ZaB Mar 21 '12 at 13:24
  • 2
    Could you please give me some specific instructions? – Determinant Mar 25 '12 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.