This has probably been asked to death around here, but I could never get to a final solution (probably for good cause).
Anyway, is there any way in Ubuntu (I use Ubuntu 11.04 with kernel 2.6.38-8) to detect if there is a headphone plugged in? Specifically, I'm searching for C/C++ solutions to poll my ALSA device to detect if a headphone device has been plugged in.
Of all the threads I searched, this link deals only with Windows, and I couldn't figure out if this link provides a proper solution (there was no change whether the headphones were plugged in or not).
Ok, looong post, but I'd really appreciate the help.
Cheers,
Karthik.
The jack detection API is (here or here):