public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
* RE: Incomplete baud rate mapping in termiostty.c
@ 2008-01-30 21:17 Jay Foster
  2008-03-05 16:06 ` Jonathan Larmour
  0 siblings, 1 reply; 5+ messages in thread
From: Jay Foster @ 2008-01-30 21:17 UTC (permalink / raw)
  To: 'Andrew Lunn', Rainer Arndt; +Cc: ecos-patches

Should the setting of priv->init = true be dependent on the return value of
real_termios_init()?

	res = real_termios_init();
	if (ENOERR == res)
		priv->init = true;

Or maybe it doesn't matter.
Jay

-----Original Message-----
From: Andrew Lunn [mailto:andrew@lunn.ch]
Sent: Wednesday, January 30, 2008 10:41 AM
To: Rainer Arndt
Cc: ecos-patches@ecos.sourceware.org
Subject: Re: Incomplete baud rate mapping in termiostty.c


Hi Folks

Here is Rainers patch plus my patch for the init flag.

     Andrew

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Incomplete baud rate mapping in termiostty.c
@ 2008-01-30 16:59 Rainer Arndt
  2008-01-30 17:48 ` Andrew Lunn
  2008-01-30 18:41 ` Andrew Lunn
  0 siblings, 2 replies; 5+ messages in thread
From: Rainer Arndt @ 2008-01-30 16:59 UTC (permalink / raw)
  To: ecos-patches

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


The ecosbaud2posixbaud table in termiostty.c is incomplete. The baud
rate entry B1800 is missing.
I have attached a fix.

real_termios_init() is called from termios_lookup() only if the init
flag was not set before. 
I could't found where the flag is set. I think it is missing in
real_termios_init?

Because of the flag isn't set, real_termios_init() is called every time
the device is opened and requests the current device baudrate from the
ecos device.
But the value returned from map_ecosbaud_to_posixbaud() could be wrong
because of the missing B1800 entry.

One consequence is that setting a new baud rate could fail after reopen
a device (e.g. current 19200 -> new 38400), because in set_attr () the
new baud rate is only set if it is different from the current one.
nice bug ;-)

Rainer

[-- Attachment #2: termiostty.c.patch --]
[-- Type: text/plain, Size: 690 bytes --]

Index: termiostty.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/serial/current/src/common/termiostty.c,v
retrieving revision 1.9
diff -u -r1.9 termiostty.c
--- termiostty.c	3 Sep 2006 17:32:31 -0000	1.9
+++ termiostty.c	30 Jan 2008 15:25:15 -0000
@@ -190,7 +190,7 @@
 
 // map eCos bitrates to POSIX bitrates.
 static speed_t ecosbaud2posixbaud[] = {
-    0, B50, B75, B110, B134, B150, B200, B300, B600, B1200, B2400, B3600,
+    0, B50, B75, B110, B134, B150, B200, B300, B600, B1200, B1800, B2400, B3600,
     B4800, B7200, B9600, B14400, B19200, B38400, B57600, B115200, B230400 };
 
 // map POSIX bitrates to eCos bitrates.

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

end of thread, other threads:[~2008-03-05 16:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-30 21:17 Incomplete baud rate mapping in termiostty.c Jay Foster
2008-03-05 16:06 ` Jonathan Larmour
  -- strict thread matches above, loose matches on Subject: below --
2008-01-30 16:59 Rainer Arndt
2008-01-30 17:48 ` Andrew Lunn
2008-01-30 18:41 ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).