2012-05-31 13:43:24

by Daniel Wagner

[permalink] [raw]
Subject: [PATCH v3 00/14] Prefer PAN over DUN

From: Daniel Wagner <[email protected]>

Hi,

This version moves the UUID strings into the lib instead of the core.
I tried to do get rid of the UUID string using the *_SVCLASS_ID from sdp.h
but it is hard to do string magic during precompile time...

cheers,
daniel

changes:

v3: - Move UUID strings into lib

v2: - Move all UUID string definition into one header file
- Change configuration variable name
- This behavior is off by default

Daniel Wagner (14):
sdp: Remove unused BASE_UUID definition
audio: Move UUID string definition to lib
network: Move UUID string definition to lib
deviceinfo: Move UUID string definition to lib
proximity: Move UUID string definition to lib
sap: Move UUID string definition to lib
thermometer: Move UUID string definition to lib
serial: Move UUID string definition to lib
health: Move UUID string definition to lib
input: Move UUID string definition to lib
pnat: Move UUID string definition to lib
core: Move UUID string definition to lib
main: Add PreferPANoverDUN configuration switch
device: Ignore DUN if PAN is present

audio/avctp.c | 1 +
audio/avdtp.c | 1 +
audio/avrcp.c | 1 +
audio/device.h | 16 --------------
audio/manager.c | 1 +
audio/media.c | 2 ++
audio/transport.c | 2 ++
deviceinfo/deviceinfo.c | 2 --
deviceinfo/manager.c | 2 --
health/hdp_manager.c | 1 +
health/hdp_types.h | 4 ----
health/hdp_util.c | 1 +
input/device.c | 1 +
input/device.h | 3 ---
input/manager.c | 1 +
input/server.c | 1 +
lib/sdp.c | 2 --
lib/uuid.h | 51 +++++++++++++++++++++++++++++++++++++++++++++
network/common.c | 1 +
network/common.h | 5 -----
network/manager.c | 1 +
network/server.c | 1 +
plugins/pnat.c | 4 ++--
proximity/manager.c | 4 ----
proximity/reporter.c | 2 --
sap/server.c | 2 +-
serial/manager.c | 3 +--
src/device.c | 19 ++++++++++++++++-
src/hcid.h | 1 +
src/main.c | 8 +++++++
src/main.conf | 5 +++++
src/storage.c | 1 +
src/storage.h | 2 --
thermometer/manager.c | 2 --
thermometer/thermometer.c | 5 -----
35 files changed, 104 insertions(+), 55 deletions(-)

--
1.7.10.130.g36e6c



2012-05-31 13:43:28

by Daniel Wagner

[permalink] [raw]
Subject: [PATCH v3 04/14] deviceinfo: Move UUID string definition to lib

From: Daniel Wagner <[email protected]>

---
deviceinfo/deviceinfo.c | 2 --
deviceinfo/manager.c | 2 --
lib/uuid.h | 3 +++
3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/deviceinfo/deviceinfo.c b/deviceinfo/deviceinfo.c
index 5dd9293..8c3af93 100644
--- a/deviceinfo/deviceinfo.c
+++ b/deviceinfo/deviceinfo.c
@@ -37,8 +37,6 @@
#include "log.h"
#include "deviceinfo.h"

-#define PNPID_UUID "00002a50-0000-1000-8000-00805f9b34fb"
-
struct deviceinfo {
struct btd_device *dev; /* Device reference */
GAttrib *attrib; /* GATT connection */
diff --git a/deviceinfo/manager.c b/deviceinfo/manager.c
index c2378c2..1d59918 100644
--- a/deviceinfo/manager.c
+++ b/deviceinfo/manager.c
@@ -32,8 +32,6 @@
#include "deviceinfo.h"
#include "manager.h"

-#define DEVICE_INFORMATION_UUID "0000180a-0000-1000-8000-00805f9b34fb"
-
static gint primary_uuid_cmp(gconstpointer a, gconstpointer b)
{
const struct gatt_primary *prim = a;
diff --git a/lib/uuid.h b/lib/uuid.h
index 848baed..713075e 100644
--- a/lib/uuid.h
+++ b/lib/uuid.h
@@ -53,6 +53,9 @@ extern "C" {
#define GN_UUID "00001117-0000-1000-8000-00805f9b34fb"
#define BNEP_SVC_UUID "0000000f-0000-1000-8000-00805f9b34fb"

+#define PNPID_UUID "00002a50-0000-1000-8000-00805f9b34fb"
+#define DEVICE_INFORMATION_UUID "0000180a-0000-1000-8000-00805f9b34fb"
+
typedef struct {
enum {
BT_UUID_UNSPEC = 0,
--
1.7.10.130.g36e6c


2012-05-31 13:43:30

by Daniel Wagner

[permalink] [raw]
Subject: [PATCH v3 06/14] sap: Move UUID string definition to lib

From: Daniel Wagner <[email protected]>

---
lib/uuid.h | 2 ++
sap/server.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/uuid.h b/lib/uuid.h
index 86679a9..71af5ae 100644
--- a/lib/uuid.h
+++ b/lib/uuid.h
@@ -61,6 +61,8 @@ extern "C" {
#define LINK_LOSS_UUID "00001803-0000-1000-8000-00805f9b34fb"
#define TX_POWER_UUID "00001804-0000-1000-8000-00805f9b34fb"

+#define SAP_UUID "0000112D-0000-1000-8000-00805f9b34fb"
+
typedef struct {
enum {
BT_UUID_UNSPEC = 0,
diff --git a/sap/server.c b/sap/server.c
index c83e68a..f5d19c4 100644
--- a/sap/server.c
+++ b/sap/server.c
@@ -32,6 +32,7 @@
#include <glib.h>
#include <bluetooth/sdp.h>
#include <bluetooth/sdp_lib.h>
+#include <bluetooth/uuid.h>

#include "adapter.h"
#include "btio.h"
@@ -43,7 +44,6 @@
#include "server.h"

#define SAP_SERVER_INTERFACE "org.bluez.SimAccess"
-#define SAP_UUID "0000112D-0000-1000-8000-00805F9B34FB"
#define SAP_SERVER_CHANNEL 8

#define PADDING4(x) ((4 - ((x) & 0x03)) & 0x03)
--
1.7.10.130.g36e6c


2012-05-31 13:43:27

by Daniel Wagner

[permalink] [raw]
Subject: [PATCH v3 03/14] network: Move UUID string definition to lib

From: Daniel Wagner <[email protected]>

---
lib/uuid.h | 5 +++++
network/common.c | 1 +
network/common.h | 5 -----
network/manager.c | 1 +
network/server.c | 1 +
5 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/lib/uuid.h b/lib/uuid.h
index a44426a..848baed 100644
--- a/lib/uuid.h
+++ b/lib/uuid.h
@@ -48,6 +48,11 @@ extern "C" {
#define AVRCP_REMOTE_UUID "0000110e-0000-1000-8000-00805f9b34fb"
#define AVRCP_TARGET_UUID "0000110c-0000-1000-8000-00805f9b34fb"

+#define PANU_UUID "00001115-0000-1000-8000-00805f9b34fb"
+#define NAP_UUID "00001116-0000-1000-8000-00805f9b34fb"
+#define GN_UUID "00001117-0000-1000-8000-00805f9b34fb"
+#define BNEP_SVC_UUID "0000000f-0000-1000-8000-00805f9b34fb"
+
typedef struct {
enum {
BT_UUID_UNSPEC = 0,
diff --git a/network/common.c b/network/common.c
index c498c25..4704072 100644
--- a/network/common.c
+++ b/network/common.c
@@ -39,6 +39,7 @@
#include <bluetooth/bluetooth.h>
#include <bluetooth/l2cap.h>
#include <bluetooth/bnep.h>
+#include <bluetooth/uuid.h>

#include <glib.h>

diff --git a/network/common.h b/network/common.h
index fefb754..cb1f08a 100644
--- a/network/common.h
+++ b/network/common.h
@@ -21,11 +21,6 @@
*
*/

-#define PANU_UUID "00001115-0000-1000-8000-00805f9b34fb"
-#define NAP_UUID "00001116-0000-1000-8000-00805f9b34fb"
-#define GN_UUID "00001117-0000-1000-8000-00805f9b34fb"
-#define BNEP_SVC_UUID "0000000f-0000-1000-8000-00805f9b34fb"
-
int bnep_init(void);
int bnep_cleanup(void);

diff --git a/network/manager.c b/network/manager.c
index dd0f311..7fcd8f0 100644
--- a/network/manager.c
+++ b/network/manager.c
@@ -28,6 +28,7 @@
#include <bluetooth/bluetooth.h>
#include <bluetooth/bnep.h>
#include <bluetooth/sdp.h>
+#include <bluetooth/uuid.h>

#include <glib.h>
#include <gdbus.h>
diff --git a/network/server.c b/network/server.c
index e39769a..480c7e2 100644
--- a/network/server.c
+++ b/network/server.c
@@ -34,6 +34,7 @@
#include <bluetooth/bnep.h>
#include <bluetooth/sdp.h>
#include <bluetooth/sdp_lib.h>
+#include <bluetooth/uuid.h>
#include <netinet/in.h>

#include <glib.h>
--
1.7.10.130.g36e6c


2012-05-31 13:43:31

by Daniel Wagner

[permalink] [raw]
Subject: [PATCH v3 07/14] thermometer: Move UUID string definition to lib

From: Daniel Wagner <[email protected]>

---
lib/uuid.h | 6 ++++++
thermometer/manager.c | 2 --
thermometer/thermometer.c | 5 -----
3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/lib/uuid.h b/lib/uuid.h
index 71af5ae..d47a6af 100644
--- a/lib/uuid.h
+++ b/lib/uuid.h
@@ -63,6 +63,12 @@ extern "C" {

#define SAP_UUID "0000112D-0000-1000-8000-00805f9b34fb"

+#define HEALTH_THERMOMETER_UUID "00001809-0000-1000-8000-00805f9b34fb"
+#define TEMPERATURE_MEASUREMENT_UUID "00002a1c-0000-1000-8000-00805f9b34fb"
+#define TEMPERATURE_TYPE_UUID "00002a1d-0000-1000-8000-00805f9b34fb"
+#define INTERMEDIATE_TEMPERATURE_UUID "00002a1e-0000-1000-8000-00805f9b34fb"
+#define MEASUREMENT_INTERVAL_UUID "00002a21-0000-1000-8000-00805f9b34fb"
+
typedef struct {
enum {
BT_UUID_UNSPEC = 0,
diff --git a/thermometer/manager.c b/thermometer/manager.c
index 8982beb..3d5452b 100644
--- a/thermometer/manager.c
+++ b/thermometer/manager.c
@@ -32,8 +32,6 @@
#include "thermometer.h"
#include "manager.h"

-#define HEALTH_THERMOMETER_UUID "00001809-0000-1000-8000-00805f9b34fb"
-
static DBusConnection *connection = NULL;

static gint primary_uuid_cmp(gconstpointer a, gconstpointer b)
diff --git a/thermometer/thermometer.c b/thermometer/thermometer.c
index 4df9d2c..85f0811 100644
--- a/thermometer/thermometer.c
+++ b/thermometer/thermometer.c
@@ -41,11 +41,6 @@

#define THERMOMETER_INTERFACE "org.bluez.Thermometer"

-#define TEMPERATURE_MEASUREMENT_UUID "00002a1c-0000-1000-8000-00805f9b34fb"
-#define TEMPERATURE_TYPE_UUID "00002a1d-0000-1000-8000-00805f9b34fb"
-#define INTERMEDIATE_TEMPERATURE_UUID "00002a1e-0000-1000-8000-00805f9b34fb"
-#define MEASUREMENT_INTERVAL_UUID "00002a21-0000-1000-8000-00805f9b34fb"
-
/* Temperature measurement flag fields */
#define TEMP_UNITS 0x01
#define TEMP_TIME_STAMP 0x02
--
1.7.10.130.g36e6c


2012-05-31 13:43:32

by Daniel Wagner

[permalink] [raw]
Subject: [PATCH v3 08/14] serial: Move UUID string definition to lib

From: Daniel Wagner <[email protected]>

---
lib/uuid.h | 2 ++
serial/manager.c | 3 +--
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/uuid.h b/lib/uuid.h
index d47a6af..1ed90e0 100644
--- a/lib/uuid.h
+++ b/lib/uuid.h
@@ -69,6 +69,8 @@ extern "C" {
#define INTERMEDIATE_TEMPERATURE_UUID "00002a1e-0000-1000-8000-00805f9b34fb"
#define MEASUREMENT_INTERVAL_UUID "00002a21-0000-1000-8000-00805f9b34fb"

+#define RFCOMM_UUID_STR "00000003-0000-1000-8000-00805f9b34fb"
+
typedef struct {
enum {
BT_UUID_UNSPEC = 0,
diff --git a/serial/manager.c b/serial/manager.c
index b609054..438ba6c 100644
--- a/serial/manager.c
+++ b/serial/manager.c
@@ -45,6 +45,7 @@
#include <bluetooth/sdp.h>
#include <bluetooth/sdp_lib.h>
#include <bluetooth/rfcomm.h>
+#include <bluetooth/uuid.h>

#include <glib.h>
#include <gdbus.h>
@@ -63,8 +64,6 @@
#include "sdpd.h"
#include "glib-helper.h"

-#define RFCOMM_UUID_STR "00000003-0000-1000-8000-00805F9B34FB"
-
static DBusConnection *connection = NULL;

static int serial_probe(struct btd_device *device, const char *uuid)
--
1.7.10.130.g36e6c


2012-05-31 13:43:26

by Daniel Wagner

[permalink] [raw]
Subject: [PATCH v3 02/14] audio: Move UUID string definition to lib

From: Daniel Wagner <[email protected]>

---
audio/avctp.c | 1 +
audio/avdtp.c | 1 +
audio/avrcp.c | 1 +
audio/device.h | 16 ----------------
audio/manager.c | 1 +
audio/media.c | 2 ++
audio/transport.c | 2 ++
lib/uuid.h | 16 ++++++++++++++++
8 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/audio/avctp.c b/audio/avctp.c
index 5f9afa1..ae3c04e 100644
--- a/audio/avctp.c
+++ b/audio/avctp.c
@@ -40,6 +40,7 @@

#include <bluetooth/bluetooth.h>
#include <bluetooth/sdp.h>
+#include <bluetooth/uuid.h>

#include <glib.h>

diff --git a/audio/avdtp.c b/audio/avdtp.c
index 34d49d2..eb3f213 100644
--- a/audio/avdtp.c
+++ b/audio/avdtp.c
@@ -38,6 +38,7 @@
#include <bluetooth/bluetooth.h>
#include <bluetooth/sdp.h>
#include <bluetooth/sdp_lib.h>
+#include <bluetooth/uuid.h>

#include <glib.h>
#include <dbus/dbus.h>
diff --git a/audio/avrcp.c b/audio/avrcp.c
index a040099..89ee112 100644
--- a/audio/avrcp.c
+++ b/audio/avrcp.c
@@ -40,6 +40,7 @@
#include <bluetooth/bluetooth.h>
#include <bluetooth/sdp.h>
#include <bluetooth/sdp_lib.h>
+#include <bluetooth/uuid.h>

#include <glib.h>
#include <dbus/dbus.h>
diff --git a/audio/device.h b/audio/device.h
index 5117fca..75f1da9 100644
--- a/audio/device.h
+++ b/audio/device.h
@@ -22,22 +22,6 @@
*
*/

-#define GENERIC_AUDIO_UUID "00001203-0000-1000-8000-00805f9b34fb"
-
-#define HSP_HS_UUID "00001108-0000-1000-8000-00805f9b34fb"
-#define HSP_AG_UUID "00001112-0000-1000-8000-00805f9b34fb"
-
-#define HFP_HS_UUID "0000111e-0000-1000-8000-00805f9b34fb"
-#define HFP_AG_UUID "0000111f-0000-1000-8000-00805f9b34fb"
-
-#define ADVANCED_AUDIO_UUID "0000110d-0000-1000-8000-00805f9b34fb"
-
-#define A2DP_SOURCE_UUID "0000110a-0000-1000-8000-00805f9b34fb"
-#define A2DP_SINK_UUID "0000110b-0000-1000-8000-00805f9b34fb"
-
-#define AVRCP_REMOTE_UUID "0000110e-0000-1000-8000-00805f9b34fb"
-#define AVRCP_TARGET_UUID "0000110c-0000-1000-8000-00805f9b34fb"
-
struct source;
struct control;
struct target;
diff --git a/audio/manager.c b/audio/manager.c
index 0b21322..d442d1d 100644
--- a/audio/manager.c
+++ b/audio/manager.c
@@ -41,6 +41,7 @@
#include <bluetooth/bluetooth.h>
#include <bluetooth/sdp.h>
#include <bluetooth/sdp_lib.h>
+#include <bluetooth/uuid.h>

#include <glib.h>
#include <dbus/dbus.h>
diff --git a/audio/media.c b/audio/media.c
index 147538c..1956653 100644
--- a/audio/media.c
+++ b/audio/media.c
@@ -29,6 +29,8 @@

#include <errno.h>

+#include <bluetooth/uuid.h>
+
#include <glib.h>
#include <gdbus.h>

diff --git a/audio/transport.c b/audio/transport.c
index 40d093b..1fccff8 100644
--- a/audio/transport.c
+++ b/audio/transport.c
@@ -28,6 +28,8 @@

#include <errno.h>

+#include <bluetooth/uuid.h>
+
#include <glib.h>
#include <gdbus.h>

diff --git a/lib/uuid.h b/lib/uuid.h
index 9c082d3..a44426a 100644
--- a/lib/uuid.h
+++ b/lib/uuid.h
@@ -32,6 +32,22 @@ extern "C" {
#include <stdint.h>
#include <bluetooth/bluetooth.h>

+#define GENERIC_AUDIO_UUID "00001203-0000-1000-8000-00805f9b34fb"
+
+#define HSP_HS_UUID "00001108-0000-1000-8000-00805f9b34fb"
+#define HSP_AG_UUID "00001112-0000-1000-8000-00805f9b34fb"
+
+#define HFP_HS_UUID "0000111e-0000-1000-8000-00805f9b34fb"
+#define HFP_AG_UUID "0000111f-0000-1000-8000-00805f9b34fb"
+
+#define ADVANCED_AUDIO_UUID "0000110d-0000-1000-8000-00805f9b34fb"
+
+#define A2DP_SOURCE_UUID "0000110a-0000-1000-8000-00805f9b34fb"
+#define A2DP_SINK_UUID "0000110b-0000-1000-8000-00805f9b34fb"
+
+#define AVRCP_REMOTE_UUID "0000110e-0000-1000-8000-00805f9b34fb"
+#define AVRCP_TARGET_UUID "0000110c-0000-1000-8000-00805f9b34fb"
+
typedef struct {
enum {
BT_UUID_UNSPEC = 0,
--
1.7.10.130.g36e6c


2012-05-31 13:43:38

by Daniel Wagner

[permalink] [raw]
Subject: [PATCH v3 14/14] device: Ignore DUN if PAN is present

From: Daniel Wagner <[email protected]>

Filtering DUN out at BlueZ level reduces the number of CPU cycles and
memory spend just to figure out that PAN is always preferred over DUN.

Doing this could on a the network manager level (e.g. ConnMan) or
at an intermediate daemon such as dundee which handles AT command
parsing and PPP setup is possible just more expensive.

Therefore, just ignore the DUN completely and do not even announce it.
---
src/device.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/src/device.c b/src/device.c
index 39aa0cb..1b2f395 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1529,6 +1529,24 @@ static void update_services(struct browse_req *req, sdp_list_t *recs)

sdp_list_free(svcclass, free);
}
+
+ if (!main_opts.prefer_pan)
+ return;
+
+ if (g_slist_find_custom(req->profiles_added, NAP_UUID,
+ (GCompareFunc) strcmp) != NULL) {
+ GSList *l;
+
+ l = g_slist_find_custom(req->profiles_added,
+ DUN_GW_UUID,
+ (GCompareFunc) strcmp);
+ if (l != NULL) {
+ DBG("Skipping DUN entry because PAN was found.");
+ g_free(l->data);
+ req->profiles_added = g_slist_remove_link(
+ req->profiles_added, l);
+ }
+ }
}

static void store_profiles(struct btd_device *device)
--
1.7.10.130.g36e6c


2012-05-31 13:43:35

by Daniel Wagner

[permalink] [raw]
Subject: [PATCH v3 11/14] pnat: Move UUID string definition to lib

From: Daniel Wagner <[email protected]>

---
lib/uuid.h | 2 ++
plugins/pnat.c | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/uuid.h b/lib/uuid.h
index 7e34259..3dfb00b 100644
--- a/lib/uuid.h
+++ b/lib/uuid.h
@@ -78,6 +78,8 @@ extern "C" {
#define HSP_HS_UUID "00001108-0000-1000-8000-00805f9b34fb"
#define HID_UUID "00001124-0000-1000-8000-00805f9b34fb"

+#define DUN_GW_UUID "00001103-0000-1000-8000-00805f9b34fb"
+
typedef struct {
enum {
BT_UUID_UNSPEC = 0,
diff --git a/plugins/pnat.c b/plugins/pnat.c
index 2d73910..3c611a9 100644
--- a/plugins/pnat.c
+++ b/plugins/pnat.c
@@ -39,6 +39,7 @@
#include <bluetooth/rfcomm.h>
#include <bluetooth/sdp.h>
#include <bluetooth/sdp_lib.h>
+#include <bluetooth/uuid.h>

#include <glib.h>

@@ -54,7 +55,6 @@
#define PNATD "/usr/bin/phonet-at"

#define DUN_CHANNEL 1
-#define DUN_UUID "00001103-0000-1000-8000-00805F9B34FB"

#define TTY_TIMEOUT 100
#define TTY_TRIES 10
@@ -347,7 +347,7 @@ static void confirm_cb(GIOChannel *io, gpointer user_data)
return;
}

- if (btd_request_authorization(&server->bda, &client->bda, DUN_UUID,
+ if (btd_request_authorization(&server->bda, &client->bda, DUN_GW_UUID,
auth_cb, user_data) < 0) {
error("Requesting DUN authorization failed");
return;
--
1.7.10.130.g36e6c


2012-05-31 13:43:36

by Daniel Wagner

[permalink] [raw]
Subject: [PATCH v3 12/14] core: Move UUID string definition to lib

From: Daniel Wagner <[email protected]>

---
lib/uuid.h | 3 +++
src/device.c | 1 -
src/storage.c | 1 +
src/storage.h | 2 --
4 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/uuid.h b/lib/uuid.h
index 3dfb00b..2c2b351 100644
--- a/lib/uuid.h
+++ b/lib/uuid.h
@@ -80,6 +80,9 @@ extern "C" {

#define DUN_GW_UUID "00001103-0000-1000-8000-00805f9b34fb"

+#define GAP_SVC_UUID "00001800-0000-1000-8000-00805f9b34fb"
+#define PNP_UUID "00001200-0000-1000-8000-00805f9b34fb"
+
typedef struct {
enum {
BT_UUID_UNSPEC = 0,
diff --git a/src/device.c b/src/device.c
index 7ff09aa..39aa0cb 100644
--- a/src/device.c
+++ b/src/device.c
@@ -71,7 +71,6 @@
/* When all services should trust a remote device */
#define GLOBAL_TRUST "[all]"

-#define GAP_SVC_UUID "00001800-0000-1000-8000-00805f9b34fb"
#define APPEARANCE_CHR_UUID 0x2a01

struct btd_disconnect_data {
diff --git a/src/storage.c b/src/storage.c
index 7d65fe1..17e8001 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -41,6 +41,7 @@
#include <bluetooth/bluetooth.h>
#include <bluetooth/sdp.h>
#include <bluetooth/sdp_lib.h>
+#include <bluetooth/uuid.h>

#include "textfile.h"
#include "glib-helper.h"
diff --git a/src/storage.h b/src/storage.h
index c541807..cc00e97 100644
--- a/src/storage.h
+++ b/src/storage.h
@@ -100,5 +100,3 @@ void delete_device_ccc(bdaddr_t *local, bdaddr_t *peer);
int write_longtermkeys(bdaddr_t *local, bdaddr_t *peer, uint8_t bdaddr_type,
const char *key);
gboolean has_longtermkeys(bdaddr_t *local, bdaddr_t *peer, uint8_t bdaddr_type);
-
-#define PNP_UUID "00001200-0000-1000-8000-00805f9b34fb"
--
1.7.10.130.g36e6c


2012-05-31 13:43:37

by Daniel Wagner

[permalink] [raw]
Subject: [PATCH v3 13/14] main: Add PreferPANoverDUN configuration switch

From: Daniel Wagner <[email protected]>

---
src/hcid.h | 1 +
src/main.c | 8 ++++++++
src/main.conf | 5 +++++
3 files changed, 14 insertions(+)

diff --git a/src/hcid.h b/src/hcid.h
index 1e5e15a..2e46a44 100644
--- a/src/hcid.h
+++ b/src/hcid.h
@@ -39,6 +39,7 @@ struct main_opts {
gboolean name_resolv;
gboolean debug_keys;
gboolean gatt_enabled;
+ gboolean prefer_pan;

uint8_t mode;

diff --git a/src/main.c b/src/main.c
index 286baa0..8ae9f6a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -241,6 +241,14 @@ static void parse_config(GKeyFile *config)
else
main_opts.gatt_enabled = boolean;

+ boolean = g_key_file_get_boolean(config, "General",
+ "PreferPANoverDUN", &err);
+ if (err) {
+ DBG("%s", err->message);
+ g_clear_error(&err);
+ } else
+ main_opts.prefer_pan = boolean;
+
main_opts.link_mode = HCI_LM_ACCEPT;

main_opts.link_policy = HCI_LP_RSWITCH | HCI_LP_SNIFF |
diff --git a/src/main.conf b/src/main.conf
index 787ef4f..eda01ec 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -62,3 +62,8 @@ DebugKeys = false

# Enable the GATT functionality. Default is false
EnableGatt = false
+
+# If a device supports both DUN and PAN at the same time, ignore the
+# DUN profile. Only PAN will be exposed through the D-Bus API in this
+# case. The default is false
+PreferPANoverDUN = false
--
1.7.10.130.g36e6c


2012-05-31 13:43:34

by Daniel Wagner

[permalink] [raw]
Subject: [PATCH v3 10/14] input: Move UUID string definition to lib

From: Daniel Wagner <[email protected]>

---
input/device.c | 1 +
input/device.h | 3 ---
input/manager.c | 1 +
input/server.c | 1 +
lib/uuid.h | 3 +++
5 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/input/device.c b/input/device.c
index e2c48b9..0e3f4a9 100644
--- a/input/device.c
+++ b/input/device.c
@@ -37,6 +37,7 @@
#include <bluetooth/hidp.h>
#include <bluetooth/sdp.h>
#include <bluetooth/sdp_lib.h>
+#include <bluetooth/uuid.h>

#include <glib.h>
#include <dbus/dbus.h>
diff --git a/input/device.h b/input/device.h
index c14b81a..509a353 100644
--- a/input/device.h
+++ b/input/device.h
@@ -21,9 +21,6 @@
*
*/

-#define HSP_HS_UUID "00001108-0000-1000-8000-00805F9B34FB"
-#define HID_UUID "00001124-0000-1000-8000-00805f9b34fb"
-
#define L2CAP_PSM_HIDP_CTRL 0x11
#define L2CAP_PSM_HIDP_INTR 0x13

diff --git a/input/manager.c b/input/manager.c
index 4ac5686..5cc552b 100644
--- a/input/manager.c
+++ b/input/manager.c
@@ -31,6 +31,7 @@
#include <bluetooth/hci.h>
#include <bluetooth/sdp.h>
#include <bluetooth/sdp_lib.h>
+#include <bluetooth/uuid.h>

#include <gdbus.h>

diff --git a/input/server.c b/input/server.c
index 17e7547..86e2ac8 100644
--- a/input/server.c
+++ b/input/server.c
@@ -30,6 +30,7 @@

#include <bluetooth/bluetooth.h>
#include <bluetooth/sdp.h>
+#include <bluetooth/uuid.h>

#include <glib.h>
#include <dbus/dbus.h>
diff --git a/lib/uuid.h b/lib/uuid.h
index 32f51b7..7e34259 100644
--- a/lib/uuid.h
+++ b/lib/uuid.h
@@ -75,6 +75,9 @@ extern "C" {
#define HDP_SOURCE_UUID "00001401-0000-1000-8000-00805f9b34fb"
#define HDP_SINK_UUID "00001402-0000-1000-8000-00805f9b34fb"

+#define HSP_HS_UUID "00001108-0000-1000-8000-00805f9b34fb"
+#define HID_UUID "00001124-0000-1000-8000-00805f9b34fb"
+
typedef struct {
enum {
BT_UUID_UNSPEC = 0,
--
1.7.10.130.g36e6c


2012-05-31 13:43:29

by Daniel Wagner

[permalink] [raw]
Subject: [PATCH v3 05/14] proximity: Move UUID string definition to lib

From: Daniel Wagner <[email protected]>

---
lib/uuid.h | 5 +++++
proximity/manager.c | 4 ----
proximity/reporter.c | 2 --
3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/lib/uuid.h b/lib/uuid.h
index 713075e..86679a9 100644
--- a/lib/uuid.h
+++ b/lib/uuid.h
@@ -56,6 +56,11 @@ extern "C" {
#define PNPID_UUID "00002a50-0000-1000-8000-00805f9b34fb"
#define DEVICE_INFORMATION_UUID "0000180a-0000-1000-8000-00805f9b34fb"

+#define GATT_UUID "00001801-0000-1000-8000-00805f9b34fb"
+#define IMMEDIATE_ALERT_UUID "00001802-0000-1000-8000-00805f9b34fb"
+#define LINK_LOSS_UUID "00001803-0000-1000-8000-00805f9b34fb"
+#define TX_POWER_UUID "00001804-0000-1000-8000-00805f9b34fb"
+
typedef struct {
enum {
BT_UUID_UNSPEC = 0,
diff --git a/proximity/manager.c b/proximity/manager.c
index 286f7e3..f2e49a6 100644
--- a/proximity/manager.c
+++ b/proximity/manager.c
@@ -39,10 +39,6 @@
#include "reporter.h"
#include "manager.h"

-#define IMMEDIATE_ALERT_UUID "00001802-0000-1000-8000-00805f9b34fb"
-#define LINK_LOSS_UUID "00001803-0000-1000-8000-00805f9b34fb"
-#define TX_POWER_UUID "00001804-0000-1000-8000-00805f9b34fb"
-
static DBusConnection *connection = NULL;

static struct enabled enabled = {
diff --git a/proximity/reporter.c b/proximity/reporter.c
index 20779a8..607de2b 100644
--- a/proximity/reporter.c
+++ b/proximity/reporter.c
@@ -51,8 +51,6 @@

#define BLUEZ_SERVICE "org.bluez"

-#define GATT_UUID "00001801-0000-1000-8000-00805f9b34fb"
-
struct reporter_adapter {
DBusConnection *conn;
struct btd_adapter *adapter;
--
1.7.10.130.g36e6c


2012-05-31 13:43:33

by Daniel Wagner

[permalink] [raw]
Subject: [PATCH v3 09/14] health: Move UUID string definition to lib

From: Daniel Wagner <[email protected]>

---
health/hdp_manager.c | 1 +
health/hdp_types.h | 4 ----
health/hdp_util.c | 1 +
lib/uuid.h | 4 ++++
4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/health/hdp_manager.c b/health/hdp_manager.c
index cccb1a6..ffaed5d 100644
--- a/health/hdp_manager.c
+++ b/health/hdp_manager.c
@@ -26,6 +26,7 @@

#include <bluetooth/sdp.h>
#include <bluetooth/sdp_lib.h>
+#include <bluetooth/uuid.h>

#include <btio.h>
#include <adapter.h>
diff --git a/health/hdp_types.h b/health/hdp_types.h
index 9a6776f..7f8b015 100644
--- a/health/hdp_types.h
+++ b/health/hdp_types.h
@@ -23,10 +23,6 @@
#ifndef __HDP_TYPES_H__
#define __HDP_TYPES_H__

-#define HDP_UUID "00001400-0000-1000-8000-00805F9B34FB"
-#define HDP_SOURCE_UUID "00001401-0000-1000-8000-00805F9B34FB"
-#define HDP_SINK_UUID "00001402-0000-1000-8000-00805F9B34FB"
-
#define MANAGER_PATH "/org/bluez"

#define HEALTH_MANAGER "org.bluez.HealthManager"
diff --git a/health/hdp_util.c b/health/hdp_util.c
index 3b48e44..744e390 100644
--- a/health/hdp_util.c
+++ b/health/hdp_util.c
@@ -35,6 +35,7 @@

#include <sdpd.h>
#include <bluetooth/sdp_lib.h>
+#include <bluetooth/uuid.h>
#include <sdp-client.h>
#include <glib-helper.h>

diff --git a/lib/uuid.h b/lib/uuid.h
index 1ed90e0..32f51b7 100644
--- a/lib/uuid.h
+++ b/lib/uuid.h
@@ -71,6 +71,10 @@ extern "C" {

#define RFCOMM_UUID_STR "00000003-0000-1000-8000-00805f9b34fb"

+#define HDP_UUID "00001400-0000-1000-8000-00805f9b34fb"
+#define HDP_SOURCE_UUID "00001401-0000-1000-8000-00805f9b34fb"
+#define HDP_SINK_UUID "00001402-0000-1000-8000-00805f9b34fb"
+
typedef struct {
enum {
BT_UUID_UNSPEC = 0,
--
1.7.10.130.g36e6c


2012-05-31 13:43:25

by Daniel Wagner

[permalink] [raw]
Subject: [PATCH v3 01/14] sdp: Remove unused BASE_UUID definition

From: Daniel Wagner <[email protected]>

---
lib/sdp.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/lib/sdp.c b/lib/sdp.c
index de5277f..7cb930f 100644
--- a/lib/sdp.c
+++ b/lib/sdp.c
@@ -60,8 +60,6 @@
#define SDPDBG(fmt...)
#endif

-#define BASE_UUID "00000000-0000-1000-8000-00805F9B34FB"
-
static uint128_t bluetooth_base_uuid = {
.data = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB }
--
1.7.10.130.g36e6c


2012-06-02 01:09:39

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH v3 00/14] Prefer PAN over DUN

Hi Daniel,

On Thu, May 31, 2012, Daniel Wagner wrote:
> From: Daniel Wagner <[email protected]>
>
> Hi,
>
> This version moves the UUID strings into the lib instead of the core.
> I tried to do get rid of the UUID string using the *_SVCLASS_ID from sdp.h
> but it is hard to do string magic during precompile time...
>
> cheers,
> daniel
>
> changes:
>
> v3: - Move UUID strings into lib
>
> v2: - Move all UUID string definition into one header file
> - Change configuration variable name
> - This behavior is off by default
>
> Daniel Wagner (14):
> sdp: Remove unused BASE_UUID definition
> audio: Move UUID string definition to lib
> network: Move UUID string definition to lib
> deviceinfo: Move UUID string definition to lib
> proximity: Move UUID string definition to lib
> sap: Move UUID string definition to lib
> thermometer: Move UUID string definition to lib
> serial: Move UUID string definition to lib
> health: Move UUID string definition to lib
> input: Move UUID string definition to lib
> pnat: Move UUID string definition to lib
> core: Move UUID string definition to lib
> main: Add PreferPANoverDUN configuration switch
> device: Ignore DUN if PAN is present

I've applied patches 1-12 but I stopped there for now since I'm not
completely convinced of the config file parameter naming.

Johan