From: "Andreas Böhler" <andy.boehler@gmx.at>
To: bluez-devel@lists.sourceforge.net
Subject: Re: [Bluez-devel] emporia/mega-Headset and btsco problems
Date: Sun, 3 Jul 2005 18:02:26 +0200 [thread overview]
Message-ID: <20050703180226.458a1bd7.andy.boehler@gmx.at> (raw)
In-Reply-To: <42C7A344.4060700@xmission.com>
Thank you, Brad, thank you!
> maybe something like this... i wish the whole thing wasn't such a big=20
> ugly function...
...but it works exactly the way I wanted it to! Ugly or not, it does what i=
t should, my headset is now much more comfortable to use than before!
I slightly modified your patch and added it as a command-line option "-r" t=
o force the reconnection upon lost rfcomm-channel!=20
greetings,=20
andy
diff -puN btsco.c.old btsco.c
--- btsco.c.old 2005-06-17 17:57:42.000000000 +0200
+++ btsco.c 2005-07-03 17:57:45.000000000 +0200
@@ -80,8 +80,8 @@ struct action {
char *cmd;
};
=20
-static volatile int terminate =3D 0, ring =3D 0, hupped =3D 0, reconnect =
=3D 0;
-static int verbose =3D 0;
+static volatile int terminate =3D 0, ring =3D 0, hupped =3D 0, reconnect =
=3D 0, rfreconnect =3D 0;
+static int verbose =3D 0, auto_reconn =3D 0;
=20
static void sig_term(int sig)
{
@@ -279,6 +279,7 @@ static void usage(void)
printf("Usage:\n" "\tbtsco [options] <bdaddr> [channel]\n");
printf("Options:\n");
printf(" -v print verbose output\n");
+ printf(" -r automatically reconnect upon lost rfcomm channel\n");
printf(" -f fork and run as a daemon\n");
printf(" -c clear filehandle and exit\n");
printf(" -h print this usage and exit\n");
@@ -479,7 +480,7 @@ int main(int argc, char *argv[])
=20
fork =3D 0;
clear =3D 0;
- while((i =3D getopt(argc, argv, "fcvh")) >=3D 0) {
+ while((i =3D getopt(argc, argv, "fcvhr")) >=3D 0) {
switch(i) {
case 'v':
verbose++;
@@ -489,7 +490,10 @@ int main(int argc, char *argv[])
break;
case 'c':
clear =3D 1;
- break;
+ break;
+ case 'r':
+ auto_reconn =3D 1;
+ break;
case 'h':
case '?':
case ':':
@@ -588,7 +592,8 @@ int main(int argc, char *argv[])
sa.sa_handler =3D SIG_IGN;
sigaction(SIGCHLD, &sa, NULL);
sigaction(SIGPIPE, &sa, NULL);
-
+ do {
+ =20
/* connect rfcomm control channel */
if ((rd =3D rfcomm_connect(&local, &bdaddr, channel)) < 0) {
perror("Can't connect RFCOMM channel");
@@ -682,6 +687,9 @@ int main(int argc, char *argv[])
fflush(stdout);
}
terminate =3D 1;
+ if(auto_reconn) {
+ rfreconnect =3D 1;
+ }
}
=09
// control transmission events for volume and channel control
@@ -890,6 +898,11 @@ int main(int argc, char *argv[])
hupped =3D 0;
}
}
+ if(rfreconnect) {
+ rfreconnect =3D 0;
+ terminate =3D 0;
+ }
+ } while (!terminate);
=20
if (sco_mode =3D=3D CONNECTED) {
close(sd);
--=20
Andreas B=F6hler
andy (dot) boehler (at) gmx (dot) at
www.klasseonline.tk
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
next prev parent reply other threads:[~2005-07-03 16:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-02 15:26 [Bluez-devel] emporia/mega-Headset and btsco problems Andreas Böhler
2005-07-02 21:26 ` Brad Midgley
2005-07-02 22:47 ` Andreas Böhler
2005-07-03 8:35 ` Brad Midgley
2005-07-03 16:02 ` Andreas Böhler [this message]
2005-07-04 3:29 ` Brad Midgley
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=20050703180226.458a1bd7.andy.boehler@gmx.at \
--to=andy.boehler@gmx.at \
--cc=bluez-devel@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;
as well as URLs for NNTP newsgroup(s).