diff options
author | Luiz Augusto von Dentz <luiz.dentz@indt.org.br> | 2008-08-05 18:13:42 -0300 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.dentz@indt.org.br> | 2008-08-05 18:13:42 -0300 |
commit | 76751aa2c4065f2d9492f97f5145e6f54d56b451 (patch) | |
tree | 96f8895f29617202266ebefa83e566cf016ba59a /src | |
parent | 037e751359421436c382a750b960854602424d58 (diff) |
Introduce driver.c and driver.h files.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/device.c | 28 | ||||
-rw-r--r-- | src/device.h | 14 | ||||
-rw-r--r-- | src/main.conf | 2 |
4 files changed, 5 insertions, 41 deletions
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 |