Diff between e1cbe31eaa4d1d687d6bbc87ab42c4bfa1b70c84 and 12cd2f8eee50fffc0ac981d3ee50f52dae8b41fc

Changed Files

File Additions Deletions Status
Makefile.plugins +1 -5 modified
profiles/deviceinfo/deviceinfo.c +59 -3 modified
profiles/deviceinfo/deviceinfo.h +0 -24 deleted
profiles/deviceinfo/manager.c +0 -85 deleted
profiles/deviceinfo/manager.h +0 -24 deleted

Full Patch

diff --git a/Makefile.plugins b/Makefile.plugins
index ca3d4ea..e7649f3 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -83,11 +83,7 @@ builtin_sources += profiles/scanparam/main.c \
 			profiles/scanparam/scan.h profiles/scanparam/scan.c
 
 builtin_modules += deviceinfo
-builtin_sources += profiles/deviceinfo/main.c \
-			profiles/deviceinfo/manager.h \
-			profiles/deviceinfo/manager.c \
-			profiles/deviceinfo/deviceinfo.h \
-			profiles/deviceinfo/deviceinfo.c
+builtin_sources += profiles/deviceinfo/deviceinfo.c
 
 if EXPERIMENTAL
 builtin_modules += alert
diff --git a/profiles/deviceinfo/deviceinfo.c b/profiles/deviceinfo/deviceinfo.c
index da27df8..d7891f5 100644
--- a/profiles/deviceinfo/deviceinfo.c
+++ b/profiles/deviceinfo/deviceinfo.c
@@ -25,18 +25,20 @@
 #endif
 
 #include <stdbool.h>
+#include <errno.h>
 
 #include <glib.h>
 #include <bluetooth/uuid.h>
 
+#include "plugin.h"
 #include "adapter.h"
 #include "device.h"
+#include "profile.h"
 #include "attrib/gattrib.h"
 #include "attio.h"
 #include "attrib/att.h"
 #include "attrib/gatt.h"
 #include "log.h"
-#include "deviceinfo.h"
 
 #define PNP_ID_SIZE	7
 
@@ -163,7 +165,8 @@ static void attio_disconnected_cb(gpointer user_data)
 	d->attrib = NULL;
 }
 
-int deviceinfo_register(struct btd_device *device, struct gatt_primary *prim)
+static int deviceinfo_register(struct btd_device *device,
+						struct gatt_primary *prim)
 {
 	struct deviceinfo *d;
 
@@ -180,7 +183,7 @@ int deviceinfo_register(struct btd_device *device, struct gatt_primary *prim)
 	return 0;
 }
 
-void deviceinfo_unregister(struct btd_device *device)
+static void deviceinfo_unregister(struct btd_device *device)
 {
 	struct deviceinfo *d;
 	GSList *l;
@@ -194,3 +197,56 @@ void deviceinfo_unregister(struct btd_device *device)
 
 	deviceinfo_free(d);
 }
+
+static gint primary_uuid_cmp(gconstpointer a, gconstpointer b)
+{
+	const struct gatt_primary *prim = a;
+	const char *uuid = b;
+
+	return g_strcmp0(prim->uuid, uuid);
+}
+
+static int deviceinfo_driver_probe(struct btd_profile *p,
+					struct btd_device *device,
+					GSList *uuids)
+{
+	struct gatt_primary *prim;
+	GSList *primaries, *l;
+
+	primaries = btd_device_get_primaries(device);
+
+	l = g_slist_find_custom(primaries, DEVICE_INFORMATION_UUID,
+							primary_uuid_cmp);
+	if (l == NULL)
+		return -EINVAL;
+
+	prim = l->data;
+
+	return deviceinfo_register(device, prim);
+}
+
+static void deviceinfo_driver_remove(struct btd_profile *p,
+						struct btd_device *device)
+{
+	deviceinfo_unregister(device);
+}
+
+static struct btd_profile deviceinfo_profile = {
+	.name		= "deviceinfo",
+	.remote_uuids	= BTD_UUIDS(DEVICE_INFORMATION_UUID),
+	.device_probe	= deviceinfo_driver_probe,
+	.device_remove	= deviceinfo_driver_remove
+};
+
+static int deviceinfo_init(void)
+{
+	return btd_profile_register(&deviceinfo_profile);
+}
+
+static void deviceinfo_exit(void)
+{
+	btd_profile_unregister(&deviceinfo_profile);
+}
+
+BLUETOOTH_PLUGIN_DEFINE(deviceinfo, VERSION, BLUETOOTH_PLUGIN_PRIORITY_DEFAULT,
+					deviceinfo_init, deviceinfo_exit)
diff --git a/profiles/deviceinfo/deviceinfo.h b/profiles/deviceinfo/deviceinfo.h
deleted file mode 100644
index 7a804a5..0000000
--- a/profiles/deviceinfo/deviceinfo.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- *
- *  BlueZ - Bluetooth protocol stack for Linux
- *
- *  Copyright (C) 2012 Texas Instruments, Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- */
-
-int deviceinfo_register(struct btd_device *device, struct gatt_primary *prim);
-void deviceinfo_unregister(struct btd_device *device);
diff --git a/profiles/deviceinfo/manager.c b/profiles/deviceinfo/manager.c
deleted file mode 100644
index 8eab62c..0000000
--- a/profiles/deviceinfo/manager.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- *
- *  BlueZ - Bluetooth protocol stack for Linux
- *
- *  Copyright (C) 2012 Texas Instruments, Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- */
-
-#include <glib.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <bluetooth/uuid.h>
-
-#include "adapter.h"
-#include "device.h"
-#include "profile.h"
-#include "attrib/att.h"
-#include "attrib/gattrib.h"
-#include "attrib/gatt.h"
-#include "deviceinfo.h"
-#include "manager.h"
-
-static gint primary_uuid_cmp(gconstpointer a, gconstpointer b)
-{
-	const struct gatt_primary *prim = a;
-	const char *uuid = b;
-
-	return g_strcmp0(prim->uuid, uuid);
-}
-
-static int deviceinfo_driver_probe(struct btd_profile *p,
-					struct btd_device *device,
-					GSList *uuids)
-{
-	struct gatt_primary *prim;
-	GSList *primaries, *l;
-
-	primaries = btd_device_get_primaries(device);
-
-	l = g_slist_find_custom(primaries, DEVICE_INFORMATION_UUID,
-							primary_uuid_cmp);
-	if (l == NULL)
-		return -EINVAL;
-
-	prim = l->data;
-
-	return deviceinfo_register(device, prim);
-}
-
-static void deviceinfo_driver_remove(struct btd_profile *p,
-						struct btd_device *device)
-{
-	deviceinfo_unregister(device);
-}
-
-static struct btd_profile deviceinfo_profile = {
-	.name		= "deviceinfo",
-	.remote_uuids	= BTD_UUIDS(DEVICE_INFORMATION_UUID),
-	.device_probe	= deviceinfo_driver_probe,
-	.device_remove	= deviceinfo_driver_remove
-};
-
-int deviceinfo_manager_init(void)
-{
-	return btd_profile_register(&deviceinfo_profile);
-}
-
-void deviceinfo_manager_exit(void)
-{
-	btd_profile_unregister(&deviceinfo_profile);
-}
diff --git a/profiles/deviceinfo/manager.h b/profiles/deviceinfo/manager.h
deleted file mode 100644
index 0f742ca..0000000
--- a/profiles/deviceinfo/manager.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- *
- *  BlueZ - Bluetooth protocol stack for Linux
- *
- *  Copyright (C) 2012 Texas Instruments, Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- */
-
-int deviceinfo_manager_init(void);
-void deviceinfo_manager_exit(void);