[alsa-devel] How can you tell if the speaker jack on your sound card has anything plugged into it???

Mark Brown broonie at opensource.wolfsonmicro.com
Sat Apr 26 00:02:35 CEST 2008

On Fri, Apr 25, 2008 at 03:56:46PM -0500, Timur Tabi wrote:

> First, the hardware has to detect insertion.  Then, it has to send a 
> signal to the driver (either via a status register or an interrupt).

> Assuming you have all that (I've never seen a sound card that provides 
> this info), perhaps you can specify the output jack only when something 

This is supported in a reasonable proportion of CODEC chips these days,
particularly those that have direct headphone and/or microphone support.
It's more frequently used in mobile devices than desktops (since they
tend to experience more plug/unplug events) but with the spread of
laptops it's now fairly common in PC class hardware.

> is plugged in?  That is, you register the output jack when something is 
> plugged in, and then deregister it when something is removed.

It's probably be easier from a UI perspective if the jack is always
present in the UI but applications can tell if it's disabled - the
physical jack is always there, after all.

More information about the Alsa-devel mailing list