Hi Colin, David<br><br>I can see David posts on the group recently and assuming David is back from vacations :)<br>unfortunately we don&#39;t access to IRC chat due to some security restriction (thou we are working to get this sorted, if possible) so currently I can discuss only over group emails.<br>


<br><div class="gmail_quote">On Fri, Jul 22, 2011 at 1:42 AM, Colin Guthrie <span dir="ltr">&lt;<a href="mailto:gmane@colin.guthr.ie" target="_blank">gmane@colin.guthr.ie</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


&#39;Twas brillig, and Himanshu Chug at 21/07/11 08:24 did gyre and gimble:<br>
<div>&gt; Thanks Colin and Spidey for making this clarification.<br>
&gt;<br>
&gt; So regarding JACK detection and routing:<br>
&gt;<br>
&gt; 1. module-udev-detect currently can detect JACK physical hot-plugging<br>
&gt; but it can&#39;t decode the information about what type of JACK device (<br>
&gt; input or output ) is connected to the sound-card, and for that one need<br>
&gt; to write an JACK detection module to handle that.<br>
&gt; is my understanding correct ?<br>
<br>
</div>Not quite. Udev detect does absolutely nothing with JACKs. It detects<br>
totally new devices in a hotplug way. These devices are e.g. USB<br>
speakers or headsets.<br></blockquote><div><br>one colleague of mine from ALSA /kernel team have wrote the Jack detection app using udev API from libudev, <br>so the Jack plug in/plug Out state can be read at <font color="#000099">sys/devices/virtual/<span>switch</span>/h2w/state<br>


</font><div><font color="#000099">
</font></div><div><font color="#000099">                </font>State   Meaning<br>                   0    No Headset Connected<br>                   1    Headset with MIC connected   <br></div>
<div>                   2    Headset without MIC connected<br><br>here we are monitoring in a loop using udev monitor fd and based on the &quot;state&quot; we are calling kcontrols for loudspeaker and headset<br>something like here...<br>


<br>fd = udev_monitor_get_fd(mon);<br> <br>while (1) {<br>............<br>r = select(fd, ...);<br><br>dev = udev_monitor_receive_device(mon);<br>if (dev) {<br>    // Jack Inserted/Removed <br>   Jack_Report(state); // this function will call kcontrols for headset/loudspeaker based on &quot;state&quot;<br>


}<br>............<br>}<br><br>I am trying to understand if this approach of Jack detection is fine? at-least I need to know if I am going in right direction? <br></div>

 <br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
The actual HP Jack detection stuff is not present at all in PA as the<br>
underlying layers in ALSA are in flux. These need to settle before we<br>
can write anything to deal with them.<br></blockquote><div><br>As Colin comments about ALSA layers are in flux, I need to understand this bit more some brief information about this problem with ALSA ?<br>if you can point to some link or so is also fine :)<br>
<br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


<br>
There are active discussions on this topic just now on the alsa-devel<br>
mailing list.<br>
<div><br>
<br>
&gt; 2 Currently our Kernel/ALSA team support for providing seperate kcontrol<br>
&gt; (amixer scripts) for enabling/disabling loudspeaker and headset to PA,<br>
&gt; so it might be an good idea to handle Jack detection and routing in one<br>
&gt; of the existing module or write up an new jack detection module for<br>
&gt; this, as Colin suggested, provided that we are able to recognize Jack<br>
&gt; device type  (input/mic or output/headset or both)  from point 1, ( i<br>
&gt; will take further help from kernel team here about detecting jack device<br>
&gt; type, but any suggestions are welcome :-) )<br>
<br>
</div>Kinda. PA should be able to display to you the different &quot;ports&quot; for<br>
each sink. These ports represent the Speakers or the Headphones<br>
kcontrols that are on your device and you can change ports at runtime<br>
(just run pavucontrol and if your sinks actually have ports, there will<br>
be a drop downo n the &quot;Output Devices&quot; pane). </blockquote><div><br>I am not able to get pavucontrol installed and working on my rootstrap, due to some other issues, but I need to test this out also soon.<br>
but I tried on UBUNTU 10.10 desktop, pavucontrol app showing me the dropdown for Output Devices, <br>
 </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">At present you have to<br>
change ports manually but the plan is to hook this up to jack detection,<br>
such that the port is simply flipped accordingly.<br></blockquote><div><br>I need to know where (or how) in code we can do &quot;flipping of ports from headphones to loudspeaker&quot; <br>if I use our udev API for jack detection from above ? <br>
 </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
Multifunction jacks (i.e. those that can be input or output, analog or<br>
digital) are even more interesting :)<br>
<br>
<br>
I very strongly suggest you discuss this with David Henningsson. He&#39;s on<br>
this list but is away on vacation for (I think) another week. He&#39;s is<br>
actively working on JACK support for ALSA and PA layers so it will<br>
likely be the most productive for you if you wait and speak with him.<br>
He&#39;s employed by Canonical and is diwic on IRC.<br>
<div><div></div><div><br>
<br>
Col<br>
<br>
<br>
--<br>
<br>
Colin Guthrie<br>
gmane(at)<a href="http://colin.guthr.ie" target="_blank">colin.guthr.ie</a><br>
<a href="http://colin.guthr.ie/" target="_blank">http://colin.guthr.ie/</a><br>
<br>
Day Job:<br>
  Tribalogic Limited [<a href="http://www.tribalogic.net/" target="_blank">http://www.tribalogic.net/</a>]<br>
Open Source:<br>
  Mageia Contributor [<a href="http://www.mageia.org/" target="_blank">http://www.mageia.org/</a>]<br>
  PulseAudio Hacker [<a href="http://www.pulseaudio.org/" target="_blank">http://www.pulseaudio.org/</a>]<br>
  Trac Hacker [<a href="http://trac.edgewall.org/" target="_blank">http://trac.edgewall.org/</a>]<br>
</div></div></blockquote></div><br>