I'm looking for a way to detect microphone/headset/headphones. How I can detect if two pins of audio jack has been shorted? This is the easiest way to check what kind of equipment has been plugged in.

In this situation I would check short circuit between pin 2 and 3. I'm using ADAU1761 and 4 pin jack.

      1   2   3   4
    |-----------\\\\
    |GND|GND|GND|MIC
    |-----------////
    
    |-----------\\\\
    |MIC|GND|RHP|LHP
    |-----------////
    
    |-----------\\\\
    |GND|GND|RHP|LHP
    |-----------////



Any idea?