In my experience, most modern sound devices can figure out the difference. They must be sending a test signal down the line and measuring the voltage/current response. My computer has a popup that tells me if I’ve plugged in a speaker, headphone, or microphone in any of the ports.