I'm asking mainly out of curiosity, partially because the linux audio stack always confuses the heck out of me and maybe because I wan't to implement something that enhances the behavior.
My question is: which piece of software mutes the audio output when I unplug the headphones from my laptop? I.e. which code actually pushes the "mute" button for me? How does it do this?
Secondary question would be how to listen for such events without brainlessly reading some log file every x miliseconds?
/dev/input
events of typeEV_SW
(e.g. on Intel HDA hardware) is very portable.