All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v0 0/3] Prefer PAN over DUN
@ 2012-06-04 14:11 Daniel Wagner
  2012-06-04 14:11 ` [PATCH v0 1/3] bluetooth: Add list of UUIDs to probe function Daniel Wagner
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Daniel Wagner @ 2012-06-04 14:11 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 950 bytes --]

From: Daniel Wagner <daniel.wagner@bmw-carit.de>

Hi,

So here is the first oFono version for the "prefer pan over dun"
feature. Since this is a policy thing, it makes sense to place this
inside dundee and not inside ConnMan or BlueZ.

I am not really happy to pass in the UUIDs but I found it a lot nicer
than adding a 'filter' callback to struct bluetooth_profile. 

Another idea how to implement it I had was, adding a blacklist when
registering the profile.

Let's start with the simplest possible solution.

cheers,
daniel

Daniel Wagner (3):
  bluetooth: Add list of UUIDs to probe function
  bluetooth: Add PAN UUID
  dundee: Ignore DUN device if PAN is present

 dundee/bluetooth.c  |   11 ++++++++++-
 plugins/bluetooth.c |    8 +++++---
 plugins/bluetooth.h |    3 ++-
 plugins/hfp_hf.c    |    2 +-
 plugins/sap.c       |    2 +-
 5 files changed, 19 insertions(+), 7 deletions(-)

-- 
1.7.10.130.g36e6c


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v0 1/3] bluetooth: Add list of UUIDs to probe function
  2012-06-04 14:11 [PATCH v0 0/3] Prefer PAN over DUN Daniel Wagner
@ 2012-06-04 14:11 ` Daniel Wagner
  2012-06-04 14:11 ` [PATCH v0 2/3] bluetooth: Add PAN UUID Daniel Wagner
  2012-06-04 14:11 ` [PATCH v0 3/3] dundee: Ignore DUN device if PAN is present Daniel Wagner
  2 siblings, 0 replies; 5+ messages in thread
From: Daniel Wagner @ 2012-06-04 14:11 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2978 bytes --]

From: Daniel Wagner <daniel.wagner@bmw-carit.de>

---
 dundee/bluetooth.c  |    2 +-
 plugins/bluetooth.c |    8 +++++---
 plugins/bluetooth.h |    2 +-
 plugins/hfp_hf.c    |    2 +-
 plugins/sap.c       |    2 +-
 5 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/dundee/bluetooth.c b/dundee/bluetooth.c
index e2e2bca..5a913cc 100644
--- a/dundee/bluetooth.c
+++ b/dundee/bluetooth.c
@@ -132,7 +132,7 @@ struct dundee_device_driver bluetooth_driver = {
 	.disconnect = bt_disconnect,
 };
 
-static int bt_probe(const char *path, const char *dev_addr,
+static int bt_probe(GSList *uuids, const char *path, const char *dev_addr,
 				const char *adapter_addr, const char *alias)
 {
 	struct bluetooth_device *bt;
diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index dbf79eb..0be6000 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -265,16 +265,18 @@ static void bluetooth_probe(GSList *uuids, const char *path,
 				const char *device, const char *adapter,
 				const char *alias)
 {
-	for (; uuids; uuids = uuids->next) {
+	GSList *l;
+
+	for (l = uuids; l; l = l->next) {
 		struct bluetooth_profile *driver;
-		const char *uuid = uuids->data;
+		const char *uuid = l->data;
 		int err;
 
 		driver = g_hash_table_lookup(uuid_hash, uuid);
 		if (driver == NULL)
 			continue;
 
-		err = driver->probe(path, device, adapter, alias);
+		err = driver->probe(uuids, path, device, adapter, alias);
 		if (err == 0)
 			continue;
 
diff --git a/plugins/bluetooth.h b/plugins/bluetooth.h
index 4fc16ad..c06abf7 100644
--- a/plugins/bluetooth.h
+++ b/plugins/bluetooth.h
@@ -38,7 +38,7 @@
 
 struct bluetooth_profile {
 	const char *name;
-	int (*probe)(const char *device, const char *dev_addr,
+	int (*probe)(GSList *uuids, const char *device, const char *dev_addr,
 			const char *adapter_addr, const char *alias);
 	void (*remove)(const char *prefix);
 	void (*set_alias)(const char *device, const char *);
diff --git a/plugins/hfp_hf.c b/plugins/hfp_hf.c
index 7c500e3..74780b7 100644
--- a/plugins/hfp_hf.c
+++ b/plugins/hfp_hf.c
@@ -206,7 +206,7 @@ static const GDBusMethodTable agent_methods[] = {
 	{ }
 };
 
-static int hfp_hf_probe(const char *device, const char *dev_addr,
+static int hfp_hf_probe(GSList *uuids, const char *device, const char *dev_addr,
 				const char *adapter_addr, const char *alias)
 {
 	struct ofono_modem *modem;
diff --git a/plugins/sap.c b/plugins/sap.c
index d893bc1..7f728f9 100644
--- a/plugins/sap.c
+++ b/plugins/sap.c
@@ -235,7 +235,7 @@ static void sap_post_online(struct ofono_modem *modem)
 	data->sap_driver->post_online(data->hw_modem);
 }
 
-static int bluetooth_sap_probe(const char *device, const char *dev_addr,
+static int bluetooth_sap_probe(GSList *uuds, const char *device, const char *dev_addr,
 				const char *adapter_addr, const char *alias)
 {
 	struct ofono_modem *modem;
-- 
1.7.10.130.g36e6c


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v0 2/3] bluetooth: Add PAN UUID
  2012-06-04 14:11 [PATCH v0 0/3] Prefer PAN over DUN Daniel Wagner
  2012-06-04 14:11 ` [PATCH v0 1/3] bluetooth: Add list of UUIDs to probe function Daniel Wagner
@ 2012-06-04 14:11 ` Daniel Wagner
  2012-06-04 14:11 ` [PATCH v0 3/3] dundee: Ignore DUN device if PAN is present Daniel Wagner
  2 siblings, 0 replies; 5+ messages in thread
From: Daniel Wagner @ 2012-06-04 14:11 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 637 bytes --]

From: Daniel Wagner <daniel.wagner@bmw-carit.de>

---
 plugins/bluetooth.h |    1 +
 1 file changed, 1 insertion(+)

diff --git a/plugins/bluetooth.h b/plugins/bluetooth.h
index c06abf7..e801bfc 100644
--- a/plugins/bluetooth.h
+++ b/plugins/bluetooth.h
@@ -32,6 +32,7 @@
 #define DBUS_TIMEOUT 15
 
 #define DUN_GW_UUID	"00001103-0000-1000-8000-00805f9b34fb"
+#define NAP_UUID	"00001116-0000-1000-8000-00805f9b34fb"
 #define HFP_AG_UUID	"0000111f-0000-1000-8000-00805f9b34fb"
 #define HFP_HS_UUID	"0000111e-0000-1000-8000-00805f9b34fb"
 #define SAP_UUID	"0000112d-0000-1000-8000-00805f9b34fb"
-- 
1.7.10.130.g36e6c


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v0 3/3] dundee: Ignore DUN device if PAN is present
  2012-06-04 14:11 [PATCH v0 0/3] Prefer PAN over DUN Daniel Wagner
  2012-06-04 14:11 ` [PATCH v0 1/3] bluetooth: Add list of UUIDs to probe function Daniel Wagner
  2012-06-04 14:11 ` [PATCH v0 2/3] bluetooth: Add PAN UUID Daniel Wagner
@ 2012-06-04 14:11 ` Daniel Wagner
  2012-06-04 14:14   ` Daniel Wagner
  2 siblings, 1 reply; 5+ messages in thread
From: Daniel Wagner @ 2012-06-04 14:11 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 793 bytes --]

From: Daniel Wagner <daniel.wagner@bmw-carit.de>

---
 dundee/bluetooth.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/dundee/bluetooth.c b/dundee/bluetooth.c
index 5a913cc..8762f51 100644
--- a/dundee/bluetooth.c
+++ b/dundee/bluetooth.c
@@ -141,6 +141,15 @@ static int bt_probe(GSList *uuids, const char *path, const char *dev_addr,
 
 	DBG("");
 
+	for (; uuids; uuids = uuids->next) {
+		const char *uuid = uuids->data;
+
+		if (g_strcmp0(uuid, NAP_UUID) == 0) {
+			ofono_info("Device %s supports DUN and PAN at the same time. DUN is ignored", path);
+			return -EUNATCH;
+		}
+	}
+
 	/* We already have this device in our hash, ignore */
 	if (g_hash_table_lookup(bluetooth_hash, path) != NULL)
 		return -EALREADY;
-- 
1.7.10.130.g36e6c


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v0 3/3] dundee: Ignore DUN device if PAN is present
  2012-06-04 14:11 ` [PATCH v0 3/3] dundee: Ignore DUN device if PAN is present Daniel Wagner
@ 2012-06-04 14:14   ` Daniel Wagner
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Wagner @ 2012-06-04 14:14 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 715 bytes --]

On 04.06.2012 16:11, Daniel Wagner wrote:
> From: Daniel Wagner <daniel.wagner@bmw-carit.de>
> 
> ---
>  dundee/bluetooth.c |    9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/dundee/bluetooth.c b/dundee/bluetooth.c
> index 5a913cc..8762f51 100644
> --- a/dundee/bluetooth.c
> +++ b/dundee/bluetooth.c
> @@ -141,6 +141,15 @@ static int bt_probe(GSList *uuids, const char *path, const char *dev_addr,
>  
>  	DBG("");
>  
> +	for (; uuids; uuids = uuids->next) {
> +		const char *uuid = uuids->data;
> +
> +		if (g_strcmp0(uuid, NAP_UUID) == 0) {
> +			ofono_info("Device %s supports DUN and PAN at the same time. DUN is ignored", path);

argh, this line is a bit too long...

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-06-04 14:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-04 14:11 [PATCH v0 0/3] Prefer PAN over DUN Daniel Wagner
2012-06-04 14:11 ` [PATCH v0 1/3] bluetooth: Add list of UUIDs to probe function Daniel Wagner
2012-06-04 14:11 ` [PATCH v0 2/3] bluetooth: Add PAN UUID Daniel Wagner
2012-06-04 14:11 ` [PATCH v0 3/3] dundee: Ignore DUN device if PAN is present Daniel Wagner
2012-06-04 14:14   ` Daniel Wagner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.