2007-01-15 13:02:45

by Andrew Kohlsmith

[permalink] [raw]
Subject: [Bluez-users] bluez and dbus - how to turn on discovery?

I've seen it in this list, but I can't find it now.

dbus is such a hairy pain in the ass, I hope that my opinion of it changes
once I understand it more.

I would have thought that using a dbus "browser" such as kdbus I would have
found a method to turn discovery on and off, as well as a bunch of other
things. However, browsing the system bus it I see

:1.0/org/bluez as an object (with nothing else)
org.bluez/org/bluez as an object (again with nothing else)

There isn't anything interesting in the session bus (at least not relating to
Bluez, although I wasn't expecting to find anything.)

There is also an org.freedesktop.DBus interface in both the system and session
busses with a ton of crap under it, but nothing bluez-related.

I haven't found much in the way of documentation on how to use this, yet we're
all expected to use it. Can someone assist in giving perhaps a crash course
in controlling bluez through dbus?

-A.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users


2007-01-16 14:04:41

by Pierre-Yves Paulus

[permalink] [raw]
Subject: Re: [Bluez-users] bluez and dbus - how to turn on discovery?

Hello Andrew,

> The latest bluez (3.8) does return a grammatically correct XML response now
> (empty node). I must ask again though -- how does one see which
> methods/properties bluez makes available through dbus? How does one find out
> which bluetooth interfaces (hci0, hci1, etc.) are available?

For now, have a look at

http://bluez.cvs.sourceforge.net/bluez/utils/hcid/dbus-api.txt?view=markup

You will find that there is a ListAdapters() method in the Manager
hierarchy which will let you list current adapters, along the list of
all other methods.

Regards,
Pierre-Yves


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2007-01-16 13:59:12

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] bluez and dbus - how to turn on discovery?

Hi Andrew,

> > Sorry, but this org.bluez is not an interface, but the bluez service.
>
> I'm still trying to get my head around the dbus nomenclature. It's a work in
> progress (my understanding, that is). The various FAQs are helping, but it's
> taking some time yet.

we all had our problems. You actually need to use it to understand how
it works.

> > Yep, hcid is not answering the Introspect calls with the interface
> > methods and their signatures.
>
> The latest bluez (3.8) does return a grammatically correct XML response now
> (empty node). I must ask again though -- how does one see which
> methods/properties bluez makes available through dbus? How does one find out
> which bluetooth interfaces (hci0, hci1, etc.) are available?

The introspection support is a problem and we know that. Mainly this is
because the low-level D-Bus API (which we use) makes it kinda hard to
easily support introspection. Especially if you have a lot of methods
and signals it is kinda horrible. And right now we simply haven't added
full introspection support. However we have a dbus-api.txt document in
the the source code that describes all methods and signals.

And to answer your question. You connect to the org.bluez service and
then you call org.bluez.Manager.ListAdapters() on the /org/bluez object
path. The return will be a list of object paths that implement the
org.bluez.Adapter interface. It sounds strange, but once you understood
it, it makes perfect sense.

> I mean ok I can see how dbus is taking a lot of programming load off of the
> bluez IPC requirements, but it seems that the soul of dbus was removed in the
> bluez implementation.

This has nothing to do with the soul of D-Bus. It is simply a big
difference if you use a high-level language or C with no additional
bindings.

Regards

Marcel



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2007-01-16 13:28:37

by Andrew Kohlsmith

[permalink] [raw]
Subject: Re: [Bluez-users] bluez and dbus - how to turn on discovery?

On Tuesday 16 January 2007 8:02 am, Ulisses Furquim wrote:
> Sorry, but this org.bluez is not an interface, but the bluez service.

I'm still trying to get my head around the dbus nomenclature. It's a work in
progress (my understanding, that is). The various FAQs are helping, but it's
taking some time yet.

> Yep, hcid is not answering the Introspect calls with the interface
> methods and their signatures.

The latest bluez (3.8) does return a grammatically correct XML response now
(empty node). I must ask again though -- how does one see which
methods/properties bluez makes available through dbus? How does one find out
which bluetooth interfaces (hci0, hci1, etc.) are available?

I mean ok I can see how dbus is taking a lot of programming load off of the
bluez IPC requirements, but it seems that the soul of dbus was removed in the
bluez implementation.

-A.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2007-01-16 13:02:09

by Ulisses Furquim

[permalink] [raw]
Subject: Re: [Bluez-users] bluez and dbus - how to turn on discovery?

On 1/15/07, Andrew Kohlsmith <[email protected]> wrote:
> dbus-send --system --dest=org.freedesktop.DBus --print-reply=1 /org/freedesktop/DBus
> org.freedesktop.DBus.ListNames
> array [
> org.freedesktop.DBus :1.4 org.bluez :1.9 :1.11 ]
>
> I only have an org.bluez interface.

Sorry, but this org.bluez is not an interface, but the bluez service.

> Talking with the guys in FreeNode's #dbus channel too they say that this kind
> of return code is an error:
>
> $ dbus-send --system --dest=org.bluez --print-reply=1 /org/bluez/hci0
> org.freedesktop.DBus.Introspectable.Introspect
> <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection
> 1.0//EN"
> "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
> $
>
> (/org/bluez also sends the exact same response) -- they claim that running
> that should give me some methods/interfaces, a child node or an error.

Yep, hcid is not answering the Introspect calls with the interface
methods and their signatures.

-- Ulisses

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2007-01-15 16:08:14

by Andrew Kohlsmith

[permalink] [raw]
Subject: Re: [Bluez-users] bluez and dbus - how to turn on discovery?

On Monday 15 January 2007 8:24 am, Marcel Holtmann wrote:
> I never used kdbus and so I can't tell you if that would work or not. I
> always use the native interface from C or from Python. Some people use
> dbus-send, but I can't remember the syntax.

For the archives, this is how you do it with dbus-send:

$ dbus-send --system --dest=org.bluez --print-reply=1 /org/bluez/hci0
org.bluez.Adapter.SetMode string:discoverable

Howver... I see no hci0, I see no methods (i.e. Adapter isn't there, SetMode
isn't there)... it looks like the bluez 3.7 release does not have any kind
of introspection or way of seeing what it provides programmatically. Is this
true?

-A.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2007-01-15 15:33:36

by Andrew Kohlsmith

[permalink] [raw]
Subject: Re: [Bluez-users] bluez and dbus - how to turn on discovery?

On Monday 15 January 2007 8:24 am, Marcel Holtmann wrote:
> the session bus is not used by BlueZ at all. We only use the system bus.

Right, I figured that. :-)

> So in general if your adapter has been found you should see org
> org.bluez/org/bluez/hci0 object with the org.bluez.Adapter interface.
> This interface on this path provides a SetMode method that can be used
> to change the mode from "connectable" to "discoverable".

dbus-send --system --dest=org.freedesktop.DBus --print-reply=1 /org/freedesktop/DBus
org.freedesktop.DBus.ListNames
array [
org.freedesktop.DBus :1.4 org.bluez :1.9 :1.11 ]

I only have an org.bluez interface. No org.bluez.Adapter, even though hci0 is
up and running great (hcid is running, and hidd is running, my BT mouse works
great)

> Since you speak about kdbus, I assume you don't use GNOME, but in that
> case you could install bluez-gnome and use the bluetooth-properties
> program to change the setting.

*nods* it looks like kdbus is working fine, as the dbus-send call itself is
returning the exact same info... I just don't have a org.bluez.Adapter
interface, nor do I have any hci0 object path.

Talking with the guys in FreeNode's #dbus channel too they say that this kind
of return code is an error:

$ dbus-send --system --dest=org.bluez --print-reply=1 /org/bluez/hci0
org.freedesktop.DBus.Introspectable.Introspect
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection
1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
$

(/org/bluez also sends the exact same response) -- they claim that running
that should give me some methods/interfaces, a child node or an error.

-A.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2007-01-15 13:24:14

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] bluez and dbus - how to turn on discovery?

Hi Andrew,

> dbus is such a hairy pain in the ass, I hope that my opinion of it changes
> once I understand it more.
>
> I would have thought that using a dbus "browser" such as kdbus I would have
> found a method to turn discovery on and off, as well as a bunch of other
> things. However, browsing the system bus it I see
>
> :1.0/org/bluez as an object (with nothing else)
> org.bluez/org/bluez as an object (again with nothing else)
>
> There isn't anything interesting in the session bus (at least not relating to
> Bluez, although I wasn't expecting to find anything.)
>
> There is also an org.freedesktop.DBus interface in both the system and session
> busses with a ton of crap under it, but nothing bluez-related.
>
> I haven't found much in the way of documentation on how to use this, yet we're
> all expected to use it. Can someone assist in giving perhaps a crash course
> in controlling bluez through dbus?

the session bus is not used by BlueZ at all. We only use the system bus.

I never used kdbus and so I can't tell you if that would work or not. I
always use the native interface from C or from Python. Some people use
dbus-send, but I can't remember the syntax.

So in general if your adapter has been found you should see org
org.bluez/org/bluez/hci0 object with the org.bluez.Adapter interface.
This interface on this path provides a SetMode method that can be used
to change the mode from "connectable" to "discoverable".

Since you speak about kdbus, I assume you don't use GNOME, but in that
case you could install bluez-gnome and use the bluetooth-properties
program to change the setting.

Regards

Marcel



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users