On Tue, 2011-11-01 at 22:56 +0800, Lin, Mengdong wrote: > > > How about making profile switch more general? > > > > > > 1. When a card adds a new profile, add a property "intended roles" to the > > profile, same as what we do to a device: > > > Add a line to proplist.h > > > #define PA_PROP_DEVICE_PROFILE_DESCRIPTION "device.profile. > > intended_roles" > > > > Other than on Bluetooth (and *maybe* USB devices with sufficient > > metadata), there really isn't a way to accurately tag a sink (especially > > ALSA sink) with an intended role. > > > > > 2. Then the module-device-switch can query the profile intended roles and > > select the best profile for a stream. > > > > > > Is this doable? If yes, I can write a patch for it and change the Bluetooth > > device module to add "phone" property for "hsp" profile? > > > > This is already done in the bluetooth module. > > > > My suggestions is to *not* to tag a sink with an intended role, but to tag a profile with an intended role. > So the module-profile-switch can set the best profile for a steam. > > For an ALSA card, I think it can also has different profiles for different purpose. e.g. surround profile for HiFi, and stereo input+output profile for phone. Ah, sorry, I misread your suggestion earlier. I'm not sure this is the right approach. The intended role really is a property of the sink, not the profile. The main problem being that we can't see sinks that will be created by a profile. I think this came up before, possibly in some jack detection discussion, but perhaps there is room to create some sort of dormant sink(s) attached to a profile that is not usable for routing but can be looked at for such purposes. -- Arun