Linux bluetooth development
 help / color / mirror / Atom feed
From: Florian Echtler <echtler@fs.tum.de>
To: bmidgley@xmission.com, bluez-devel@lists.sourceforge.net
Subject: Re: [Bluez-devel] Re: some btsco hacks
Date: Fri, 6 May 2005 22:52:53 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.62.0505062220440.10201@block> (raw)
In-Reply-To: <427A8B7F.1010105@xmission.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 770 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello Brad,

I noticed that there was a small bug left in my patch (the value of
force_sco was overwritten when a reconnect was requested). This small
additional patch should fix that.

> could you give me some examples from your .btscorc?

Well, my .btscorc currently looks like this:

AT\+CKPD=200
sco-toggle on off
AT\+CKPD=200
system /home/echtler/bin/headset %d &

> do you know what the syntax of 'back references' is in .btscorc?
Back references to what/where?

Yours, Florian
- -- 
Preserve wildlife - pickle a squirrel today!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCe9ks7CzyshGvatgRAkoxAKDxCwtRZKTHSujGXyrqRdaNEL43/wCfbPjd
D0q3ebE9/sMYojjLzaZFMug=
=4Wfl
-----END PGP SIGNATURE-----

[-- Attachment #2: Type: TEXT/PLAIN, Size: 1535 bytes --]

diff -u -r1.24 btsco.c
--- btsco.c	5 May 2005 21:15:30 -0000	1.24
+++ btsco.c	6 May 2005 20:50:20 -0000
@@ -460,7 +460,7 @@
 	uint16_t sco_handle, sco_mtu, vs;
 	char line[100];
 	int last_volumes[2];
-	int dr_usage, force_sco;
+	int dr_usage, force_sco, force_old;
 
 	// sco_mode is our running mode. 0 => not connect, 1 => connected
 	// see NOT_CONNECTED,CONNECTED :)
@@ -624,6 +624,7 @@
 	}
 	dr_usage = infobuf.playback_count || infobuf.capture_count;
 	force_sco = -1;
+	force_old = -1;
 	
 	if (fork)
 		daemon(0, 0);
@@ -818,12 +819,10 @@
 
 		// mean little hack to allow for a signal-triggered reconnect
 		// force disconnection of the channel (if connected)
-		if (reconnect == 1) {
-			if (sco_mode == CONNECTED) {
-				force_sco =  0;
-				reconnect = -1;
-			} else reconnect = 0;
-		} 
+		if (reconnect && (sco_mode == CONNECTED)) {
+			force_old = force_sco;
+			force_sco = 0;
+		} else reconnect = 0;
 		
 		if(((!dr_usage && (force_sco != 1)) || (force_sco == 0)) && (sco_mode == CONNECTED)) {
 			if(verbose) {
@@ -844,9 +843,8 @@
 
 		// if a reconnect has been requested, force 
 		// the sco channel to be acquired again
-		if (reconnect == -1) {
+		if (reconnect) {
 			force_sco = 1;
-			reconnect = 0;
 			sleep(3);
 		}
 
@@ -872,6 +870,12 @@
 				sco_mode = CONNECTED;
 			}
 		}
+
+		// restore original program status
+		if (reconnect) {
+			force_sco = force_old;
+			reconnect = 0;
+		}
 		
 		if (ring) {
 			write(rd, "\r\nRING\r\n", 8);

  reply	other threads:[~2005-05-06 20:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-05 18:58 [Bluez-devel] some btsco hacks Florian Echtler
2005-05-05 21:09 ` [Bluez-devel] " Brad Midgley
2005-05-06 20:52   ` Florian Echtler [this message]
2005-05-09  5:16     ` Brad Midgley
2005-05-09 22:14       ` Florian Echtler
2005-05-09 23:11         ` 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=Pine.LNX.4.62.0505062220440.10201@block \
    --to=echtler@fs.tum.de \
    --cc=bluez-devel@lists.sourceforge.net \
    --cc=bmidgley@xmission.com \
    /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