[pulseaudio-discuss] [PATCH] bluetooth: bluez4: For each bluetooth profile use different port names

Pali Rohár pali.rohar at gmail.com
Thu Sep 25 06:12:23 PDT 2014


Here is second part of patch which changes also port descriptions:

diff --git a/src/modules/bluetooth/module-bluez4-device.c b/src/modules/bluetooth/module-bluez4-
device.c
index e1368f0..1093744 100644
--- a/src/modules/bluetooth/module-bluez4-device.c
+++ b/src/modules/bluetooth/module-bluez4-device.c
@@ -159,6 +159,13 @@ struct userdata {
     char *input_hsp_port_name;
     char *input_hfgw_port_name;
 
+    char *output_a2dp_port_desc;
+    char *output_hsp_port_desc;
+    char *output_hfgw_port_desc;
+    char *input_a2dp_port_desc;
+    char *input_hsp_port_desc;
+    char *input_hfgw_port_desc;
+
     pa_card *card;
     pa_sink *sink;
     pa_source *source;
@@ -2191,9 +2198,16 @@ static void create_card_ports(struct userdata *u, pa_hashmap *ports) {
     u->input_hsp_port_name = pa_sprintf_malloc("%s-input-hsp", name_prefix);
     u->input_hfgw_port_name = pa_sprintf_malloc("%s-input-hfgw", name_prefix);
 
+    u->output_a2dp_port_desc = pa_sprintf_malloc("%s %s", output_description, _("A2DP"));
+    u->output_hsp_port_desc = pa_sprintf_malloc("%s %s", output_description, _("HSP"));
+    u->output_hfgw_port_desc = pa_sprintf_malloc("%s %s", output_description, _("HFGW"));
+    u->input_a2dp_port_desc = pa_sprintf_malloc("%s %s", input_description, _("A2DP"));
+    u->input_hsp_port_desc = pa_sprintf_malloc("%s %s", input_description, _("HSP"));
+    u->input_hfgw_port_desc = pa_sprintf_malloc("%s %s", input_description, _("HFGW"));
+
     pa_device_port_new_data_init(&port_data);
     pa_device_port_new_data_set_name(&port_data, u->output_a2dp_port_name);
-    pa_device_port_new_data_set_description(&port_data, output_description);
+    pa_device_port_new_data_set_description(&port_data, u->output_a2dp_port_desc);
     pa_device_port_new_data_set_direction(&port_data, PA_DIRECTION_OUTPUT);
     pa_device_port_new_data_set_available(&port_data, get_port_availability(u, PA_DIRECTION_OUTPUT, 
PA_BLUEZ4_PROFILE_A2DP));
     pa_assert_se(port = pa_device_port_new(u->core, &port_data, 0));
@@ -2202,7 +2216,7 @@ static void create_card_ports(struct userdata *u, pa_hashmap *ports) {
 
     pa_device_port_new_data_init(&port_data);
     pa_device_port_new_data_set_name(&port_data, u->output_hsp_port_name);
-    pa_device_port_new_data_set_description(&port_data, output_description);
+    pa_device_port_new_data_set_description(&port_data, u->output_hsp_port_desc);
     pa_device_port_new_data_set_direction(&port_data, PA_DIRECTION_OUTPUT);
     pa_device_port_new_data_set_available(&port_data, get_port_availability(u, PA_DIRECTION_OUTPUT, 
PA_BLUEZ4_PROFILE_HSP));
     pa_assert_se(port = pa_device_port_new(u->core, &port_data, 0));
@@ -2211,7 +2225,7 @@ static void create_card_ports(struct userdata *u, pa_hashmap *ports) {
 
     pa_device_port_new_data_init(&port_data);
     pa_device_port_new_data_set_name(&port_data, u->output_hfgw_port_name);
-    pa_device_port_new_data_set_description(&port_data, output_description);
+    pa_device_port_new_data_set_description(&port_data, u->output_hfgw_port_desc);
     pa_device_port_new_data_set_direction(&port_data, PA_DIRECTION_OUTPUT);
     pa_device_port_new_data_set_available(&port_data, get_port_availability(u, PA_DIRECTION_OUTPUT, 
PA_BLUEZ4_PROFILE_HFGW));
     pa_assert_se(port = pa_device_port_new(u->core, &port_data, 0));
@@ -2220,7 +2234,7 @@ static void create_card_ports(struct userdata *u, pa_hashmap *ports) {
 
     pa_device_port_new_data_init(&port_data);
     pa_device_port_new_data_set_name(&port_data, u->input_a2dp_port_name);
-    pa_device_port_new_data_set_description(&port_data, input_description);
+    pa_device_port_new_data_set_description(&port_data, u->input_a2dp_port_desc);
     pa_device_port_new_data_set_direction(&port_data, PA_DIRECTION_INPUT);
     pa_device_port_new_data_set_available(&port_data, get_port_availability(u, PA_DIRECTION_INPUT, 
PA_BLUEZ4_PROFILE_A2DP_SOURCE));
     pa_assert_se(port = pa_device_port_new(u->core, &port_data, 0));
@@ -2229,7 +2243,7 @@ static void create_card_ports(struct userdata *u, pa_hashmap *ports) {
 
     pa_device_port_new_data_init(&port_data);
     pa_device_port_new_data_set_name(&port_data, u->input_hsp_port_name);
-    pa_device_port_new_data_set_description(&port_data, input_description);
+    pa_device_port_new_data_set_description(&port_data, u->input_hsp_port_desc);
     pa_device_port_new_data_set_direction(&port_data, PA_DIRECTION_INPUT);
     pa_device_port_new_data_set_available(&port_data, get_port_availability(u, PA_DIRECTION_INPUT, 
PA_BLUEZ4_PROFILE_HSP));
     pa_assert_se(port = pa_device_port_new(u->core, &port_data, 0));
@@ -2238,7 +2252,7 @@ static void create_card_ports(struct userdata *u, pa_hashmap *ports) {
 
     pa_device_port_new_data_init(&port_data);
     pa_device_port_new_data_set_name(&port_data, u->input_hfgw_port_name);
-    pa_device_port_new_data_set_description(&port_data, input_description);
+    pa_device_port_new_data_set_description(&port_data, u->input_hfgw_port_desc);
     pa_device_port_new_data_set_direction(&port_data, PA_DIRECTION_INPUT);
     pa_device_port_new_data_set_available(&port_data, get_port_availability(u, PA_DIRECTION_INPUT, 
PA_BLUEZ4_PROFILE_HFGW));
     pa_assert_se(port = pa_device_port_new(u->core, &port_data, 0));
@@ -2713,6 +2727,13 @@ void pa__done(pa_module *m) {
     pa_xfree(u->input_hsp_port_name);
     pa_xfree(u->input_hfgw_port_name);
 
+    pa_xfree(u->output_a2dp_port_desc);
+    pa_xfree(u->output_hsp_port_desc);
+    pa_xfree(u->output_hfgw_port_desc);
+    pa_xfree(u->input_a2dp_port_desc);
+    pa_xfree(u->input_hsp_port_desc);
+    pa_xfree(u->input_hfgw_port_desc);
+
     pa_xfree(u->address);
     pa_xfree(u->path);
 

-- 
Pali Rohár
pali.rohar at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20140925/bd4c643e/attachment.sig>


More information about the pulseaudio-discuss mailing list