From: "Andrea Galbusera" <gizero@gmail.com>
To: "BlueZ users" <bluez-users@lists.sourceforge.net>
Subject: Re: [Bluez-users] Detecting disconnection when using RFCOMM tty API
Date: Fri, 28 Sep 2007 11:11:53 +0200 [thread overview]
Message-ID: <f8e53fb0709280211o1e447c88mfcad13e26f1c8343@mail.gmail.com> (raw)
In-Reply-To: <1190964593.6484.83.camel@aeonflux.holtmann.net>
Hi Marcel, thanks for your answers.
> 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.
I'm trying to catch the HUP but with no luck. I'm probably doing
something wrong. Basically I do the following:
void hangup_handler (int signal_number) {
/* terminate the process on link lost */
printf("Hello from my SIGHUP handler\n");
exit(2);
}
int main(void) {
struct sigaction sa;
/* Install the signal handler for disconnections */
memset(&sa, 0, sizeof(sa));
sa.sa_handler = &hangup_handler;
sigaction(SIGHUP, &sa, NULL);
poll_device();
}
The apllication process correctly catches and handle the signal if I
issue it by "kill -SIGHUP <pid>", but nothing happens if I switch off
my remote device causing the link loss.
> The socket API is much more flexible. Use that one.
I'm unexperienced in sockets programming. Can you suggest me a good
documentation on using sockets with bluez rfcomm?
Regards,
Andrea
-------------------------------------------------------------------------
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
next prev parent reply other threads:[~2007-09-28 9:11 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
2007-09-28 9:11 ` Andrea Galbusera [this message]
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=f8e53fb0709280211o1e447c88mfcad13e26f1c8343@mail.gmail.com \
--to=gizero@gmail.com \
--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