I'm running 12.04 on my hp dm1z. Everything is working fine except for this odd issue.

Occasionally, when I have headphones plugged in, the sound output suddenly stops coming out of the headphones and instead comes out of the speakers. It seems that the computer is essentially thinking I don't have headphones plugged in, since the volume changes to what I had it set to without headphones plugged in.

Sometimes, the headphones are detected randomly, and the issue is fixed, but often the problem reverts every few seconds, as if it's timed. Sometimes I'm able to fix the problem simply by wiggling the headphone jack, but I can't tell whether this is actually what fixes it or it just so happens to get fixed randomly when I'm fiddling with the headphone jack. Also, if I pull the headphones partially out of the jack, it always detects them. Only when the headphones are all the way in does this problem happen.

Does anyone have any idea what could be causing this? I'm pretty sure this is software related since I don't notice it in windows. But then again, I don't use windows on this computer very much.