diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2008-06-08 22:57:11 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2008-06-08 22:57:11 +0000 |
commit | 5243ac4fd278b0176ece84cbcec537a92a9c7290 (patch) | |
tree | 912b65f15a18410d84563ef95f0595d5b3504121 /hcid | |
parent | f22b20c3d40bd7571944af6a4946f756dc39f812 (diff) |
Update probe/remove callback and implement serial API
Diffstat (limited to 'hcid')
-rw-r--r-- | hcid/device.c | 8 | ||||
-rw-r--r-- | hcid/device.h | 11 |
2 files changed, 15 insertions, 4 deletions
diff --git a/hcid/device.c b/hcid/device.c index e01bf7d2..b040df91 100644 --- a/hcid/device.c +++ b/hcid/device.c @@ -1086,6 +1086,10 @@ struct device *device_create(DBusConnection *conn, struct adapter *adapter, device->adapter = adapter; device->uuids = uuids; + device->dev.path = device->path; + str2ba(device->address, &device->dev.dst); + str2ba(adapter->address, &device->dev.src); + return device; } @@ -1100,7 +1104,7 @@ void device_remove(DBusConnection *conn, struct device *device) for (list = device->drivers; list; list = list->next) { driver = (struct btd_device_driver *) list->data; - driver->remove(device->path); + driver->remove(&device->dev); } g_dbus_unregister_interface(conn, path, DEVICE_INTERFACE); @@ -1137,7 +1141,7 @@ void device_probe_drivers(struct device *device) if (do_probe == TRUE && !g_slist_find_custom(device->drivers, driver->name, (GCompareFunc) strcmp)) { - err = driver->probe(device->path); + err = driver->probe(&device->dev); if (err < 0) error("probe failed for driver %s", driver->name); diff --git a/hcid/device.h b/hcid/device.h index 38ad8030..420985fd 100644 --- a/hcid/device.h +++ b/hcid/device.h @@ -24,7 +24,14 @@ #define DEVICE_INTERFACE "org.bluez.Device" +struct btd_device { + char *path; + bdaddr_t src; + bdaddr_t dst; +}; + struct device { + struct btd_device dev; gchar *address; gchar *path; struct adapter *adapter; @@ -47,8 +54,8 @@ void device_probe_drivers(struct device *device); struct btd_device_driver { const char *name; const char **uuids; - int (*probe) (const char *path); - void (*remove) (const char *path); + int (*probe) (struct btd_device *device); + void (*remove) (struct btd_device *device); }; int btd_register_device_driver(struct btd_device_driver *driver); |