Return-Path: Message-ID: <01d801c8bc5a$027798d0$6701a8c0@freqonedev> From: "David Stockwell" To: "BlueZ development" Cc: "Marcel Holtmann" , "Johan Hedberg" Subject: Problems with returning Default Adapter in C-Glib-DBus code Date: Thu, 22 May 2008 17:20:10 -0500 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_01D4_01C8BC30.16C7E3F0" List-ID: This is a multi-part message in MIME format. ------=_NextPart_000_01D4_01C8BC30.16C7E3F0 Content-Type: multipart/alternative; boundary="----=_NextPart_001_01D5_01C8BC30.16C7E3F0" ------=_NextPart_001_01D5_01C8BC30.16C7E3F0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Since upgrading to 3.32 (and possibly before), I have been having a = problem with calling the new, experimental DefaultAdapter method against = the "/". When I do so, it properly returns the Adapter path "/hci0", = but fails with the following error: Unregistered object at path '/hci0'. Prior to this, I used to call what was effectively the old = DefaultAdapter using the "/org/bluez" path and returning the old string = version of the Adapter path, receiving "/org/bluez/hci0". Output of my failing program is as follows (also, in = DefaultAdapterOut.txt): after dbus_g_proxy_new_for_name (dMgrObj) bus: org.bluez path: / interface: org.bluez.Manager Failed to get DefaultAdapter: Unregistered object at path '/hci0' At the same time, I called dbus-send to see if this was some more = fundamental failure, but calls against both paths are successful, as = shown in the following (DefaultAdapter.txt): [dstockwell@freqonec001 ~]$ dbus-send --system --type=3Dmethod_call = --print-reply --dest=3Dorg.bluez /org/bluez = org.bluez.Manager.DefaultAdapter method return sender=3D:1.12 -> dest=3D:1.22 string "/org/bluez/hci0" [dstockwell@freqonec001 ~]$ dbus-send --system --type=3Dmethod_call = --print-reply --dest=3Dorg.bluez / org.bluez.Manager.DefaultAdapter method return sender=3D:1.12 -> dest=3D:1.23 object path "/hci0" I have attached a cut-down version of the source, which I am compiling = against KDE and MandrivaLinux. MY SUSPICION is that the real problem is that I did not adjust my source = application to use libgdbus, introduced in 3.32. Specifically, given = the following set of includes, which of these are replaced by gdbus.h? #include #include #include #include Any hints will be appreciated... David Stockwell ------=_NextPart_001_01D5_01C8BC30.16C7E3F0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Since upgrading to 3.32 (and possibly before), I have been having a = problem=20 with calling the new, experimental DefaultAdapter method against the = "/". =20 When I do so, it properly returns the Adapter path "/hci0", but fails = with the=20 following error: Unregistered object at path '/hci0'.
 
Prior to this, I used to call what was effectively the old = DefaultAdapter=20 using the "/org/bluez" path and returning the old string = version of=20 the Adapter path, receiving "/org/bluez/hci0".
 
Output of my failing program is as follows (also, in=20 DefaultAdapterOut.txt):
 
after dbus_g_proxy_new_for_name=20 (dMgrObj)
 bus:      =20 org.bluez
 path:      = /
 interface:=20 org.bluez.Manager
Failed to get DefaultAdapter: Unregistered = object=20 at path '/hci0'
At the same time, I called dbus-send to see if this was some more=20 fundamental failure, but calls against both paths are successful, as = shown in=20 the following (DefaultAdapter.txt):
 
[dstockwell@freqonec001 ~]$ dbus-send --system --type=3Dmethod_call = --print-reply --dest=3Dorg.bluez /org/bluez=20 org.bluez.Manager.DefaultAdapter
method return sender=3D:1.12 ->=20 dest=3D:1.22
   string = "/org/bluez/hci0"
[dstockwell@freqonec001=20 ~]$ dbus-send --system --type=3Dmethod_call --print-reply = --dest=3Dorg.bluez /=20 org.bluez.Manager.DefaultAdapter
method return sender=3D:1.12 ->=20 dest=3D:1.23
   object path "/hci0"
 
I have attached a cut-down version of the source, which I am = compiling=20 against KDE and MandrivaLinux.
 
MY SUSPICION is that the real problem is that I = did not=20 adjust my source application to use libgdbus, introduced in 3.32. =20 Specifically, given the following set of includes, which of these are = replaced=20 by gdbus.h?
 
#include <dbus/dbus.h>
#include=20 <dbus/dbus-glib.h>
#include=20 <dbus/dbus-glib-lowlevel.h>
#include = <glib-object.h>
Any hints will be appreciated...
 
David Stockwell
 

 
------=_NextPart_001_01D5_01C8BC30.16C7E3F0-- ------=_NextPart_000_01D4_01C8BC30.16C7E3F0 Content-Type: application/octet-stream; name="DefaultAdapter.cpp" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="DefaultAdapter.cpp" #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include // #define DBUS_API_SUBJECT_TO_CHANGE #include #include #include #include #include using namespace std; static GMainLoop *mainLoop=3DNULL; static DBusGConnection *dBusG =3D NULL; static GError *dError=3DNULL; static DBusGProxy *dMgrObj=3DNULL; static void run_mainLoop() { GMainContext *ctx; ctx=3Dg_main_loop_get_context(mainLoop); while (g_main_context_pending(ctx)) g_main_context_iteration(ctx, FALSE); } int main(int argc, char *argv[]) { char *servicePath =3D (char *) malloc(32); g_type_init(); g_log_set_always_fatal(G_LOG_LEVEL_WARNING); mainLoop=3Dg_main_loop_new(NULL, FALSE); dBusG=3Ddbus_g_bus_get(DBUS_BUS_SYSTEM, &dError); if (dError!=3DNULL) { cout << "Connection to System Bus failed: " << dError->message << = endl; g_error_free(dError); return EXIT_FAILURE; } run_mainLoop(); dbus_g_connection_flush(dBusG); // registerMarshallers(); dMgrObj=3Ddbus_g_proxy_new_for_name(dBusG, "org.bluez", "/", = "org.bluez.Manager"); cout << "after dbus_g_proxy_new_for_name (dMgrObj)" << endl; cout << " bus: " << dbus_g_proxy_get_bus_name(dMgrObj) << endl; cout << " path: " << dbus_g_proxy_get_path(dMgrObj) << endl; cout << " interface: " << dbus_g_proxy_get_interface(dMgrObj) << endl; initManagerSignals(dBusG, dMgrObj); /* Now, identify the Default Adapter path and establish a proxy to the = org.bluez.Adapter interface for that Adapter */ if (dbus_g_proxy_call(dMgrObj, "DefaultAdapter", &dError, = G_TYPE_INVALID, G_TYPE_OBJECT, &servicePath, G_TYPE_INVALID)) { cout << "DefaultAdapter is " << servicePath << endl; } else { if (dError!=3DNULL) { cout << "Failed to get DefaultAdapter: " << dError->message << endl; g_error_free(dError); return EXIT_FAILURE; } } } ------=_NextPart_000_01D4_01C8BC30.16C7E3F0 Content-Type: text/plain; name="DefaultAdapterOut.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="DefaultAdapterOut.txt" after dbus_g_proxy_new_for_name (dMgrObj) bus: org.bluez path: / interface: org.bluez.Manager Failed to get DefaultAdapter: Unregistered object at path '/hci0' ------=_NextPart_000_01D4_01C8BC30.16C7E3F0 Content-Type: text/plain; name="DefaultAdapter.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="DefaultAdapter.txt" [dstockwell@freqonec001 ~]$ dbus-send --system --type=3Dmethod_call = --print-reply --dest=3Dorg.bluez /org/bluez = org.bluez.Manager.DefaultAdapter method return sender=3D:1.12 -> dest=3D:1.22 string "/org/bluez/hci0" [dstockwell@freqonec001 ~]$ dbus-send --system --type=3Dmethod_call = --print-reply --dest=3Dorg.bluez / org.bluez.Manager.DefaultAdapter method return sender=3D:1.12 -> dest=3D:1.23 object path "/hci0" ------=_NextPart_000_01D4_01C8BC30.16C7E3F0--