linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Activating a serial connection with qdbus
@ 2010-10-20 14:21 Igor pesando
  2010-10-20 14:40 ` Johan Hedberg
  0 siblings, 1 reply; 4+ messages in thread
From: Igor pesando @ 2010-10-20 14:21 UTC (permalink / raw)
  To: linux-bluetooth

Hi *,

If I try to connect with the spp profile to a device using qdbus o dbus.send as

qdbus --system org.bluez /org/bluez/5989/hci1/dev_00_11_22_33_44
org.bluez.Serial.Connect spp

I get the proper reply /dev/rfcomm0 but the connection is dropped
immediately as rfcomm shows.
On the other side if I use rfcomm or the python script test-serial the
connection is established and kept alive.

So the questions is whether this is the expected behaviour.
Equivalently I ask whether one should interact with the dbus interface
only by programs
and use rfcomm otherwise. If so I do not understand why it is not
possible to set the Powered property
using hciconfig since if the device property Powered is false it is
not possible to initialize HCI device.

Thanks in advance for any answer.

Igor

--
-----------------------------------------------------------
fatti non foste a viver come bruti,
ma per seguire virtute e canoscenza.
Dante, Inf. XXVI 119-120

Ye were not made to live like unto brutes,
But for pursuit of virtue and of knowledge.
(Trans. H.W. Longfellow)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Activating a serial connection with qdbus
  2010-10-20 14:21 Activating a serial connection with qdbus Igor pesando
@ 2010-10-20 14:40 ` Johan Hedberg
  2010-10-20 15:17   ` Igor pesando
  0 siblings, 1 reply; 4+ messages in thread
From: Johan Hedberg @ 2010-10-20 14:40 UTC (permalink / raw)
  To: Igor pesando; +Cc: linux-bluetooth

Hi Igor,

On Wed, Oct 20, 2010, Igor pesando wrote:
> If I try to connect with the spp profile to a device using qdbus o dbus.send as
> 
> qdbus --system org.bluez /org/bluez/5989/hci1/dev_00_11_22_33_44
> org.bluez.Serial.Connect spp
> 
> I get the proper reply /dev/rfcomm0 but the connection is dropped
> immediately as rfcomm shows.
> On the other side if I use rfcomm or the python script test-serial the
> connection is established and kept alive.
> 
> So the questions is whether this is the expected behaviour.
> Equivalently I ask whether one should interact with the dbus interface
> only by programs and use rfcomm otherwise.

bluetoothd is "intelligent" and cleans up after the D-Bus client if the
client exists unexpectedly without calling Serial.Disconnect() first
(which is what qdbus does when it receives the reply). So the only way
to keep the connection alive is to also keep the process alive that
requested it. I.e. probably you can't use qdbus for this.

> If so I do not understand why it is not possible to set the Powered
> property using hciconfig since if the device property Powered is false
> it is not possible to initialize HCI device.

I'm not quite following your question. You can use "test-adapter powered
yes/no" and even "hciconfig hci0 up/down" should also work.

Johan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Activating a serial connection with qdbus
  2010-10-20 14:40 ` Johan Hedberg
@ 2010-10-20 15:17   ` Igor pesando
  2010-10-20 16:56     ` Anderson Lizardo
  0 siblings, 1 reply; 4+ messages in thread
From: Igor pesando @ 2010-10-20 15:17 UTC (permalink / raw)
  To: Igor pesando, linux-bluetooth

Hi Johan,
thank for the quick and precise answer for what qdbus concerns.

On Wed, Oct 20, 2010 at 4:40 PM, Johan Hedberg <johan.hedberg@gmail.com> wrote:

>
>> If so I do not understand why it is not possible to set the Powered
>> property using hciconfig since if the device property Powered is false
>> it is not possible to initialize HCI device.
>
> I'm not quite following your question. You can use "test-adapter powered
> yes/no" and even "hciconfig hci0 up/down" should also work.
>

You are right.
The issue I have is therefore associated with blueman:
when you switch off the adapter with blueman and then kill blueman-applet
hciconfig hci0 up does not work and returns an error (Can't init
device hci1: Unknown error 132 (132) )
and sometimes
dbus-send and test-adapter do the same (
dbus.exceptions.DBusException: org.bluez.Error.Failed: Unknown error
132)
while blueman-applet can solve the problem if restarted.

Igor


-- 
-----------------------------------------------------------
fatti non foste a viver come bruti,
ma per seguire virtute e canoscenza.
Dante, Inf. XXVI 119-120

Ye were not made to live like unto brutes,
But for pursuit of virtue and of knowledge.
(Trans. H.W. Longfellow)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Activating a serial connection with qdbus
  2010-10-20 15:17   ` Igor pesando
@ 2010-10-20 16:56     ` Anderson Lizardo
  0 siblings, 0 replies; 4+ messages in thread
From: Anderson Lizardo @ 2010-10-20 16:56 UTC (permalink / raw)
  To: Igor pesando; +Cc: linux-bluetooth

On Wed, Oct 20, 2010 at 11:17 AM, Igor pesando <ipesando@gmail.com> wrote:
> The issue I have is therefore associated with blueman:
> when you switch off the adapter with blueman and then kill blueman-applet
> hciconfig hci0 up does not work and returns an error (Can't init
> device hci1: Unknown error 132 (132) )
> and sometimes
> dbus-send and test-adapter do the same (
> dbus.exceptions.DBusException: org.bluez.Error.Failed: Unknown error
> 132)
> while blueman-applet can solve the problem if restarted.

Might not be related but... it  could be that RFKILL has disabled the
device. Run "rfkill list" and see if is either hard or soft blocked.
If it is, unblock it with "rfkill unblock <id>".

I've seen many times bluetoothd blocking devices on shutdown, maybe
because it thinks the device is blocked during start.

Regards,
-- 
Anderson Lizardo
OpenBossa Labs - INdT
Manaus - Brazil

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-10-20 16:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-20 14:21 Activating a serial connection with qdbus Igor pesando
2010-10-20 14:40 ` Johan Hedberg
2010-10-20 15:17   ` Igor pesando
2010-10-20 16:56     ` Anderson Lizardo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).