# Bluez - services vs old-daemons

## the_enigma

Didn't know exactly where this should go, figured bluetooth is wireless at least.

Anyway, Bluez is moving over to "Services" for something something.  I didn't quite get all of it, but the gist seems to be that they are moving away from the old daemons, and onto a services model where specific services are run.

See http://wiki.bluez.org/wiki/Services for more detail

The ebuild for bluez-utils-3.36 won't build the old hidd daemon, amongst others, without the "old-daemons" USE flag set.  I looked into this "Services" function in Bluez, but I can't seem to understand how to use it.  I can read the wiki, and it gives great information if I want to write a program it seems, but I just want to connect my bluetooth mouse.

For now, I've gone back to old-daemons since I know how to run it, but how do I connect to a bluetooth mouse with the new model?

----------

## the_enigma

Well, after playing with dbus some more, I think I worked it out.

```
enigma@epsilon ~ $ dbus-send --system --type=method_call --print-reply --dest=org.bluez \

> /org/bluez org.bluez.Manager.ActivateService string:input

method return sender=:1.134 -> dest=:1.137 reply_serial=2

   string "org.bluez"
```

The above command shows that "sender=:1.134".  This will, I'm pretty sure, differ between systems, so check what your output is.  We need to use this "sender" values as the destination for all the following commands.

Then I ran 

```
# dbus-send --system --type=method_call --print-reply --dest=":1.134" /org/bluez/input org.bluez.input.Manager.ListDevices
```

Which gives 

```

method return sender=:1.134 -> dest=:1.140 reply_serial=2

   array [

      string "/org/bluez/input/pointing0"

   ]

```

So I have a "pointing" device set up apparently.  To actually connect, I have to run 

```
# dbus-send --system --type=method_call --print-reply --dest=":1.134" /org/bluez/input/pointing0 org.bluez.input.Device.Connect
```

Which gives 

```

method return sender=:1.134 -> dest=:1.143 reply_serial=2
```

And then my mouse started working.

I _think_ to connect a new device, you have to first create it with 

```
 #dbus-send --system --type=method_call --print-reply --dest=":1.134" /org/bluez/input org.bluez.input.Manager.CreateDevice string:00:07:61:D0:21:4D
```

 but my mouse was already listed, so I'm not sure on this.

Hope that helps someone else.  I'm still not sure where to put these commands now though.Last edited by the_enigma on Sun Apr 12, 2009 8:27 am; edited 1 time in total

----------

## chris...

```
Error org.freedesktop.DBus.Error.UnknownMethod: Method "ActivateService" with signature "s"on interface "org.bluez.Manager" doesn't exist
```

I get this error?

----------

## the_enigma

I just edited my post to make it clearer what commands I was typing, so that might help you.  If not, post the full command from your terminal, including what you typed and what it returned exactly.

----------

## chris...

The first command doesnt work, I entered:

```
dbus-send --system --type=method_call --print-reply --dest=org.bluez /org/bluez org.bluez.Manager.ActivateService string:input
```

result:

```
Error org.freedesktop.DBus.Error.UnknownMethod: Method "ActivateService" with signature "s"on interface "org.bluez.Manager" doesn't exist
```

I cant continue because I dont get a result from the first command

----------

## chris...

Deleting the files in /var/lib/bluetooth causes the application to work

This command line still doesn't work

----------

## the_enigma

What versions of bluez-libs and bluez-utils are you running?  I'm on 3.36 for both, and that method exists for me

----------

## chris...

i uninstalled bluez-libs and utils and use bluez4

----------

## the_enigma

Well, I have no idea how things work in bluez4, sorry.

----------

## jiri.tyr

If you have difficulties to get your mouse working with the net-wireless/bluez, have a look at this howto:

http://sidux.com/index.php?module=pnWikka&tag=hwBluetooth

You can find the script simple-agent and test-device in the package in distfiles (/usr/portage/distfiles/bluez-4.xx.tar.gz).

Once your mouse is working, it works even after the restart (it needs probably just the bluetooth init script started).

If you wanna use the latest version of bluez (4.41), you can download a patch for the ebuild here:

https://bugs.gentoo.org/attachment.cgi?id=192141

----------

