I want to write a small program in C: When I plug my headphones in my notebook, it should turn the volume lower. Then, when I remove headphone from my notebook, it should turn the volume back up.
I am using the alsa
driver, and I know how to control the volume.
The question is: How to get notified, when the headphone gets plugged in?
Before I asked this question, I tried to use IRQ. I used watch -d0.5 cat /proc/stat
to see if any interrupts are experienced by the system when I plug in or remove my headphone, and I see 8 interrupts. I don't know with IRQ is the right one so, I have no idea.