2011-08-18 17:53:52

by Ram Bhamidipaty

[permalink] [raw]
Subject: need help with bluez pairing/connecting device

I am writing some new software that talks to bluez-4.96.

I have some how gotten a device into a weird state. When I make
a dbus call to org.bluez.Adapter.GetProperties
I see my target device in the list:

dict entry(
string "Devices"
variant array [
object path "/org/bluez/8090/hci0/dev_00_22_48_85_50_1D"
]
)


When a device is listed here - what does it mean? I am guessing that
at this point the pairing process is over. Or does it mean something else?

However the device is not yet connected. So I next try to connect:

dbus-send --system --type=method_call --print-reply --dest=org.bluez
/org/bluez/8090/hci0/dev_00_22_48_85_50_1D org.bluez.Input.Connect

This fails with a cryptic:

Error org.bluez.Error.Failed: Host is down (112)

Any help is appreciated.
-Ram


2011-08-18 20:45:44

by Ram Bhamidipaty

[permalink] [raw]
Subject: Re: need help with bluez pairing/connecting device

On Thu, Aug 18, 2011 at 1:12 PM, Lucas De Marchi
<[email protected]> wrote:
> On Thu, Aug 18, 2011 at 2:53 PM, Ram Bhamidipaty <[email protected]> wrote:
>> I am writing some new software that talks to bluez-4.96.
>>
>> I have some how gotten a device into a weird state. When I make
>> a dbus call to org.bluez.Adapter.GetProperties
>> I see my target device in the list:
>>
>> ? ? ? dict entry(
>> ? ? ? ? string "Devices"
>> ? ? ? ? variant ? ? ? ? ? ? array [
>> ? ? ? ? ? ? ? object path "/org/bluez/8090/hci0/dev_00_22_48_85_50_1D"
>> ? ? ? ? ? ?]
>> ? ? ?)
>>
>>
>> When a device is listed here - what does it mean? I am guessing that
>> at this point the pairing process is over. Or does it mean something else?
>
> It's the list of devices already paired. So, if you paired anytime
> before, the device will appear in this list.


Thank you. This helps me understand this.




>
>
>>
>> However the device is not yet connected. So I next try to connect:
>>
>> dbus-send --system --type=method_call --print-reply --dest=org.bluez
>> /org/bluez/8090/hci0/dev_00_22_48_85_50_1D org.bluez.Input.Connect
>>
>> This fails with a cryptic:
>>
>> Error org.bluez.Error.Failed: Host is down (112)
>
> It's because the other host is down (sic.). The fact that this path
> exists doesn't means the device is around, it just means that some
> time ago you paired it with this adapter. Turn the devices on and try
> again.
>

Thanks! In this case the device was in fact on. But it might be that the
pairing information was somehow stale. Removing the device and
re-pairing seemed to help.

-Ram

2011-08-18 20:12:31

by Lucas De Marchi

[permalink] [raw]
Subject: Re: need help with bluez pairing/connecting device

On Thu, Aug 18, 2011 at 2:53 PM, Ram Bhamidipaty <[email protected]> wrote:
> I am writing some new software that talks to bluez-4.96.
>
> I have some how gotten a device into a weird state. When I make
> a dbus call to org.bluez.Adapter.GetProperties
> I see my target device in the list:
>
> ? ? ? dict entry(
> ? ? ? ? string "Devices"
> ? ? ? ? variant ? ? ? ? ? ? array [
> ? ? ? ? ? ? ? object path "/org/bluez/8090/hci0/dev_00_22_48_85_50_1D"
> ? ? ? ? ? ?]
> ? ? ?)
>
>
> When a device is listed here - what does it mean? I am guessing that
> at this point the pairing process is over. Or does it mean something else?

It's the list of devices already paired. So, if you paired anytime
before, the device will appear in this list.


>
> However the device is not yet connected. So I next try to connect:
>
> dbus-send --system --type=method_call --print-reply --dest=org.bluez
> /org/bluez/8090/hci0/dev_00_22_48_85_50_1D org.bluez.Input.Connect
>
> This fails with a cryptic:
>
> Error org.bluez.Error.Failed: Host is down (112)

It's because the other host is down (sic.). The fact that this path
exists doesn't means the device is around, it just means that some
time ago you paired it with this adapter. Turn the devices on and try
again.


Lucas De Marchi

2011-08-18 18:28:27

by Bartosz Szatkowski

[permalink] [raw]
Subject: Re: need help with bluez pairing/connecting device

On Thu, Aug 18, 2011 at 7:53 PM, Ram Bhamidipaty <[email protected]> wrote:
> I am writing some new software that talks to bluez-4.96.
>
> I have some how gotten a device into a weird state. When I make
> a dbus call to org.bluez.Adapter.GetProperties
> I see my target device in the list:
>
>       dict entry(
>         string "Devices"
>         variant             array [
>               object path "/org/bluez/8090/hci0/dev_00_22_48_85_50_1D"
>            ]
>      )
>
>
> When a device is listed here - what does it mean? I am guessing that
> at this point the pairing process is over. Or does it mean something else?
>
> However the device is not yet connected. So I next try to connect:
>
> dbus-send --system --type=method_call --print-reply --dest=org.bluez
> /org/bluez/8090/hci0/dev_00_22_48_85_50_1D org.bluez.Input.Connect
>
> This fails with a cryptic:
>
> Error org.bluez.Error.Failed: Host is down (112)
>
> Any help is appreciated.
> -Ram
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

You may find usesful looking at bluez/test/*
(http://git.kernel.org/?p=bluetooth/bluez.git;a=tree;f=test;h=071a5b5ef0ccb29aa607d5d60089b7aa6c349e98;hb=HEAD),
there is lots of examples how to use dbus api.

--
Pozdrowienia,
Bartosz Szatkowski