summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@indt.org.br>2008-08-05 18:13:42 -0300
committerLuiz Augusto von Dentz <luiz.dentz@indt.org.br>2008-08-05 18:13:42 -0300
commit76751aa2c4065f2d9492f97f5145e6f54d56b451 (patch)
tree96f8895f29617202266ebefa83e566cf016ba59a
parent037e751359421436c382a750b960854602424d58 (diff)
Introduce driver.c and driver.h files.
-rw-r--r--audio/manager.c1
-rw-r--r--input/manager.c1
-rw-r--r--network/manager.c1
-rw-r--r--serial/manager.c1
-rw-r--r--src/Makefile.am2
-rw-r--r--src/device.c28
-rw-r--r--src/device.h14
-rw-r--r--src/main.conf2
8 files changed, 9 insertions, 41 deletions
diff --git a/audio/manager.c b/audio/manager.c
index b1da8426..695c6ba0 100644
--- a/audio/manager.c
+++ b/audio/manager.c
@@ -51,6 +51,7 @@
#include "glib-helper.h"
#include "../src/adapter.h"
#include "../src/device.h"
+#include "../src/driver.h"
#include "dbus-service.h"
#include "logging.h"
diff --git a/input/manager.c b/input/manager.c
index 08609601..b18da8e0 100644
--- a/input/manager.c
+++ b/input/manager.c
@@ -46,6 +46,7 @@
#include "textfile.h"
#include "../src/adapter.h"
#include "../src/device.h"
+#include "../src/driver.h"
#include "device.h"
#include "server.h"
diff --git a/network/manager.c b/network/manager.c
index 22a6e70c..c0af5d34 100644
--- a/network/manager.c
+++ b/network/manager.c
@@ -47,6 +47,7 @@
#include "adapter.h"
#include "device.h"
+#include "driver.h"
#include "error.h"
#include "bridge.h"
#include "manager.h"
diff --git a/serial/manager.c b/serial/manager.c
index 79d7cb8e..9df3caaa 100644
--- a/serial/manager.c
+++ b/serial/manager.c
@@ -54,6 +54,7 @@
#include "../src/dbus-common.h"
#include "adapter.h"
#include "device.h"
+#include "driver.h"
#include "logging.h"
#include "textfile.h"
diff --git a/src/Makefile.am b/src/Makefile.am
index 473c86f9..32ad8f67 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -22,7 +22,7 @@ bluetoothd_SOURCES = main.c hcid.h sdpd.h \
adapter.h adapter.c device.h device.c plugin.h plugin.c \
dbus-common.c dbus-common.h dbus-hci.h dbus-hci.c \
dbus-database.c dbus-database.h dbus-service.c dbus-service.h \
- telephony.h telephony.c agent.h agent.c
+ telephony.h telephony.c agent.h agent.c driver.h driver.c
bluetoothd_LDADD = $(top_builddir)/common/libhelper.a \
@GDBUS_LIBS@ @GMODULE_LIBS@ @GLIB_LIBS@ @DBUS_LIBS@ @BLUEZ_LIBS@
diff --git a/src/device.c b/src/device.c
index 4ef90803..ac578f2b 100644
--- a/src/device.c
+++ b/src/device.c
@@ -57,11 +57,11 @@
#include "device.h"
#include "dbus-common.h"
#include "dbus-hci.h"
-#include "dbus-service.h"
#include "error.h"
#include "glib-helper.h"
#include "agent.h"
#include "sdp-xml.h"
+#include "driver.h"
#define DEFAULT_XML_BUF_SIZE 1024
#define DISCONNECT_TIMER 2
@@ -101,8 +101,6 @@ struct browse_req {
gboolean browse;
};
-static GSList *drivers = NULL;
-
static uint16_t uuid_list[] = {
PUBLIC_BROWSE_GROUP,
HID_SVCLASS_ID,
@@ -620,13 +618,13 @@ sdp_record_t *get_record(sdp_list_t *recs, const char *uuid)
void device_probe_drivers(struct btd_device *device, GSList *uuids, sdp_list_t *recs)
{
- GSList *list;
+ GSList *list = btd_get_device_drivers();
const char **uuid;
int err;
debug("Probe drivers for %s", device->path);
- for (list = drivers; list; list = list->next) {
+ for (; list; list = list->next) {
struct btd_device_driver *driver = list->data;
GSList *records = NULL;
@@ -1085,23 +1083,3 @@ uint8_t device_get_auth(struct btd_device *device)
{
return device->auth;
}
-
-int btd_register_device_driver(struct btd_device_driver *driver)
-{
- const char **uuid;
-
- /* FIXME: hack to make hci to resolve service_req_auth symbol*/
- service_req_auth(NULL, NULL, NULL, NULL, NULL);
- drivers = g_slist_append(drivers, driver);
-
- for (uuid = driver->uuids; *uuid; uuid++) {
- debug("name %s uuid %s", driver->name, *uuid);
- }
-
- return 0;
-}
-
-void btd_unregister_device_driver(struct btd_device_driver *driver)
-{
- drivers = g_slist_remove(drivers, driver);
-}
diff --git a/src/device.h b/src/device.h
index 31480a66..c29d670b 100644
--- a/src/device.h
+++ b/src/device.h
@@ -42,17 +42,3 @@ void device_set_temporary(struct btd_device *device, gboolean temporary);
void device_set_cap(struct btd_device *device, uint8_t cap);
void device_set_auth(struct btd_device *device, uint8_t auth);
uint8_t device_get_auth(struct btd_device *device);
-
-#define BTD_UUIDS(args...) ((const char *[]) { args, NULL } )
-
-struct btd_device_driver {
- const char *name;
- const char **uuids;
- int (*probe) (struct btd_device_driver *driver,
- struct btd_device *device, GSList *records);
- void (*remove) (struct btd_device_driver *driver,
- struct btd_device *device);
-};
-
-int btd_register_device_driver(struct btd_device_driver *driver);
-void btd_unregister_device_driver(struct btd_device_driver *driver);
diff --git a/src/main.conf b/src/main.conf
index 664820ad..306dc7c9 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -8,7 +8,7 @@
# %d - substituted for adapter id
Name = %h-%d
-# Default device class. Only the major and minor service class bits are
+# Default device class. Only the major and minor device class bits are
# considered
Class = 0x000100