[Pkg-bluetooth-commits] r786 - in /packages/bluez/trunk/debian: bluez.examples changelog patches/001_test_agent_default_adapter.patch
filippo at users.alioth.debian.org
filippo at users.alioth.debian.org
Fri Feb 20 15:26:21 UTC 2009
Author: filippo
Date: Fri Feb 20 15:26:20 2009
New Revision: 786
URL: http://svn.debian.org/wsvn/pkg-bluetooth/?sc=1&rev=786
Log:
* Install a sample commandline agent from test/ into bluetooth-agent
- add 001_test_agent_default_adapter.patch to get the default adapter
* Install test/simple-agent and test/list-devices as examples
Added:
packages/bluez/trunk/debian/bluez.examples
packages/bluez/trunk/debian/patches/001_test_agent_default_adapter.patch
Modified:
packages/bluez/trunk/debian/changelog
Added: packages/bluez/trunk/debian/bluez.examples
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/trunk/debian/bluez.examples?rev=786&op=file
==============================================================================
--- packages/bluez/trunk/debian/bluez.examples (added)
+++ packages/bluez/trunk/debian/bluez.examples Fri Feb 20 15:26:20 2009
@@ -1,0 +1,2 @@
+test/simple-agent
+test/list-devices
Modified: packages/bluez/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/trunk/debian/changelog?rev=786&op=diff
==============================================================================
--- packages/bluez/trunk/debian/changelog (original)
+++ packages/bluez/trunk/debian/changelog Fri Feb 20 15:26:20 2009
@@ -7,8 +7,11 @@
- conflict bluez with bluez-utils (<= 3.36-3)
* Remove hid2hci patches/script
* Remove broken link to documentation (Closes: #504675)
+ * Install a sample commandline agent from test/ into bluetooth-agent
+ - add 001_test_agent_default_adapter.patch to get the default adapter
+ * Install test/simple-agent and test/list-devices as examples
- -- Filippo Giunchedi <filippo at debian.org> Thu, 19 Feb 2009 14:36:00 +0100
+ -- Filippo Giunchedi <filippo at debian.org> Fri, 20 Feb 2009 16:25:17 +0100
bluez (4.29-0ubuntu1) jaunty; urgency=low
Added: packages/bluez/trunk/debian/patches/001_test_agent_default_adapter.patch
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/trunk/debian/patches/001_test_agent_default_adapter.patch?rev=786&op=file
==============================================================================
--- packages/bluez/trunk/debian/patches/001_test_agent_default_adapter.patch (added)
+++ packages/bluez/trunk/debian/patches/001_test_agent_default_adapter.patch Fri Feb 20 15:26:20 2009
@@ -1,0 +1,69 @@
+--- bluez-4.30.orig/test/agent.c 2009-01-08 17:00:12.000000000 +0100
++++ bluez-4.30/test/agent.c 2009-02-19 18:22:46.000000000 +0100
+@@ -279,11 +279,54 @@
+ return 0;
+ }
+
+-static char *get_device(const char *device)
++static char *get_device(DBusConnection *conn, const char *device)
+ {
+- char *path;
++ DBusMessage *msg, *reply;
++ DBusError err;
++ char *path, *tmppath, *default_path = "/org/bluez/hci0";
++
++ if (device) {
++ path = strdup(device);
++ return path;
++ }
++
++ msg = dbus_message_new_method_call("org.bluez", "/",
++ "org.bluez.Manager", "DefaultAdapter");
++ if (!msg) {
++ fprintf(stderr, "Can't allocate new method call\n");
++ return default_path;
++ }
++
++ dbus_error_init(&err);
++
++ reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, &err);
++
++ dbus_message_unref(msg);
++
++ if (!reply) {
++ fprintf(stderr, "Can't get default adapter, using default adapter\n");
++ if (dbus_error_is_set(&err)) {
++ fprintf(stderr, "%s\n", err.message);
++ dbus_error_free(&err);
++ }
++ return default_path;
++ }
++
++ if (!dbus_message_get_args(reply, &err,
++ DBUS_TYPE_OBJECT_PATH, &tmppath, DBUS_TYPE_INVALID)) {
++ fprintf(stderr, "Can't get reply arguments, using default adapter\n");
++ if (dbus_error_is_set(&err)) {
++ fprintf(stderr, "%s\n", err.message);
++ dbus_error_free(&err);
++ }
++ return default_path;
++ }
++
++ path = strdup(tmppath);
++
++ dbus_message_unref(reply);
+
+- path = strdup("/org/bluez/hci0");
++ dbus_connection_flush(conn);
+
+ return path;
+ }
+@@ -365,7 +408,7 @@
+ }
+
+ if (!device_path)
+- device_path = get_device(device_id);
++ device_path = get_device(conn, device_id);
+
+ if (register_agent(conn, device_path, agent_path, capabilities) < 0) {
+ dbus_connection_unref(conn);
More information about the Pkg-bluetooth-commits
mailing list