summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/adapter.c4
-rw-r--r--src/device.c5
2 files changed, 5 insertions, 4 deletions
diff --git a/src/adapter.c b/src/adapter.c
index 70d1a8e8..23a59c09 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -71,6 +71,8 @@
#define check_address(address) bachk(address)
+static char base_path[] = "/org/bluez";
+
static DBusConnection *connection = NULL;
static GSList *adapter_drivers = NULL;
@@ -2768,7 +2770,7 @@ struct btd_adapter *adapter_create(DBusConnection *conn, int id)
if (!connection)
connection = conn;
- snprintf(path, sizeof(path), "%s/hci%d", "/org/bluez", id);
+ snprintf(path, sizeof(path), "%s/hci%d", base_path, id);
adapter = g_try_new0(struct btd_adapter, 1);
if (!adapter) {
diff --git a/src/device.c b/src/device.c
index 8fb46413..20e63d22 100644
--- a/src/device.c
+++ b/src/device.c
@@ -553,15 +553,14 @@ struct btd_device *device_create(DBusConnection *conn, struct btd_adapter *adapt
{
gchar *address_up;
struct btd_device *device;
- uint16_t dev_id = adapter_get_dev_id(adapter);
+ const gchar *adapter_path = adapter_get_path(adapter);
device = g_try_malloc0(sizeof(struct btd_device));
if (device == NULL)
return NULL;
address_up = g_ascii_strup(address, -1);
- device->path = g_strdup_printf("%s/hci%d/dev_%s", "/org/bluez",
- dev_id, address_up);
+ device->path = g_strdup_printf("%s/dev_%s", adapter_path, address_up);
g_strdelimit(device->path, ":", '_');
g_free(address_up);