the way the baud rate table was used, the first entry
(300 baud) would never be matched.  This is why 300 baud
did not work.
---
I also found the bug that prevented 300 baud from working.  This fixes
it.

 src/hal/classicladder/serial_linux.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/hal/classicladder/serial_linux.c 
b/src/hal/classicladder/serial_linux.c
index 86f4435..92d79b9 100755
--- a/src/hal/classicladder/serial_linux.c
+++ b/src/hal/classicladder/serial_linux.c
@@ -64,14 +64,15 @@ char SerialOpen( char * SerialPortName, int Speed )
                int BaudRate = -1;
                int ScanBaudRate = 0;
                fcntl(fd, F_SETFL, O_RDWR | O_NOCTTY ); /* perform blocking 
reads */
-               while( SerialSpeed[ ScanBaudRate ]!=Speed && SerialSpeed[ 
ScanBaudRate ]>=0 )
+               do
                {
-                       ScanBaudRate++;
                        if ( SerialSpeed[ ScanBaudRate ]==Speed )
                        {
                                BaudRate = SerialCorres[ ScanBaudRate ];
+                               break;
                        }
-               }
+                       ScanBaudRate++;
+               } while ( SerialSpeed[ ScanBaudRate ]!=Speed && SerialSpeed[ 
ScanBaudRate ]>=0 );
 switch (ModbusSerialDataBits)
       {
          case 8:
-- 
1.7.0.4


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to