[PATCH 3/5] test-server: Add PPP server support

Zhang, Zhenhua zhenhua.zhang at intel.com
Mon Jul 5 23:23:36 PDT 2010


Hi Denis,

Denis Kenzior wrote:
> Hi Zhenhua,
> 
>>> static void server_destroy(gpointer user)
>>> @@ -706,15 +825,11 @@ static void server_destroy(gpointer user)
>>> 
>>> static void set_raw_mode(int fd)
>>> {
>>> -	struct termios options;
>>> -
>>> -	tcgetattr(fd,&options);
>>> -
>>> -	/* Set TTY as raw mode to disable echo back of input characters
>>> -	 * when they are received from Modem to avoid feedback loop */
>>> -	options.c_lflag&= ~(ICANON | ECHO | ECHOE | ISIG); +	struct
>>> termios ti; 
>>> 
>>> -	tcsetattr(fd, TCSANOW,&options);
>>> +	tcflush(fd, TCIOFLUSH);
>>> +	cfmakeraw(&ti);
>>> +	tcsetattr(fd, TCSANOW,&ti);
>>> }
>>> 
>>> static gboolean create_tty(const char *modem_path)
>> 
>> I found above changes does not contain latest git tree. The
> part of change is necessary when I tried to use bluetooth
> serial proxy between two machines. Without cfmakeraw, the
> server responses:
>> 	'\r\nOK\r\n'
>> would change to:
>> 	'\n\nOK\n\n'
>> 
>> And this issue doesn't exist if both server and client on the same
>> machine. 
> 
> The above code was causing valgrind to complain, so I left it out,
> apologies for not mentioning it, had a bit of a filesystem disaster
> happen after I pushed :) 
> 
> The present code seems to be completely in line with man cfmakeraw. 
> The cause is probably more subtle or has to do with the RFCOMM tty
> layer in the kernel.  Could you please investigate some more?

The problem lies in that we don't turn off ICRNL flags. If we turns off ICRNL, the problem is gone.

	ICRNL  Translate carriage return to newline on input (unless IGNCR is set).

I still recommend to replace current code with cfmakeraw(), so that we don't worry about lower level settings. We just want tty layer passing all characters to our peer correctly.

> Regards,
> -Denis



Regards,
Zhenhua



More information about the ofono mailing list