I'm currently trying to script the headphone plug-in/out event. I found out that I can script this quite easily as an
I created a file in
/etc/acpi/events/ with the event
event=jack[ /]headphone, which then just calls my script.
I've also determined the file and exact line, which holds information about whether the headphones are currently plugged in or not. In the file
/proc/asound/card0/codec#0 one specific
0x00 if plugged in and
0x40: OUT if unplugged.
Now the problem I see there, is when I check the the current status of the headphone jack, as soon as the acpi event is triggered, will the
codec#0 file already contain the current value? Might I have a race condition here? Or is it safe to use like that?