Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Oct 2005 14:53:23 -0700
From:      Maksim Yevmenkin <maksim.yevmenkin@savvis.net>
To:        Niki Denev <nike_d@cytexbg.com>
Cc:        freebsd-bluetooth@freebsd.org, freebsd-current@freebsd.org
Subject:   Re: rfcomm problems
Message-ID:  <43614C53.7020207@savvis.net>
In-Reply-To: <200510272032.26480.nike_d@cytexbg.com>
References:  <200510271844.52361.nike_d@cytexbg.com> <43610BBE.4070406@savvis.net> <200510272032.26480.nike_d@cytexbg.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------020104060604000501010300
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Niki,

>> have you tried to specify
>> 
>> set device "!/usr/bin/rfcomm_sppd -a gsm -c 1"
>> 
>> inside your /etc/ppp/ppp.conf file? this way ppp(8) will start 
>> rfcomm_sppd(1) automatically and will use its stdin/stdout.
> 
> No, but i've tried it now and it works! Thank you!

sure

>> i should probably fix it just to avoid confusion.

please find attached patch. the patch will put stdin/stdout into 'raw' 
mode when no tty was specified. it should fix the problem you were having.

keep in mind that there is no escape sequence, so you have to kill 
rfcomm_sppd(1) by hand to terminate the session.

could you please try to use rfcomm_sppd(1) in both stdin/stdout mode and 
  in 'set device ...' ppp(8) mode.

>>> When i start rfcomm_pppd the ppp daemon begins to write in the
>>> log that he is talking to himself (several "magic is same"
>>> errors, and disconnect)
>> 
>> hmmm... thats strange... rfcomm_pppd(8) should not have this
>> problem.
> 
> i can test patches, provide more info, etc.. if needed.

could you please post /etc/ppp/ppp.conf entry you where using with 
rfcomm_pppd?

thanks,
max

--------------020104060604000501010300
Content-Type: text/plain;
 name="rfcomm_sppd.patch.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="rfcomm_sppd.patch.txt"

Index: rfcomm_sppd.1
===================================================================
RCS file: /usr/local/cvs/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1,v
retrieving revision 1.6
diff -u -r1.6 rfcomm_sppd.1
--- rfcomm_sppd.1	3 Nov 2004 20:16:02 -0000	1.6
+++ rfcomm_sppd.1	27 Oct 2005 21:44:49 -0000
@@ -91,6 +91,10 @@
 .It Fl t Ar tty
 Slave pseudo tty name.
 If not set stdin/stdout will be used.
+All input and output processing on stdin/stdout will be disabled,
+giving a
+.Dq raw I/O
+path.
 This option is required if
 .Fl b
 option was specified.
Index: rfcomm_sppd.c
===================================================================
RCS file: /usr/local/cvs/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c,v
retrieving revision 1.8
diff -u -r1.8 rfcomm_sppd.c
--- rfcomm_sppd.c	3 Nov 2004 20:16:02 -0000	1.8
+++ rfcomm_sppd.c	27 Oct 2005 21:34:29 -0000
@@ -73,6 +73,7 @@
 	int			 n, background, channel, s, amaster, aslave, fd;
 	fd_set			 rfd;
 	char			*tty = NULL, buf[SPPD_BUFFER_SIZE];
+	struct termios		 defterm, term; 
 
 	memcpy(&addr, NG_HCI_BDADDR_ANY, sizeof(addr));
 	background = channel = 0;
@@ -118,6 +119,9 @@
 		usage();
 		/* NOT REACHED */
 
+	if (tty == NULL && background)
+		errx(1, "Must specify tty name to run in background mode");
+
 	/* Set signal handlers */
 	memset(&sa, 0, sizeof(sa));
 	sa.sa_handler = sppd_sighandler;
@@ -147,11 +151,13 @@
 
 	/* Open TTYs */
 	if (tty == NULL) {
-		if (background)
-			usage();
-
 		amaster = STDIN_FILENO;
 		fd = STDOUT_FILENO;
+
+		tcgetattr(amaster, &defterm);
+		term = defterm;
+		cfmakeraw(&term);
+		tcsetattr(amaster, TCSADRAIN, &term);
 	} else {
 		if (sppd_ttys_open(tty, &amaster, &aslave) < 0)
 			exit(1);
@@ -159,7 +165,6 @@
 		fd = amaster;
 	}		
 
-
 	/* Open RFCOMM connection */
 	memset(&ra, 0, sizeof(ra));
 	ra.rfcomm_len = sizeof(ra);
@@ -264,7 +269,8 @@
 	if (tty != NULL) {
 		close(aslave);
 		close(amaster);
-	}	
+	} else
+		tcsetattr(amaster, TCSADRAIN, &defterm);
 
 	return (0);
 }

--------------020104060604000501010300--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43614C53.7020207>