All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] test-server: Use cfmakeraw to set TTY raw mode
@ 2010-07-06  6:23 Zhenhua Zhang
  2010-07-06 12:51 ` Marcel Holtmann
  0 siblings, 1 reply; 3+ messages in thread
From: Zhenhua Zhang @ 2010-07-06  6:23 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 851 bytes --]

Use cfmakeraw to disable echoing and special characters processing. If
we don't turn off ICRNL, TTY layer translates \r\n to \n\n.
---
 gatchat/test-server.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/gatchat/test-server.c b/gatchat/test-server.c
index 25a1192..2911978 100644
--- a/gatchat/test-server.c
+++ b/gatchat/test-server.c
@@ -848,12 +848,10 @@ static void set_raw_mode(int fd)
 {
 	struct termios options;
 
+	memset(&options, 0, sizeof(struct termios));
 	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);
-
+	tcflush(fd, TCIOFLUSH);
+	cfmakeraw(&options);
 	tcsetattr(fd, TCSANOW, &options);
 }
 
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] test-server: Use cfmakeraw to set TTY raw mode
  2010-07-06  6:23 [PATCH] test-server: Use cfmakeraw to set TTY raw mode Zhenhua Zhang
@ 2010-07-06 12:51 ` Marcel Holtmann
  2010-07-07  1:28   ` Zhang, Zhenhua
  0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2010-07-06 12:51 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1249 bytes --]

Hi Zhenhua,

> Use cfmakeraw to disable echoing and special characters processing. If
> we don't turn off ICRNL, TTY layer translates \r\n to \n\n.
> ---
>  gatchat/test-server.c |    8 +++-----
>  1 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/gatchat/test-server.c b/gatchat/test-server.c
> index 25a1192..2911978 100644
> --- a/gatchat/test-server.c
> +++ b/gatchat/test-server.c
> @@ -848,12 +848,10 @@ static void set_raw_mode(int fd)
>  {
>  	struct termios options;
>  
> +	memset(&options, 0, sizeof(struct termios));
>  	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);
> -
> +	tcflush(fd, TCIOFLUSH);
> +	cfmakeraw(&options);
>  	tcsetattr(fd, TCSANOW, &options);
>  }

I am fine with using cfmakeraw. So patch has been applied.

Minor comment here that sizeof(options) would be better then referencing
the struct itself. And in general we have used ti as variable name for
termios options. Don't ask me really why. Just have done that in the
patch. So feel free to send an cleanup patch.

Regards

Marcel



^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] test-server: Use cfmakeraw to set TTY raw mode
  2010-07-06 12:51 ` Marcel Holtmann
@ 2010-07-07  1:28   ` Zhang, Zhenhua
  0 siblings, 0 replies; 3+ messages in thread
From: Zhang, Zhenhua @ 2010-07-07  1:28 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1540 bytes --]

Hi Marcel,

Marcel Holtmann wrote:
> Hi Zhenhua,
> 
>> Use cfmakeraw to disable echoing and special characters processing.
>> If we don't turn off ICRNL, TTY layer translates \r\n to \n\n. ---
>>  gatchat/test-server.c |    8 +++-----
>>  1 files changed, 3 insertions(+), 5 deletions(-)
>> 
>> diff --git a/gatchat/test-server.c b/gatchat/test-server.c
>> index 25a1192..2911978 100644
>> --- a/gatchat/test-server.c
>> +++ b/gatchat/test-server.c
>> @@ -848,12 +848,10 @@ static void set_raw_mode(int fd)  {
>>  	struct termios options;
>> 
>> +	memset(&options, 0, sizeof(struct termios));
>>  	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); -
>> +	tcflush(fd, TCIOFLUSH);
>> +	cfmakeraw(&options);
>>  	tcsetattr(fd, TCSANOW, &options);
>>  }
> 
> I am fine with using cfmakeraw. So patch has been applied.
> 
> Minor comment here that sizeof(options) would be better then
> referencing the struct itself. And in general we have used ti as
> variable name for termios options. Don't ask me really why. Just have
> done that in the patch. So feel free to send an cleanup patch.

The cleanup patch has been sent. Please review it.
 
> Regards
> 
> Marcel
> 
> 
> _______________________________________________
> ofono mailing list
> ofono(a)ofono.org
> http://lists.ofono.org/listinfo/ofono

Regards,
Zhenhua


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-07  1:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-06  6:23 [PATCH] test-server: Use cfmakeraw to set TTY raw mode Zhenhua Zhang
2010-07-06 12:51 ` Marcel Holtmann
2010-07-07  1:28   ` Zhang, Zhenhua

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.