Hi David, On Tue, Aug 27, 2013 at 12:27 AM, David Henningsson <david.henningsson at canonical.com> wrote: > On 08/26/2013 08:15 PM, Felipe F. Tonello wrote: >> From: "Felipe F. Tonello" <eu at felipetonello.com> >> >> This fixes a bug when switching profiles under ALSA UCM. If a jack, hence a >> port, was previsouly active, when PA performed a profile switch, the jack >> would continue to be available but not active. >> >> This patche ensures that it activates a port if a jack is previously connected. > > Thanks, > but I'm not sure this is the right way to do it. > > It feels like setting the active port is more like something for a > policy module (e g module-switch-on-port-available), rather than being > hardcoded in the module itself. With today's implementation it doesn't work, since if you switch profiles the jack won't change its state, so module-switch-on-port-available will not notice that. What it could be done is to ensure when you create a sink/source, to report jack state, but this is a local function in alsa-module-card. It would need more hack to make it work. Also, this is not hardcode the port, since the sink/source it self does that, it checks if someone else set active_port before, otherwise sets itself. IHMO this patch is less intrusive. > > Also, what if two jacks are both available at the time of the profile > switch? Like I said on the second message, I re-implemented it sorting by priority. PS: One comment about module-switch-on-port-available is that it needs to be loaded before module-alsa-card(also udev detect, if using it) in order to switch to the port if a jack was connected before PA. Felipe Tonello