public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Henry Gomersall <whg21@cam.ac.uk>
To: linux-bluetooth@vger.kernel.org
Subject: Re: bluetooth SPP link to Nokia phone
Date: Tue, 21 Jul 2009 12:51:40 +0100	[thread overview]
Message-ID: <1248177100.5156.14.camel@whg21-laptop> (raw)
In-Reply-To: <20090721100239.GA19048@jh-x301>

On Tue, 2009-07-21 at 13:02 +0300, Johan Hedberg wrote:
> > phone = dbus.Interface(bus.get_object('org.bluez',
> > adapter.ListDevices()[0]), 'org.bluez.Device')
> > 
> > phone_serial = dbus.Interface(phone, 'org.bluez.Serial')
> > phone_serial.Connect('spp')
> 
> That looks fine to me, though you might want to use FindDevice with
> the
> address of your phone in case you at some point configure more than
> one
> device.
> 
yeah, it was a quick and dirty method to get it connected - I couldn't
work out the string format for the bluetooth address (its obvious
now!) ;)

> > At this stage, I have the device /dev/rfcomm0, but I cannot write
> data
> > to it without breaking the link.
> 
> Do you open the device node and try to write to it from the same
> python
> script that you created the connection with? At the very least the
> process
> that calls Serial.Connect() needs to stay alive for the duration of
> the
> connection.

Well, this is all being handled inside an ipython session (which I do
not exit)
> 
> Another potential issue that comes to mind is that the protocol you're
> supposed to speak to the phone could be binary in which case you'll
> need
> to set the tty into raw mode before doing anything with it (in C you'd
> use
> cfmakeraw and tcsetattr for that and python probably provides
> something
> similar).

I've tried doing the same thing using the rfcomm program. This allows me
to set up a stable connection using:
rfcomm connect /dev/rfcomm0 'XX:XX:XX:XX:XX:XX'

I can then write AT commands to it as expected.

I'll take a look at the rfcomm source and see what its doing differently
from me (unless someone knows the answer ;)

Thanks,

Henry


  reply	other threads:[~2009-07-21 11:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-21  9:45 bluetooth SPP link to Nokia phone Henry Gomersall
2009-07-21 10:02 ` Johan Hedberg
2009-07-21 11:51   ` Henry Gomersall [this message]
2009-07-22 11:14     ` Henry Gomersall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1248177100.5156.14.camel@whg21-laptop \
    --to=whg21@cam.ac.uk \
    --cc=heng@cantab.net \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox