Hello community,
here is the log from the commit of package bluez for openSUSE:Factory
checked in at Fri May 15 22:11:47 CEST 2009.
--------
--- bluez/bluez.changes 2009-05-04 21:11:57.000000000 +0200
+++ bluez/bluez.changes 2009-05-11 19:34:51.000000000 +0200
@@ -1,0 +2,15 @@
+Mon May 11 19:26:39 CEST 2009 - seife@suse.de
+
+- update to bluez-4.39:
+ - Add workaround for dealing with unknown inquiry complete.
+ - Fix discovering when using software scheduler.
+ - Fix wrong NoInputNoOutput IO capability string.
+ - Fix race condition with agent during pairing.
+ - Fix agent cancellation for security mode 3 acceptor failure.
+ - Fix temporary flag removal when device creation fails.
+ - Fix hciattach to use ppoll instead of poll.
+ - Fix service class update when adapter is down.
+ - Fix service classes race condition during startup.
+ - Fix release of audio client before freeing the device.
+
+-------------------------------------------------------------------
bluez-gstreamer.changes: same change
calling whatdependson for head-i586
Old:
----
bluez-4.38.tar.bz2
New:
----
bluez-4.39.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ bluez-gstreamer.spec ++++++
--- /var/tmp/diff_new_pack.O29928/_old 2009-05-15 22:09:13.000000000 +0200
+++ /var/tmp/diff_new_pack.O29928/_new 2009-05-15 22:09:13.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package bluez-gstreamer (Version 4.38)
+# spec file for package bluez-gstreamer (Version 4.39)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -24,7 +24,7 @@
BuildRequires: alsa-devel libsndfile-devel
BuildRequires: gstreamer-0_10-devel gstreamer-0_10-plugins-base-devel
Url: http://www.bluez.org
-Version: 4.38
+Version: 4.39
Release: 1
Summary: Bluetooth Sound Support
Group: Productivity/Multimedia/Sound/Utilities
@@ -109,6 +109,18 @@
%{_libdir}/gstreamer-*/*.so
%changelog
+* Mon May 11 2009 seife@suse.de
+- update to bluez-4.39:
+ - Add workaround for dealing with unknown inquiry complete.
+ - Fix discovering when using software scheduler.
+ - Fix wrong NoInputNoOutput IO capability string.
+ - Fix race condition with agent during pairing.
+ - Fix agent cancellation for security mode 3 acceptor failure.
+ - Fix temporary flag removal when device creation fails.
+ - Fix hciattach to use ppoll instead of poll.
+ - Fix service class update when adapter is down.
+ - Fix service classes race condition during startup.
+ - Fix release of audio client before freeing the device.
* Mon May 04 2009 seife@suse.de
- update to bluez-4.38:
- Add support for builtin plugins.
++++++ bluez.spec ++++++
--- /var/tmp/diff_new_pack.O29928/_old 2009-05-15 22:09:13.000000000 +0200
+++ /var/tmp/diff_new_pack.O29928/_new 2009-05-15 22:09:13.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package bluez (Version 4.38)
+# spec file for package bluez (Version 4.39)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -23,7 +23,7 @@
BuildRequires: glib2-devel libnl-devel libusb-devel
BuildRequires: alsa-devel libsndfile-devel
Url: http://www.bluez.org
-Version: 4.38
+Version: 4.39
Release: 1
Summary: Bluetooth Stack for Linux
Group: Hardware/Mobile
@@ -354,6 +354,18 @@
%doc %{_mandir}/man1/dund.1.gz
%changelog
+* Mon May 11 2009 seife@suse.de
+- update to bluez-4.39:
+ - Add workaround for dealing with unknown inquiry complete.
+ - Fix discovering when using software scheduler.
+ - Fix wrong NoInputNoOutput IO capability string.
+ - Fix race condition with agent during pairing.
+ - Fix agent cancellation for security mode 3 acceptor failure.
+ - Fix temporary flag removal when device creation fails.
+ - Fix hciattach to use ppoll instead of poll.
+ - Fix service class update when adapter is down.
+ - Fix service classes race condition during startup.
+ - Fix release of audio client before freeing the device.
* Mon May 04 2009 seife@suse.de
- update to bluez-4.38:
- Add support for builtin plugins.
++++++ bluez-4.38.tar.bz2 -> bluez-4.39.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/audio/avdtp.c new/bluez-4.39/audio/avdtp.c
--- old/bluez-4.38/audio/avdtp.c 2009-05-04 01:00:28.000000000 +0200
+++ new/bluez-4.39/audio/avdtp.c 2009-05-09 11:31:01.000000000 +0200
@@ -307,6 +307,7 @@
bdaddr_t src;
GIOChannel *io;
GSList *seps;
+ GSList *sessions;
};
struct avdtp_local_sep {
@@ -398,7 +399,6 @@
};
static GSList *servers = NULL;
-static GSList *sessions = NULL;
static GSList *avdtp_callbacks = NULL;
@@ -457,17 +457,18 @@
static gboolean try_send(int sk, void *data, size_t len)
{
- gboolean ret;
-
- ret = send(sk, data, len, 0);
-
- if (ret < 0)
- ret = -errno;
- else if ((size_t) ret != len)
- ret = -EIO;
+ int err;
- if (ret < 0) {
- error("try_send: %s (%d)", strerror(-ret), -ret);
+ do {
+ err = send(sk, data, len, 0);
+ } while (err < 0 && errno == EINTR);
+
+ if (err < 0) {
+ error("send: %s (%d)", strerror(errno), errno);
+ return FALSE;
+ } else if ((size_t) err != len) {
+ error("try_send: complete buffer not sent (%d/%zu bytes)",
+ err, len);
return FALSE;
}
@@ -529,7 +530,7 @@
if (!try_send(sock, session->buf, session->omtu))
return FALSE;
- debug("avdtp_send: first packet with %lu bytes sent",
+ debug("avdtp_send: first packet with %zu bytes sent",
session->omtu - sizeof(start));
sent = session->omtu - sizeof(start);
@@ -985,13 +986,10 @@
void avdtp_unref(struct avdtp *session)
{
- if (!session)
- return;
+ struct avdtp_server *server;
- if (!g_slist_find(sessions, session)) {
- error("avdtp_unref: trying to unref a unknown session");
+ if (!session)
return;
- }
session->ref--;
@@ -1015,13 +1013,15 @@
if (session->ref > 0)
return;
+ server = session->server;
+
debug("avdtp_unref(%p): freeing session and removing from list",
session);
if (session->dc_timer)
remove_disconnect_timer(session);
- sessions = g_slist_remove(sessions, session);
+ server->sessions = g_slist_remove(server->sessions, session);
if (session->req)
pending_req_free(session->req);
@@ -1875,14 +1875,14 @@
return FALSE;
}
-static struct avdtp *find_session(const bdaddr_t *src, const bdaddr_t *dst)
+static struct avdtp *find_session(GSList *list, const bdaddr_t *dst)
{
GSList *l;
- for (l = sessions; l != NULL; l = g_slist_next(l)) {
+ for (l = list; l != NULL; l = g_slist_next(l)) {
struct avdtp *s = l->data;
- if (bacmp(src, &s->server->src) || bacmp(dst, &s->dst))
+ if (bacmp(dst, &s->dst))
continue;
return s;
@@ -1893,12 +1893,17 @@
static struct avdtp *avdtp_get_internal(const bdaddr_t *src, const bdaddr_t *dst)
{
+ struct avdtp_server *server;
struct avdtp *session;
assert(src != NULL);
assert(dst != NULL);
- session = find_session(src, dst);
+ server = find_server(servers, src);
+ if (server == NULL)
+ return NULL;
+
+ session = find_session(server->sessions, dst);
if (session) {
if (session->pending_auth)
return NULL;
@@ -1908,7 +1913,7 @@
session = g_new0(struct avdtp, 1);
- session->server = find_server(servers, src);
+ session->server = server;
bacpy(&session->dst, dst);
session->ref = 1;
/* We don't use avdtp_set_state() here since this isn't a state change
@@ -1916,7 +1921,7 @@
session->state = AVDTP_SESSION_STATE_DISCONNECTED;
session->auto_dc = TRUE;
- sessions = g_slist_append(sessions, session);
+ server->sessions = g_slist_append(server->sessions, session);
return session;
}
@@ -1939,11 +1944,6 @@
char address[18];
GError *gerr = NULL;
- if (!g_slist_find(sessions, session)) {
- debug("avdtp_connect_cb: session got removed");
- return;
- }
-
if (err) {
error("%s", err->message);
goto failed;
@@ -2661,10 +2661,14 @@
gboolean avdtp_is_connected(const bdaddr_t *src, const bdaddr_t *dst)
{
+ struct avdtp_server *server;
struct avdtp *session;
- session = find_session(src, dst);
+ server = find_server(servers, src);
+ if (!server)
+ return FALSE;
+ session = find_session(server->sessions, dst);
if (!session)
return FALSE;
@@ -3349,11 +3353,10 @@
if (!server)
return;
- for (l = sessions; l; l = l->next) {
+ for (l = server->sessions; l; l = l->next) {
struct avdtp *session = l->data;
- if (session->server == server)
- connection_lost(session, -ECONNABORTED);
+ connection_lost(session, -ECONNABORTED);
}
servers = g_slist_remove(servers, server);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/audio/device.c new/bluez-4.39/audio/device.c
--- old/bluez-4.38/audio/device.c 2009-04-23 03:40:04.000000000 +0200
+++ new/bluez-4.39/audio/device.c 2009-05-09 11:31:01.000000000 +0200
@@ -618,6 +618,8 @@
void audio_device_unregister(struct audio_device *device)
{
+ unix_device_removed(device);
+
if (device->headset)
headset_unregister(device);
@@ -627,8 +629,6 @@
if (device->control)
control_unregister(device);
- unix_device_removed(device);
-
g_dbus_unregister_interface(device->conn, device->path,
AUDIO_INTERFACE);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/audio/headset.c new/bluez-4.39/audio/headset.c
--- old/bluez-4.38/audio/headset.c 2009-05-04 01:00:28.000000000 +0200
+++ new/bluez-4.39/audio/headset.c 2009-05-09 11:31:01.000000000 +0200
@@ -2060,6 +2060,9 @@
hs->dc_timer = 0;
}
+ if (hs->dc_id)
+ device_remove_disconnect_watch(dev->btd_dev, hs->dc_id);
+
if (hs->sco) {
g_io_channel_shutdown(hs->sco, TRUE, NULL);
g_io_channel_unref(hs->sco);
@@ -2431,6 +2434,7 @@
telephony_device_disconnected(dev);
active_devices = g_slist_remove(active_devices, dev);
device_remove_disconnect_watch(dev->btd_dev, hs->dc_id);
+ hs->dc_id = 0;
break;
case HEADSET_STATE_CONNECT_IN_PROGRESS:
emit_property_changed(dev->conn, dev->path,
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/audio/sink.c new/bluez-4.39/audio/sink.c
--- old/bluez-4.38/audio/sink.c 2009-05-04 01:00:28.000000000 +0200
+++ new/bluez-4.39/audio/sink.c 2009-05-09 11:31:01.000000000 +0200
@@ -139,8 +139,11 @@
emit_property_changed(dev->conn, dev->path,
AUDIO_SINK_INTERFACE, "Connected",
DBUS_TYPE_BOOLEAN, &value);
- device_remove_disconnect_watch(dev->btd_dev,
- sink->dc_id);
+ if (sink->dc_id) {
+ device_remove_disconnect_watch(dev->btd_dev,
+ sink->dc_id);
+ sink->dc_id = 0;
+ }
}
sink_set_state(dev, SINK_STATE_DISCONNECTED);
break;
@@ -205,6 +208,12 @@
pending_request_free(dev, p);
}
+ if (sink->dc_id) {
+ device_remove_disconnect_watch(dev->btd_dev,
+ sink->dc_id);
+ sink->dc_id = 0;
+ }
+
if (sink->session) {
avdtp_unref(sink->session);
sink->session = NULL;
@@ -722,6 +731,9 @@
avdtp_stream_remove_cb(sink->session, sink->stream,
sink->cb_id);
+ if (sink->dc_id)
+ device_remove_disconnect_watch(dev->btd_dev, sink->dc_id);
+
if (sink->session)
avdtp_unref(sink->session);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/ChangeLog new/bluez-4.39/ChangeLog
--- old/bluez-4.38/ChangeLog 2009-05-04 01:12:27.000000000 +0200
+++ new/bluez-4.39/ChangeLog 2009-05-09 11:31:01.000000000 +0200
@@ -1,3 +1,15 @@
+ver 4.39:
+ Add workaround for dealing with unknown inquiry complete.
+ Fix discovering when using software scheduler.
+ Fix wrong NoInputNoOutput IO capability string.
+ Fix race condition with agent during pairing.
+ Fix agent cancellation for security mode 3 acceptor failure.
+ Fix temporary flag removal when device creation fails.
+ Fix hciattach to use ppoll instead of poll.
+ Fix service class update when adapter is down.
+ Fix service classes race condition during startup.
+ Fix release of audio client before freeing the device.
+
ver 4.38:
Add support for builtin plugins.
Add framework for adapter operations.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/common/btio.c new/bluez-4.39/common/btio.c
--- old/bluez-4.38/common/btio.c 2009-04-11 13:34:58.000000000 +0200
+++ new/bluez-4.39/common/btio.c 2009-05-09 11:31:01.000000000 +0200
@@ -100,6 +100,20 @@
g_free(accept);
}
+static gboolean check_nval(GIOChannel *io)
+{
+ struct pollfd fds;
+
+ memset(&fds, 0, sizeof(fds));
+ fds.fd = g_io_channel_unix_get_fd(io);
+ fds.events = POLLNVAL;
+
+ if (poll(&fds, 1, 0) > 0 && (fds.revents & POLLNVAL))
+ return TRUE;
+
+ return FALSE;
+}
+
static gboolean accept_cb(GIOChannel *io, GIOCondition cond,
gpointer user_data)
{
@@ -107,7 +121,7 @@
GError *err = NULL;
/* If the user aborted this accept attempt */
- if (cond & G_IO_NVAL)
+ if ((cond & G_IO_NVAL) || check_nval(io))
return FALSE;
if (cond & (G_IO_HUP | G_IO_ERR))
@@ -128,7 +142,7 @@
GError *gerr = NULL;
/* If the user aborted this connect attempt */
- if (cond & G_IO_NVAL)
+ if ((cond & G_IO_NVAL) || check_nval(io))
return FALSE;
if (cond & G_IO_OUT) {
@@ -162,7 +176,7 @@
GIOChannel *cli_io;
/* If the user closed the server */
- if (cond & G_IO_NVAL)
+ if ((cond & G_IO_NVAL) || check_nval(io))
return FALSE;
srv_sock = g_io_channel_unix_get_fd(io);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/common/glib-helper.c new/bluez-4.39/common/glib-helper.c
--- old/bluez-4.38/common/glib-helper.c 2009-05-04 01:00:28.000000000 +0200
+++ new/bluez-4.39/common/glib-helper.c 2009-05-09 11:31:01.000000000 +0200
@@ -283,8 +283,9 @@
sdp_list_free(search, NULL);
/* Set callback responsible for update the internal SDP transaction */
- g_io_add_watch(chan, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
- search_process_cb, ctxt);
+ ctxt->io_id = g_io_add_watch(chan,
+ G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
+ search_process_cb, ctxt);
return FALSE;
failed:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/configure new/bluez-4.39/configure
--- old/bluez-4.38/configure 2009-05-04 01:13:05.000000000 +0200
+++ new/bluez-4.39/configure 2009-05-09 11:31:39.000000000 +0200
@@ -2530,7 +2530,7 @@
# Define the identity of the package.
PACKAGE=bluez
- VERSION=4.38
+ VERSION=4.39
cat >>confdefs.h <<_ACEOF
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/configure.ac new/bluez-4.39/configure.ac
--- old/bluez-4.38/configure.ac 2009-05-04 01:12:27.000000000 +0200
+++ new/bluez-4.39/configure.ac 2009-05-09 11:31:01.000000000 +0200
@@ -1,7 +1,7 @@
AC_PREREQ(2.60)
AC_INIT()
-AM_INIT_AUTOMAKE(bluez, 4.38)
+AM_INIT_AUTOMAKE(bluez, 4.39)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/doc/device-api.txt new/bluez-4.39/doc/device-api.txt
--- old/bluez-4.38/doc/device-api.txt 2008-12-05 20:08:45.000000000 +0100
+++ new/bluez-4.39/doc/device-api.txt 2009-05-09 11:31:01.000000000 +0200
@@ -16,7 +16,7 @@
Methods dict GetProperties()
- Returns all properties for the adapter. See the
+ Returns all properties for the device. See the
properties section for available properties.
Possible Errors: org.bluez.Error.DoesNotExist
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/gdbus/watch.c new/bluez-4.39/gdbus/watch.c
--- old/bluez-4.38/gdbus/watch.c 2009-04-11 13:34:58.000000000 +0200
+++ new/bluez-4.39/gdbus/watch.c 2009-05-09 11:31:01.000000000 +0200
@@ -54,6 +54,8 @@
DBusConnection *connection;
char *name;
GSList *callbacks;
+ GSList *processed;
+ gboolean lock;
};
static struct name_data *name_data_find(DBusConnection *connection,
@@ -146,7 +148,11 @@
name_listeners = g_slist_append(name_listeners, data);
done:
- data->callbacks = g_slist_append(data->callbacks, cb);
+ if (data->lock)
+ data->processed = g_slist_append(data->processed, cb);
+ else
+ data->callbacks = g_slist_append(data->callbacks, cb);
+
return first;
}
@@ -229,10 +235,9 @@
static DBusHandlerResult name_exit_filter(DBusConnection *connection,
DBusMessage *message, void *user_data)
{
- GSList *l;
struct name_data *data;
+ struct name_callback *cb;
char *name, *old, *new;
- int keep = 0;
if (!dbus_message_is_signal(message, DBUS_INTERFACE_DBUS,
"NameOwnerChanged"))
@@ -253,8 +258,11 @@
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
- for (l = data->callbacks; l != NULL; l = l->next) {
- struct name_callback *cb = l->data;
+ data->lock = TRUE;
+
+ while (data->callbacks) {
+ cb = data->callbacks->data;
+
if (*new == '\0') {
if (cb->disc_func)
cb->disc_func(connection, cb->user_data);
@@ -262,11 +270,27 @@
if (cb->conn_func)
cb->conn_func(connection, cb->user_data);
}
- if (cb->conn_func && cb->disc_func)
- keep = 1;
+
+ /* Check if the watch was removed/freed by the callback
+ * function */
+ if (!g_slist_find(data->callbacks, cb))
+ continue;
+
+ data->callbacks = g_slist_remove(data->callbacks, cb);
+
+ if (!cb->conn_func || !cb->disc_func) {
+ g_free(cb);
+ continue;
+ }
+
+ data->processed = g_slist_append(data->processed, cb);
}
- if (keep)
+ data->callbacks = data->processed;
+ data->processed = NULL;
+ data->lock = FALSE;
+
+ if (data->callbacks)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
name_listeners = g_slist_remove(name_listeners, data);
@@ -349,16 +373,23 @@
if (cb->id == id)
goto remove;
}
+ for (lcb = data->processed; lcb; lcb = lcb->next) {
+ cb = lcb->data;
+ if (cb->id == id)
+ goto remove;
+ }
}
return FALSE;
remove:
data->callbacks = g_slist_remove(data->callbacks, cb);
+ data->processed = g_slist_remove(data->processed, cb);
g_free(cb);
- /* Don't remove the filter if other callbacks exist */
- if (data->callbacks)
+ /* Don't remove the filter if other callbacks exist or data is lock
+ * processing callbacks */
+ if (data->callbacks || data->lock)
return TRUE;
if (data->name) {
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/input/device.c new/bluez-4.39/input/device.c
--- old/bluez-4.38/input/device.c 2009-05-04 01:00:28.000000000 +0200
+++ new/bluez-4.39/input/device.c 2009-05-09 11:31:01.000000000 +0200
@@ -153,6 +153,9 @@
static void input_device_free(struct input_device *idev)
{
+ if (idev->dc_id)
+ device_remove_disconnect_watch(idev->device, idev->dc_id);
+
dbus_connection_unref(idev->conn);
btd_device_unref(idev->device);
g_free(idev->name);
@@ -424,6 +427,7 @@
"Connected", DBUS_TYPE_BOOLEAN, &connected);
device_remove_disconnect_watch(idev->device, idev->dc_id);
+ idev->dc_id = 0;
iconn->intr_watch = 0;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/network/connection.c new/bluez-4.39/network/connection.c
--- old/bluez-4.38/network/connection.c 2009-05-04 01:00:28.000000000 +0200
+++ new/bluez-4.39/network/connection.c 2009-05-09 11:31:01.000000000 +0200
@@ -163,6 +163,7 @@
NETWORK_PEER_INTERFACE, "UUID",
DBUS_TYPE_STRING, &property);
device_remove_disconnect_watch(nc->peer->device, nc->dc_id);
+ nc->dc_id = 0;
if (nc->watch) {
g_dbus_remove_watch(connection, nc->watch);
nc->watch = 0;
@@ -516,6 +517,9 @@
static void connection_free(struct network_conn *nc)
{
+ if (nc->dc_id)
+ device_remove_disconnect_watch(nc->peer->device, nc->dc_id);
+
connection_destroy(connection, nc);
g_free(nc);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/plugins/hciops.c new/bluez-4.39/plugins/hciops.c
--- old/bluez-4.38/plugins/hciops.c 2009-05-04 01:00:28.000000000 +0200
+++ new/bluez-4.39/plugins/hciops.c 2009-05-09 11:31:01.000000000 +0200
@@ -439,10 +439,34 @@
return err;
}
+static int hciops_stop(int index)
+{
+ int dd;
+ int err = 0;
+
+ dd = hci_open_dev(index);
+ if (dd < 0)
+ return -EIO;
+
+ if (ioctl(dd, HCIDEVDOWN, index) == 0)
+ goto done; /* on success */
+
+ if (errno != EALREADY) {
+ err = -errno;
+ error("Can't stop device hci%d: %s (%d)",
+ index, strerror(errno), errno);
+ }
+
+done:
+ hci_close_dev(dd);
+ return err;
+}
+
static struct btd_adapter_ops hci_ops = {
.setup = hciops_setup,
.cleanup = hciops_cleanup,
.start = hciops_start,
+ .stop = hciops_stop,
};
static int hciops_init(void)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/plugins/service.c new/bluez-4.39/plugins/service.c
--- old/bluez-4.38/plugins/service.c 2009-05-04 01:00:28.000000000 +0200
+++ new/bluez-4.39/plugins/service.c 2009-05-09 11:31:01.000000000 +0200
@@ -761,6 +761,8 @@
g_dbus_remove_watch(connection, user_record->listener_id);
exit_callback(connection, user_record);
}
+
+ g_free(serv_adapter);
}
static int register_interface(const char *path, struct btd_adapter *adapter)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/src/adapter.c new/bluez-4.39/src/adapter.c
--- old/bluez-4.38/src/adapter.c 2009-05-04 01:00:28.000000000 +0200
+++ new/bluez-4.39/src/adapter.c 2009-05-09 11:31:01.000000000 +0200
@@ -66,7 +66,7 @@
#define IO_CAPABILITY_DISPLAYONLY 0x00
#define IO_CAPABILITY_DISPLAYYESNO 0x01
#define IO_CAPABILITY_KEYBOARDONLY 0x02
-#define IO_CAPABILITY_NOINPUTOUTPUT 0x03
+#define IO_CAPABILITY_NOINPUTNOOUTPUT 0x03
#define IO_CAPABILITY_INVALID 0xFF
#define check_address(address) bachk(address)
@@ -424,18 +424,21 @@
};
hci_send_req(dd, &rq, HCI_REQ_TIMEOUT);
+ hci_close_dev(dd);
- if (ioctl(dd, HCIDEVDOWN, adapter->dev_id) < 0) {
- err = -errno;
- hci_close_dev(dd);
+ err = adapter_ops->stop(adapter->dev_id);
+ if (err < 0)
return err;
- }
adapter->off_requested = TRUE;
goto done;
}
+ dd = hci_open_dev(adapter->dev_id);
+ if (dd < 0)
+ return -EIO;
+
if (current_scan != scan_enable) {
err = hci_send_cmd(dd, OGF_HOST_CTL, OCF_WRITE_SCAN_ENABLE,
1, &scan_enable);
@@ -633,6 +636,9 @@
g_slist_free(adapter->found_devices);
adapter->found_devices = NULL;
+ g_slist_free(adapter->oor_devices);
+ adapter->oor_devices = NULL;
+
if (adapter->state & STD_INQUIRY)
cancel_discovery(adapter);
else if (adapter->scheduler_id)
@@ -1145,7 +1151,7 @@
if (adapter->disc_sessions)
goto done;
- if (main_opts.inqmode)
+ if (main_opts.discov_interval)
err = start_inquiry(adapter);
else
err = start_periodic_inquiry(adapter);
@@ -1526,8 +1532,8 @@
return IO_CAPABILITY_DISPLAYYESNO;
if (g_str_equal(capability, "KeyboardOnly"))
return IO_CAPABILITY_KEYBOARDONLY;
- if (g_str_equal(capability, "NoInputOutput"))
- return IO_CAPABILITY_NOINPUTOUTPUT;
+ if (g_str_equal(capability, "NoInputNoOutput"))
+ return IO_CAPABILITY_NOINPUTNOOUTPUT;
return IO_CAPABILITY_INVALID;
}
@@ -1560,6 +1566,10 @@
return invalid_args(msg);
device = adapter_get_device(conn, adapter, address);
+ if (!device)
+ return g_dbus_create_error(msg,
+ ERROR_INTERFACE ".Failed",
+ "Unable to create a new device object");
return device_create_bonding(device, conn, msg, agent_path, cap);
}
@@ -1999,11 +2009,12 @@
return main_opts.pairto;
}
-static int adapter_up(struct btd_adapter *adapter, int dd)
+static int adapter_up(struct btd_adapter *adapter)
{
char mode[14], srcaddr[18];
uint8_t scan_mode;
gboolean powered, dev_down = FALSE;
+ int dd;
ba2str(&adapter->bdaddr, srcaddr);
@@ -2046,7 +2057,7 @@
else
write_device_mode(&adapter->bdaddr, mode);
- return adapter_up(adapter, dd);
+ return adapter_up(adapter);
} else if (!g_str_equal(mode, "connectable") &&
adapter->discov_timeout == 0) {
/* Set discoverable only if timeout is 0 */
@@ -2056,6 +2067,11 @@
}
proceed:
+ dd = hci_open_dev(adapter->dev_id);
+
+ if (dd < 0)
+ return -EIO;
+
if (dev_down == FALSE)
hci_send_cmd(dd, OGF_HOST_CTL, OCF_WRITE_SCAN_ENABLE,
1, &scan_mode);
@@ -2070,13 +2086,14 @@
adapter->initialized = TRUE;
- adapter_update(adapter, 0, FALSE);
-
manager_add_adapter(adapter->path);
}
+ if (adapter->svc_cache)
+ adapter_update(adapter, 0);
+
if (dev_down) {
- ioctl(dd, HCIDEVDOWN, adapter->dev_id);
+ adapter_ops->stop(adapter->dev_id);
adapter->off_requested = TRUE;
return 1;
} else
@@ -2084,6 +2101,8 @@
ADAPTER_INTERFACE, "Powered",
DBUS_TYPE_BOOLEAN, &powered);
+ hci_close_dev(dd);
+
return 0;
}
@@ -2197,10 +2216,10 @@
adapter->state &= ~STD_INQUIRY;
adapter_setup(adapter, dd);
- err = adapter_up(adapter, dd);
-
hci_close_dev(dd);
+ err = adapter_up(adapter);
+
info("Adapter %s has been enabled", adapter->path);
return err;
@@ -2313,8 +2332,7 @@
return 0;
}
-int adapter_update(struct btd_adapter *adapter, uint8_t new_svc,
- gboolean starting)
+int adapter_update(struct btd_adapter *adapter, uint8_t new_svc)
{
struct hci_dev *dev = &adapter->dev;
int dd;
@@ -2323,7 +2341,7 @@
if (dev->ignore)
return 0;
- if (starting || !adapter->initialized) {
+ if (!adapter->up) {
adapter->svc_cache = new_svc;
return 0;
}
@@ -2457,16 +2475,9 @@
unload_drivers(adapter);
/* Return adapter to down state if it was not up on init */
- if (adapter->up && !adapter->already_up) {
- int dd = hci_open_dev(adapter->dev_id);
- if (dd < 0)
- goto done;
+ if (adapter->up && !adapter->already_up)
+ adapter_ops->stop(adapter->dev_id);
- ioctl(dd, HCIDEVDOWN, adapter->dev_id);
- hci_close_dev(dd);
- }
-
-done:
g_dbus_unregister_interface(connection, path, ADAPTER_INTERFACE);
g_free(path);
}
@@ -2499,8 +2510,9 @@
if (state & PERIODIC_INQUIRY || state & STD_INQUIRY)
discov_active = TRUE;
- else if (adapter->disc_sessions && main_opts.inqmode)
- adapter->scheduler_id = g_timeout_add_seconds(main_opts.inqmode,
+ else if (adapter->disc_sessions && main_opts.discov_interval)
+ adapter->scheduler_id = g_timeout_add_seconds(
+ main_opts.discov_interval,
(GSourceFunc) start_inquiry,
adapter);
@@ -2654,6 +2666,11 @@
if (dev) {
if (rssi == dev->rssi)
return;
+
+ /* Out of range list update */
+ adapter->oor_devices = g_slist_remove(adapter->oor_devices,
+ dev);
+
goto done;
}
@@ -2698,53 +2715,27 @@
void adapter_update_oor_devices(struct btd_adapter *adapter)
{
GSList *l;
- struct remote_dev_info *dev;
- bdaddr_t tmp;
for (l = adapter->oor_devices; l; l = l->next) {
- char *address = l->data;
- struct remote_dev_info match;
+ char address[18];
+ const char *paddr = address;
+ struct remote_dev_info *dev = l->data;
- memset(&match, 0, sizeof(struct remote_dev_info));
- str2ba(address, &match.bdaddr);
+ ba2str(&dev->bdaddr, address);
g_dbus_emit_signal(connection, adapter->path,
ADAPTER_INTERFACE, "DeviceDisappeared",
- DBUS_TYPE_STRING, &address,
+ DBUS_TYPE_STRING, &paddr,
DBUS_TYPE_INVALID);
- dev = adapter_search_found_devices(adapter, &match);
- if (!dev)
- continue;
-
adapter->found_devices = g_slist_remove(adapter->found_devices, dev);
dev_info_free(dev);
}
- g_slist_foreach(adapter->oor_devices, (GFunc) free, NULL);
g_slist_free(adapter->oor_devices);
adapter->oor_devices = NULL;
- for (l = adapter->found_devices; l; l = l->next) {
- dev = l->data;
- baswap(&tmp, &dev->bdaddr);
- adapter->oor_devices = g_slist_append(adapter->oor_devices,
- batostr(&tmp));
- }
-}
-
-void adapter_remove_oor_device(struct btd_adapter *adapter, char *peer_addr)
-{
- GSList *l;
-
- l = g_slist_find_custom(adapter->oor_devices, peer_addr,
- (GCompareFunc) strcmp);
- if (l) {
- char *dev = l->data;
- adapter->oor_devices = g_slist_remove(adapter->oor_devices,
- dev);
- g_free(dev);
- }
+ adapter->oor_devices = g_slist_copy(adapter->found_devices);
}
void adapter_mode_changed(struct btd_adapter *adapter, uint8_t scan_mode)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/src/adapter.h new/bluez-4.39/src/adapter.h
--- old/bluez-4.38/src/adapter.h 2009-05-04 01:00:28.000000000 +0200
+++ new/bluez-4.39/src/adapter.h 2009-05-09 11:31:01.000000000 +0200
@@ -73,8 +73,7 @@
int adapter_stop(struct btd_adapter *adapter);
-int adapter_update(struct btd_adapter *adapter, uint8_t cls,
- gboolean starting);
+int adapter_update(struct btd_adapter *adapter, uint8_t cls);
int adapter_get_class(struct btd_adapter *adapter, uint8_t *cls);
@@ -117,7 +116,6 @@
void adapter_emit_device_found(struct btd_adapter *adapter,
struct remote_dev_info *dev);
void adapter_update_oor_devices(struct btd_adapter *adapter);
-void adapter_remove_oor_device(struct btd_adapter *adapter, char *peer_addr);
void adapter_mode_changed(struct btd_adapter *adapter, uint8_t scan_mode);
void adapter_name_changed(struct btd_adapter *adapter, const char *name);
struct agent *adapter_get_agent(struct btd_adapter *adapter);
@@ -153,6 +151,7 @@
int (*setup) (void);
void (*cleanup) (void);
int (*start) (int index);
+ int (*stop) (int index);
};
int btd_register_adapter_ops(struct btd_adapter_ops *btd_adapter_ops);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/src/dbus-hci.c new/bluez-4.39/src/dbus-hci.c
--- old/bluez-4.38/src/dbus-hci.c 2009-04-11 13:34:58.000000000 +0200
+++ new/bluez-4.39/src/dbus-hci.c 2009-05-09 11:31:01.000000000 +0200
@@ -556,9 +556,19 @@
if (found_device_req_name(adapter) == 0)
return;
+ state = adapter_get_state(adapter);
+
+ /*
+ * workaround to identify situation when there is no devices around
+ * but periodic inquiry is active.
+ */
+ if (!(state & STD_INQUIRY) && !(state & PERIODIC_INQUIRY)) {
+ state |= PERIODIC_INQUIRY;
+ adapter_set_state(adapter, state);
+ }
+
/* reset the discover type to be able to handle D-Bus and non D-Bus
* requests */
- state = adapter_get_state(adapter);
state &= ~STD_INQUIRY;
state &= ~PERIODIC_INQUIRY;
adapter_set_state(adapter, state);
@@ -661,17 +671,20 @@
state |= PERIODIC_INQUIRY;
adapter_set_state(adapter, state);
}
- /* Out of range list update */
- if (adapter_get_state(adapter) & PERIODIC_INQUIRY)
- adapter_remove_oor_device(adapter, peer_addr);
+
+ legacy = (data == NULL);
memset(&match, 0, sizeof(struct remote_dev_info));
bacpy(&match.bdaddr, peer);
match.name_status = NAME_SENT;
/* if found: don't send the name again */
dev = adapter_search_found_devices(adapter, &match);
- if (dev)
+ if (dev) {
+ adapter_update_found_devices(adapter, peer, rssi, class,
+ NULL, NULL, legacy,
+ NAME_NOT_REQUIRED);
return;
+ }
/* the inquiry result can be triggered by NON D-Bus client */
if (adapter_get_state(adapter) & RESOLVE_NAME)
@@ -703,7 +716,6 @@
}
}
- legacy = (data == NULL);
if (name && name_type != 0x08)
name_status = NAME_SENT;
@@ -792,6 +804,7 @@
struct btd_device *device;
struct btd_adapter *adapter;
uint8_t local_auth = 0xff, remote_auth, new_key_type;
+ gboolean bonding;
if (!get_adapter_and_device(local, peer, &adapter, &device, TRUE))
return -ENODEV;
@@ -803,6 +816,7 @@
get_auth_requirements(local, peer, &local_auth);
remote_auth = device_get_auth(device);
+ bonding = device_is_bonding(device, NULL);
debug("local auth 0x%02x and remote auth 0x%02x",
local_auth, remote_auth);
@@ -831,7 +845,10 @@
return err;
}
- device_set_temporary(device, FALSE);
+ /* If not the initiator consider the device permanent otherwise
+ * wait to service discover to complete */
+ if (!bonding)
+ device_set_temporary(device, FALSE);
}
/* If this is not the first link key set a flag so a subsequent auth
@@ -841,7 +858,7 @@
if (!device_is_connected(device))
device_set_secmode3_conn(device, TRUE);
- else if (!device_is_bonding(device, NULL) && old_key_type == 0xff)
+ else if (!bonding && old_key_type == 0xff)
hcid_dbus_bonding_process_complete(local, peer, 0);
return 0;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/src/device.c new/bluez-4.39/src/device.c
--- old/bluez-4.38/src/device.c 2009-05-04 01:00:28.000000000 +0200
+++ new/bluez-4.39/src/device.c 2009-05-09 11:31:01.000000000 +0200
@@ -191,7 +191,8 @@
if (device->agent)
agent_destroy(device->agent, FALSE);
- if (agent && agent_is_busy(agent, device))
+ if (agent && (agent_is_busy(agent, device) ||
+ agent_is_busy(agent, device->authr)))
agent_cancel(agent);
g_slist_foreach(device->uuids, (GFunc) g_free, NULL);
@@ -205,6 +206,7 @@
debug("device_free(%p)", device);
+ g_free(device->authr);
g_free(device->path);
g_free(device);
}
@@ -1324,6 +1326,8 @@
g_dbus_send_message(req->conn, reply);
+ device_set_temporary(device, FALSE);
+
cleanup:
browse_req_free(req);
}
@@ -1579,7 +1583,17 @@
}
}
-static void bonding_request_free(struct bonding_req *bonding, gboolean close)
+static void bonding_request_cancel(struct bonding_req *bonding)
+{
+ if (!bonding->io)
+ return;
+
+ g_io_channel_shutdown(bonding->io, TRUE, NULL);
+ g_io_channel_unref(bonding->io);
+ bonding->io = NULL;
+}
+
+static void bonding_request_free(struct bonding_req *bonding)
{
struct btd_device *device;
@@ -1598,11 +1612,8 @@
if (bonding->io_id)
g_source_remove(bonding->io_id);
- if (bonding->io) {
- if (close)
- g_io_channel_shutdown(bonding->io, TRUE, NULL);
+ if (bonding->io)
g_io_channel_unref(bonding->io);
- }
device = bonding->device;
g_free(bonding);
@@ -1686,6 +1697,8 @@
error_connection_attempt_failed(device->bonding->conn,
device->bonding->msg, ENETDOWN);
+ bonding_request_free(device->bonding);
+
return FALSE;
}
@@ -1775,7 +1788,7 @@
cleanup:
device->bonding->io_id = 0;
- bonding_request_free(device->bonding, FALSE);
+ bonding_request_free(device->bonding);
}
static void create_bond_req_exit(DBusConnection *conn, void *user_data)
@@ -1789,7 +1802,7 @@
if (device->bonding) {
device->bonding->listener_id = 0;
- bonding_request_free(device->bonding, TRUE);
+ bonding_request_cancel(device->bonding);
}
}
@@ -1883,7 +1896,6 @@
goto failed;
device->auth = 0xff;
- device->temporary = FALSE;
g_free(device->authr);
device->authr = NULL;
@@ -1917,7 +1929,7 @@
device_set_paired(device, TRUE);
- bonding_request_free(bonding, TRUE);
+ bonding_request_free(bonding);
return;
@@ -1954,7 +1966,8 @@
reply = new_authentication_return(bonding->msg, status);
g_dbus_send_message(bonding->conn, reply);
- bonding_request_free(bonding, TRUE);
+ bonding_request_cancel(bonding);
+ bonding_request_free(bonding);
}
static void pincode_cb(struct agent *agent, DBusError *err, const char *pincode,
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/src/hcid.h new/bluez-4.39/src/hcid.h
--- old/bluez-4.38/src/hcid.h 2009-05-04 01:00:28.000000000 +0200
+++ new/bluez-4.39/src/hcid.h 2009-05-09 11:31:01.000000000 +0200
@@ -62,7 +62,7 @@
uint8_t scan;
uint8_t mode;
- uint8_t inqmode;
+ uint8_t discov_interval;
char deviceid[15]; /* FIXME: */
int sock;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/src/main.c new/bluez-4.39/src/main.c
--- old/bluez-4.38/src/main.c 2009-05-04 01:12:27.000000000 +0200
+++ new/bluez-4.39/src/main.c 2009-05-09 11:31:01.000000000 +0200
@@ -57,8 +57,6 @@
struct main_opts main_opts;
-static gboolean starting = TRUE;
-
static GKeyFile *load_config(const char *file)
{
GError *err = NULL;
@@ -150,8 +148,8 @@
debug("%s", err->message);
g_clear_error(&err);
} else {
- debug("inqmode=%d", val);
- main_opts.inqmode = val;
+ debug("discov_interval=%d", val);
+ main_opts.discov_interval = val;
}
boolean = g_key_file_get_boolean(config, "General",
@@ -226,14 +224,11 @@
if (hci_test_bit(HCI_RAW, &di.flags))
continue;
- if (!hci_test_bit(HCI_UP, &di.flags))
- continue;
-
if (bacmp(bdaddr, BDADDR_ANY) != 0 &&
bacmp(bdaddr, &di.bdaddr) != 0)
continue;
- manager_update_adapter(di.dev_id, value, starting);
+ manager_update_adapter(di.dev_id, value);
}
g_free(dl);
@@ -417,8 +412,6 @@
exit(1);
}
- starting = FALSE;
-
manager_startup_complete();
debug("Entering main loop");
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/src/manager.c new/bluez-4.39/src/manager.c
--- old/bluez-4.38/src/manager.c 2009-04-16 18:57:29.000000000 +0200
+++ new/bluez-4.39/src/manager.c 2009-05-09 11:31:01.000000000 +0200
@@ -60,7 +60,7 @@
return base_path;
}
-int manager_update_adapter(uint16_t dev_id, uint8_t svc, gboolean starting)
+int manager_update_adapter(uint16_t dev_id, uint8_t svc)
{
struct btd_adapter *adapter;
@@ -68,7 +68,7 @@
if (!adapter)
return -EINVAL;
- return adapter_update(adapter, svc, starting);
+ return adapter_update(adapter, svc);
}
int manager_startup_complete(void)
@@ -77,7 +77,7 @@
for (l = adapters; l != NULL; l = l->next) {
struct btd_adapter *adapter = l->data;
- adapter_update(adapter, 0, FALSE);
+ adapter_update(adapter, 0);
}
return 0;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/src/manager.h new/bluez-4.39/src/manager.h
--- old/bluez-4.38/src/manager.h 2009-05-04 01:00:28.000000000 +0200
+++ new/bluez-4.39/src/manager.h 2009-05-09 11:31:01.000000000 +0200
@@ -40,7 +40,7 @@
void manager_add_adapter(const char *path);
int manager_get_default_adapter();
void manager_set_default_adapter(int id);
-int manager_update_adapter(uint16_t id, uint8_t svc, gboolean starting);
+int manager_update_adapter(uint16_t id, uint8_t svc);
int manager_startup_complete(void);
int manager_get_adapter_class(uint16_t dev_id, uint8_t *cls);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/test/l2test.c new/bluez-4.39/test/l2test.c
--- old/bluez-4.38/test/l2test.c 2009-05-04 01:00:28.000000000 +0200
+++ new/bluez-4.39/test/l2test.c 2009-05-09 11:31:01.000000000 +0200
@@ -826,7 +826,7 @@
l2cap_info_req *req = (l2cap_info_req *) (buf + L2CAP_CMD_HDR_SIZE);
l2cap_info_rsp *rsp = (l2cap_info_rsp *) (buf + L2CAP_CMD_HDR_SIZE);
uint16_t mtu;
- uint32_t mask, channels;
+ uint32_t channels, mask = 0x0000;
struct sockaddr_l2 addr;
int sk, err;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.38/tools/hciattach.c new/bluez-4.39/tools/hciattach.c
--- old/bluez-4.38/tools/hciattach.c 2009-01-08 17:00:12.000000000 +0100
+++ new/bluez-4.39/tools/hciattach.c 2009-05-09 11:31:01.000000000 +0200
@@ -27,6 +27,7 @@
#include