rfcomm problems

Maksim Yevmenkin maksim.yevmenkin at savvis.net
Thu Oct 27 14:53:28 PDT 2005


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
-------------- next part --------------
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);
 }


More information about the freebsd-current mailing list