Re: rfcomm problems

From: Maksim Yevmenkin <maksim.yevmenkin_at_savvis.net>
Date: Thu, 27 Oct 2005 14:53:23 -0700
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

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
_at__at_ -91,6 +91,10 _at__at_
 .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
_at__at_ -73,6 +73,7 _at__at_
 	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;
_at__at_ -118,6 +119,9 _at__at_
 		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;
_at__at_ -147,11 +151,13 _at__at_
 
 	/* 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);
_at__at_ -159,7 +165,6 _at__at_
 		fd = amaster;
 	}		
 
-
 	/* Open RFCOMM connection */
 	memset(&ra, 0, sizeof(ra));
 	ra.rfcomm_len = sizeof(ra);
_at__at_ -264,7 +269,8 _at__at_
 	if (tty != NULL) {
 		close(aslave);
 		close(amaster);
-	}	
+	} else
+		tcsetattr(amaster, TCSADRAIN, &defterm);
 
 	return (0);
 }
Received on Thu Oct 27 2005 - 19:53:28 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:46 UTC