public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: BlueZ users <bluez-users@lists.sourceforge.net>
Subject: Re: [Bluez-users] Detecting disconnection when using RFCOMM tty API
Date: Fri, 28 Sep 2007 09:29:53 +0200	[thread overview]
Message-ID: <1190964593.6484.83.camel@aeonflux.holtmann.net> (raw)
In-Reply-To: <f8e53fb0709280019i51e9175bl5a3fa8fa8965c75d@mail.gmail.com>

Hi Andrea,

> I have a couple of question I was not able to give an answer to by
> digging into the archives or FAQs.
> 
> My application uses standard linux tty primitives on the RFCOMM
> devices to communicate with remote sensors. The application is
> iteratively quering the device by writing command and reading back
> answer. This is working fine.
> 
> I'm in the need of detecting when a link disconnection occur in order
> to handle the situation. How can I do that? Is RFCOMM tty sending a
> signal to my process that I can catch?
> It would be a good thing also being able to manage when the link comes
> back again. Shall I close and reopen the corresponding device or is
> there a way to reuse the same file descriptor I was using before the
> disconnection occurred?

if you poll the TTY you should get a HUP signal. Keeping the same file
descriptor is not possible since on disconnect the TTY will be close. It
won't re-connect automatically. So you have to open it again to trigger
the actual re-connection.

> One more bit...I see RFCOMM can be used also by a socket API. Is this
> more flexible/powerfull than the standard tty? At moment I have to
> stick to the legacy tty one, but for the future I should consider
> switching to it, if there is any potential improvement.

The socket API is much more flexible. Use that one.

Regards

Marcel



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

  reply	other threads:[~2007-09-28  7:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-28  7:19 [Bluez-users] Detecting disconnection when using RFCOMM tty API Andrea Galbusera
2007-09-28  7:29 ` Marcel Holtmann [this message]
2007-09-28  9:11   ` Andrea Galbusera
2007-09-28 21:50     ` Marcel Holtmann

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=1190964593.6484.83.camel@aeonflux.holtmann.net \
    --to=marcel@holtmann.org \
    --cc=bluez-users@lists.sourceforge.net \
    /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