On 07/17/2012 05:05 PM, Takashi Iwai wrote:
Usually the device has a jack detection mechanism, and you can check it via hda-verb or whatever. Plug your headphone to the headphone jack, and check any of the pin reacts to GET_PIN_SENSE verb (call it after setting SET_PIN_SENSE verb). For example,
% hda-verb /dev/snd/hwC0D0 0x21 SET_PIN_SENSE 1
How many codecs really require SET_PIN_SENSE? I have never had a problem with omitting the SET_PIN_SENSE command.
% hda-verb /dev/snd/hwC0D0 0x21 GET_PIN_SENSE 0
Check the value returned from GET_PIN_SENSE. If bit 31 (0x80000000) is set, this is likely the pin of the interest.
Check this for all pins, i.e. between 0x12 and 0x21. Some nodes are no pins, but it doesn't matter much.
Btw, I made convenience script for doing this a year ago. Here it is again.
To install, you put it right next to the hda-analyzer py files, as it makes use of hda_codec.py from hda-analyzer, then run "sudo hda-jack-sense-test.py -a" (see -h for switches to set codec and card indices).
Let me know if you're interested in having this small script in ALSA upstream, and if so, what I should do to get it in there.