On Fri, 2012-08-17 at 08:12 +0200, Mikel Astiz wrote: > From: Mikel Astiz <mikel.astiz at bmw-carit.de> > > Property bluetooth.profile did make a distinction between A2DP sink and > source roles but on the contrary did not separate HFP roles (headset vs > gateway). For consistency, they should both behave similarly. > > This automatically fixes another incosistency: the HFGW (or HSP) sink > was set to bluetooth.profile="sco", while the source was set to "hsp". > There is no use for this distinction, since the protocol (including the > role) is the same. You're talking about "bluetooth.profile", when the property name is actually "bluetooth.protocol". If the property value is going to have 1:1 mapping to profiles, then "bluetooth.profile" would indeed be a better name, and I wouldn't mind if this patch changed the property name to "bluetooth.profile". > --- > src/modules/bluetooth/module-bluetooth-device.c | 23 +++++++++++++++++++---- > 1 files changed, 19 insertions(+), 4 deletions(-) > > diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c > index 5ef5487..cf97649 100644 > --- a/src/modules/bluetooth/module-bluetooth-device.c > +++ b/src/modules/bluetooth/module-bluetooth-device.c > @@ -1466,6 +1466,21 @@ static void connect_ports(struct userdata *u, void *sink_or_source_new_data, pa_ > } > } > > +static const char *profile_to_protocol(enum profile profile) { I'd prefer "profile_to_string". > + switch(profile) { > + case PROFILE_A2DP: > + return "a2dp"; > + case PROFILE_A2DP_SOURCE: > + return "a2dp_source"; > + case PROFILE_HSP: > + return "hsp"; > + case PROFILE_HFGW: > + return "hfgw"; > + default: > + return ""; pa_assert_not_reached() can be used. Also, there should be one more level of indentation inside the switch block. -- Tanu