[PATCH v11 10/12] audio: Replace headset and gateway by telephony

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Replace Headset and Gateway configuration options by new
Telephony option.
Remove HFP option  in Headset section as it is no more
relevant.
---
 audio/audio.conf |    6 +---
 audio/manager.c  |   90 ++++++++++++------------------------------------------
 audio/manager.h  |    4 +--
 3 files changed, 22 insertions(+), 78 deletions(-)

diff --git a/audio/audio.conf b/audio/audio.conf
index fd6092a..d3e6447 100644
--- a/audio/audio.conf
+++ b/audio/audio.conf
@@ -9,7 +9,7 @@
 
 # If we want to disable support for specific services
 # Defaults to supporting all implemented services
-#Disable=Gateway,Source,Socket
+#Disable=Source,Socket
 
 # SCO routing. Either PCM or HCI (in which case audio is routed to/from ALSA)
 # Defaults to HCI
@@ -25,10 +25,6 @@
 # service interacts with remote headset devices)
 [Headset]
 
-# Set to true to support HFP, false means only HSP is supported
-# Defaults to true
-HFP=true
-
 # Maximum number of connected HSP/HFP devices per adapter. Defaults to 1
 MaxConnected=1
 
diff --git a/audio/manager.c b/audio/manager.c
index 359a0cf..15db2f3 100644
--- a/audio/manager.c
+++ b/audio/manager.c
@@ -102,9 +102,7 @@ static GSList *adapters = NULL;
 static GSList *devices = NULL;
 
 static struct enabled_interfaces enabled = {
-	.hfp		= TRUE,
-	.headset	= TRUE,
-	.gateway	= FALSE,
+	.telephony	= TRUE,
 	.sink		= TRUE,
 	.source		= FALSE,
 	.control	= TRUE,
@@ -129,13 +127,13 @@ gboolean server_is_enabled(bdaddr_t *src, uint16_t svc)
 {
 	switch (svc) {
 	case HEADSET_SVCLASS_ID:
-		return enabled.headset;
+		return enabled.telephony;
 	case HEADSET_AGW_SVCLASS_ID:
 		return FALSE;
 	case HANDSFREE_SVCLASS_ID:
-		return enabled.headset && enabled.hfp;
+		return enabled.telephony;
 	case HANDSFREE_AGW_SVCLASS_ID:
-		return enabled.gateway;
+		return enabled.telephony;
 	case AUDIO_SINK_SVCLASS_ID:
 		return enabled.sink;
 	case AUDIO_SOURCE_SVCLASS_ID:
@@ -192,7 +190,7 @@ static void handle_uuid(const char *uuidstr, struct audio_device *device)
 		break;
 	case HANDSFREE_AGW_SVCLASS_ID:
 		DBG("Found Handsfree AG record");
-		if (enabled.gateway && (device->gateway == NULL))
+		if (enabled.telephony && (device->gateway == NULL))
 			device->gateway = gateway_init(device);
 		break;
 	case AUDIO_SINK_SVCLASS_ID:
@@ -352,7 +350,7 @@ static void state_changed(struct btd_adapter *adapter, gboolean powered)
 	telephony = FALSE;
 }
 
-static int headset_server_probe(struct btd_adapter *adapter)
+static int telephony_server_probe(struct btd_adapter *adapter)
 {
 	struct audio_adapter *adp;
 	const gchar *path = adapter_get_path(adapter);
@@ -370,7 +368,7 @@ static int headset_server_probe(struct btd_adapter *adapter)
 	return 0;
 }
 
-static void headset_server_remove(struct btd_adapter *adapter)
+static void telephony_server_remove(struct btd_adapter *adapter)
 {
 	struct audio_adapter *adp;
 	const gchar *path = adapter_get_path(adapter);
@@ -386,31 +384,6 @@ static void headset_server_remove(struct btd_adapter *adapter)
 	audio_adapter_unref(adp);
 }
 
-static int gateway_server_probe(struct btd_adapter *adapter)
-{
-	struct audio_adapter *adp;
-
-	adp = audio_adapter_get(adapter);
-	if (!adp)
-		return -EINVAL;
-
-	return 0;
-}
-
-static void gateway_server_remove(struct btd_adapter *adapter)
-{
-	struct audio_adapter *adp;
-	const gchar *path = adapter_get_path(adapter);
-
-	DBG("path %s", path);
-
-	adp = find_adapter(adapters, adapter);
-	if (!adp)
-		return;
-
-	audio_adapter_unref(adp);
-}
-
 static int a2dp_server_probe(struct btd_adapter *adapter)
 {
 	struct audio_adapter *adp;
@@ -535,16 +508,10 @@ static struct btd_device_driver audio_driver = {
 	.remove	= audio_remove,
 };
 
-static struct btd_adapter_driver headset_server_driver = {
-	.name	= "audio-headset",
-	.probe	= headset_server_probe,
-	.remove	= headset_server_remove,
-};
-
-static struct btd_adapter_driver gateway_server_driver = {
-	.name	= "audio-gateway",
-	.probe	= gateway_server_probe,
-	.remove	= gateway_server_remove,
+static struct btd_adapter_driver telephony_server_driver = {
+	.name	= "telephony",
+	.probe	= telephony_server_probe,
+	.remove	= telephony_server_remove,
 };
 
 static struct btd_adapter_driver a2dp_server_driver = {
@@ -583,10 +550,8 @@ int audio_manager_init(DBusConnection *conn, GKeyFile *conf,
 	list = g_key_file_get_string_list(config, "General", "Enable",
 						NULL, NULL);
 	for (i = 0; list && list[i] != NULL; i++) {
-		if (g_str_equal(list[i], "Headset"))
-			enabled.headset = TRUE;
-		else if (g_str_equal(list[i], "Gateway"))
-			enabled.gateway = TRUE;
+		if (g_str_equal(list[i], "Telephony"))
+			enabled.telephony = TRUE;
 		else if (g_str_equal(list[i], "Sink"))
 			enabled.sink = TRUE;
 		else if (g_str_equal(list[i], "Source"))
@@ -604,10 +569,8 @@ int audio_manager_init(DBusConnection *conn, GKeyFile *conf,
 	list = g_key_file_get_string_list(config, "General", "Disable",
 						NULL, NULL);
 	for (i = 0; list && list[i] != NULL; i++) {
-		if (g_str_equal(list[i], "Headset"))
-			enabled.headset = FALSE;
-		else if (g_str_equal(list[i], "Gateway"))
-			enabled.gateway = FALSE;
+		if (g_str_equal(list[i], "Telephony"))
+			enabled.telephony = FALSE;
 		else if (g_str_equal(list[i], "Sink"))
 			enabled.sink = FALSE;
 		else if (g_str_equal(list[i], "Source"))
@@ -628,13 +591,6 @@ int audio_manager_init(DBusConnection *conn, GKeyFile *conf,
 	} else
 		auto_connect = b;
 
-	b = g_key_file_get_boolean(config, "Headset", "HFP",
-					&err);
-	if (err)
-		g_clear_error(&err);
-	else
-		enabled.hfp = b;
-
 	err = NULL;
 	i = g_key_file_get_integer(config, "Headset", "MaxConnected",
 					&err);
@@ -651,11 +607,8 @@ proceed:
 	if (enabled.media)
 		btd_register_adapter_driver(&media_server_driver);
 
-	if (enabled.headset)
-		btd_register_adapter_driver(&headset_server_driver);
-
-	if (enabled.gateway)
-		btd_register_adapter_driver(&gateway_server_driver);
+	if (enabled.telephony)
+		btd_register_adapter_driver(&telephony_server_driver);
 
 	if (enabled.source || enabled.sink)
 		btd_register_adapter_driver(&a2dp_server_driver);
@@ -665,7 +618,7 @@ proceed:
 
 	btd_register_device_driver(&audio_driver);
 
-	*enable_sco = (enabled.gateway || enabled.headset);
+	*enable_sco = (enabled.telephony);
 
 	return 0;
 }
@@ -690,11 +643,8 @@ void audio_manager_exit(void)
 	if (enabled.media)
 		btd_unregister_adapter_driver(&media_server_driver);
 
-	if (enabled.headset)
-		btd_unregister_adapter_driver(&headset_server_driver);
-
-	if (enabled.gateway)
-		btd_unregister_adapter_driver(&gateway_server_driver);
+	if (enabled.telephony)
+		btd_unregister_adapter_driver(&telephony_server_driver);
 
 	if (enabled.source || enabled.sink)
 		btd_unregister_adapter_driver(&a2dp_server_driver);
diff --git a/audio/manager.h b/audio/manager.h
index f1d3021..645134c 100644
--- a/audio/manager.h
+++ b/audio/manager.h
@@ -23,9 +23,7 @@
  */
 
 struct enabled_interfaces {
-	gboolean hfp;
-	gboolean headset;
-	gboolean gateway;
+	gboolean telephony;
 	gboolean sink;
 	gboolean source;
 	gboolean control;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux