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: Tue, 03 Apr 2012 21:32:03 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.3) Gecko/20120324 Icedove/10.0.3

On 04/03/12 16:11, Bernd Paysan wrote:
Am Dienstag, 3. April 2012, 14:11:58 schrieb kibler:
I got the clear feeling no-one was interested enough to want to see
our code, especially since I had read so many previous emails covering
the same topic without any positive responses.
Where have you read that?  For me, this bug is new, you started the report.
here is one that starts in 2007, just before the official release of 7.0
http://osdir.com/ml/lang.forth.gforth/2007-04/msg00004.html
I saw several more just like this dated 2009 and 2010, but goggle seems
to only give me our current thread today and not any of the previous
threads I followed. I will try later to find more but basically they
all said the same things I said - my code worked in 6 and now doesn't
work in 7. I tried the web site for this thread, but they don't go back
far enough - I think there is an archive search - need to try that.
We set serial by doing a system call to stty.
Ok, I see.

We only use gforth system
calls to open/close/read/write/check file handles that happen to be serial
devices. gforth should do those fine without any knowledge of them
being tty, USB, or a socket driver.
Well, in theory, yes.  But in practice, the serial device requires
ioctl(FIONREAD) to check whether there is data available, files require
select, and the keyboard input can do both.

The current CVS of Gforth now contains an io.c, which should properly select
the two possible methods (FIONREAD on ttys, select on all others) and
therefore be more robust than the current approach. I still think the reaction
of select() is a bug in Linux.

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. The 6 code for key_avail had two routines,
one for regular files, and one for tty that called ioctl instead of select.
I can't put printf in 6, since I can't seem to get it to build from source
on debian testing. I need to dig back into the docs, but I seem to remember
that select should work just fine on tty devices under linux, as it
really doesn't know the difference from one file id to another. The man
pages for select and poll talk more about sockets than tty or file I/O,
and thus one would assume a file id is a file id to select - the file id is
either ready or not ready.





reply via email to

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