gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gforth] problem with gforth7 and serial access


From: kibler
Subject: Re: [gforth] problem with gforth7 and serial access
Date: Thu, 05 Apr 2012 21:01:13 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.3) Gecko/20120324 Icedove/10.0.3

I just finished testing the latest, and I do mean latest version of gforth
using the git gforth-mirror, and the changes seem to work. It took a
few attempts to get it working, possibly the stty settings were still not
right for some reason, but once running, several more start stops
worked fine. So adding back the ioctl serial test for tty seemed to fix
the "serial worked on 6 but not 7" problem.

> git log -1  io.c
commit e031368987849ff39889d2142b47aec1031e9075
Author: pazsan <pazsan>
Date:   Tue Apr 3 22:57:00 2012 +0000

    Check key_avail again with FIONREAD when isatty is true - but properly fall

Here is the git diff of what was changed:

~/gforth/gforth-mirror/engine
> git diff e03136..6f639a io.c
diff --git a/engine/io.c b/engine/io.c
index a79430c..4539735 100644
--- a/engine/io.c
+++ b/engine/io.c
@@ -673,16 +673,9 @@ long key_avail (FILE *stream)
   if(!terminal_prepped && stream == stdin)
     prep_terminal();

-#if defined(FIONREAD) && !defined(_WIN32)
-  if(isatty (tty)) {
-    int result = ioctl (tty, FIONREAD, &chars_avail);
-  } else
-#endif
-  {
-    FD_ZERO(&selin);
-    FD_SET(tty, &selin);
-    chars_avail = select(1, &selin, NULL, NULL, &now);
-  }
+  FD_ZERO(&selin);
+  FD_SET(tty, &selin);
+  chars_avail = select(1, &selin, NULL, NULL, &now);
   if (chars_avail > 0) {
     /* getc won't block */
     int c = getc(stream);

Our group will do more testing but as of now I can use it again.
I might add that I was trying to use "pipe" functions and it would
read as well, but would not give me a valid key?-file indication.
I suspect it is the select is failing, as it was for tty, but at this
point I can not be truly sure of that. When looking at the engine
code I get very concerned about the "select.c" module, and think
it might be what is called by io.c and not the actual system "select".
If that is true, it would account for the failure, since select.c only
adjusts the timeout values and nothing more.

Thanks for your help.
Bill.

On 04/03/12 21:32, kibler wrote:

I will go do an update of gforth-mirror and look at the git log to see
what is different, but I was using 7.9 for most of my testing, thinking
it might fix the problem.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]