[alsa-devel] How can you tell if the speaker jack on your sound card has anything plugged into it???
Hi Everybody,
I was talking with some users in the irc channel in the free node, and was hoping to find a way to get the information about weither or not anything was plugged into the sound card, I've seen this feature with windows vista. I search thru a bunch of documentation sites and also scanned the /proc & /sys to no avail...
Thanks, Sean T
On Fri, Apr 25, 2008 at 01:29:59PM -0600, Sean Thayne wrote:
I was talking with some users in the irc channel in the free node,
and was hoping to find a way to get the information about weither or not anything was plugged into the sound card, I've seen this feature with windows vista. I search thru a bunch of documentation sites and also scanned the /proc & /sys to no avail...
There's currently no standard way of getting this information from user space even where the hardware provides it.
How would one go about getting this info? I'm trying to create a monitoring tool for a specific sound card, so the driver's standardized...
Mark Brown wrote:
On Fri, Apr 25, 2008 at 01:29:59PM -0600, Sean Thayne wrote:
I was talking with some users in the irc channel in the free node,
and was hoping to find a way to get the information about weither or not anything was plugged into the sound card, I've seen this feature with windows vista. I search thru a bunch of documentation sites and also scanned the /proc & /sys to no avail...
There's currently no standard way of getting this information from user space even where the hardware provides it.
Sean Thayne wrote:
How would one go about getting this info? I'm trying to create a monitoring tool for a specific sound card, so the driver's standardized...
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 is plugged in? That is, you register the output jack when something is plugged in, and then deregister it when something is removed.
How do you think Vista does it? I've used a couple of different computers (totally different hardware) and it can detect insertion for them all...
Timur Tabi wrote:
Sean Thayne wrote:
How would one go about getting this info? I'm trying to create a monitoring tool for a specific sound card, so the driver's standardized...
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 is plugged in? That is, you register the output jack when something is plugged in, and then deregister it when something is removed.
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Sean Thayne wrote:
How do you think Vista does it? I've used a couple of different computers (totally different hardware) and it can detect insertion for them all...
Since I've never used Vista, I have no idea how it does it. However, my point still stands: unless the hardware detects it and provide status information to the driver, there's nothing you can do.
So just figure out how your hardware provides the info, and then update your driver accordingly.
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.
Mark Brown broonie@opensource.wolfsonmicro.com writes:
There's currently no standard way of getting this information from user space even where the hardware provides it.
Isn't the event api switch "SW_HEADPHONE_INSERT" standard ? I thought it was designed for such use.
If I'm not mistaken, the Neo teams handles it that way, as I do for the mio : -> input_report_switch(mioa701_evdev, SW_HEADPHONE_INSERT, val);
-- Robert
On Fri, 25.04.08 23:08, Robert Jarzmik (rjarzmik@free.fr) wrote:
Mark Brown broonie@opensource.wolfsonmicro.com writes:
There's currently no standard way of getting this information from user space even where the hardware provides it.
Isn't the event api switch "SW_HEADPHONE_INSERT" standard ? I thought it was designed for such use.
If I'm not mistaken, the Neo teams handles it that way, as I do for the mio : -> input_report_switch(mioa701_evdev, SW_HEADPHONE_INSERT, val);
AFAIK HDA generally supports Jack Sensing. However it's not wired up properly on all hardware. And there's no driver support in the Linux HDA driver to generate an input device for jack sensing.
But I might be mistaken. Takashi and Jaroslav know the current state of Jack Sensing on Linux much better.
Lennart
The snd_hda_intel driver does this internally to mute the speakers when headphones are plugged in. Ditto for front mic. But you are right, we need a standard way of tracking this. I am exploring the HAL interface now to see what I can learn from it. And most sound chips have an insert detection mechanism. Usually they are wired to specific jacks, but sometimes they just register a change in plug state, and read the jack's impedance levels to know which jack is used. It is documented in the Sigmatel/IDT, Realtek, and Analog Devices codec PRMs.
Tobin
On Fri, 2008-04-25 at 23:08 +0200, Robert Jarzmik wrote:
Mark Brown broonie@opensource.wolfsonmicro.com writes:
There's currently no standard way of getting this information from user space even where the hardware provides it.
Isn't the event api switch "SW_HEADPHONE_INSERT" standard ? I thought it was designed for such use.
If I'm not mistaken, the Neo teams handles it that way, as I do for the mio : -> input_report_switch(mioa701_evdev, SW_HEADPHONE_INSERT, val);
-- Robert
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
On Fri, Apr 25, 2008 at 02:32:42PM -0700, Tobin Davis wrote:
The snd_hda_intel driver does this internally to mute the speakers when headphones are plugged in. Ditto for front mic. But you are right, we need a standard way of tracking this. I am exploring the HAL interface now to see what I can learn from it. And most sound chips have an
The interface I'd previously proposed here was to provide an input device per-jack which would do this - hal should then be able to monitor the input device. As suggested in the original message in the thread providing sysfs information would probably be helpful for scripts.
insert detection mechanism. Usually they are wired to specific jacks, but sometimes they just register a change in plug state, and read the jack's impedance levels to know which jack is used. It is documented in the Sigmatel/IDT, Realtek, and Analog Devices codec PRMs.
Yes, that's how all the codecs I've looked at do this.
On Fri, Apr 25, 2008 at 11:08:49PM +0200, Robert Jarzmik wrote:
Isn't the event api switch "SW_HEADPHONE_INSERT" standard ? I thought it was designed for such use.
Yes. It'll also need extending to cover things that can detect jack insertions other than headphones (espcailly usefully for devices that can identify what is plugged into the jack).
If I'm not mistaken, the Neo teams handles it that way, as I do for the mio : -> input_report_switch(mioa701_evdev, SW_HEADPHONE_INSERT, val);
Indeed, and hopefully it'll get more widely adopted, at least for embedded stuff. Unfortunately adoption is currently rather limited - the only in-tree users are the Zaurus machines.
I'm currently working on some helpers for ALSA for this.
participants (6)
-
Lennart Poettering
-
Mark Brown
-
Robert Jarzmik
-
Sean Thayne
-
Timur Tabi
-
Tobin Davis