From: Steve Tuckner Date: 2002-09-12T03:26:03+09:00 Subject: Terminal program help on cygwin This is a multi-part message in MIME format. ------=_NextPart_000_0017_01C25996.BAD8EBE0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit I am having a problem with writing a terminal program that runs under cygwin ruby. The same code works on Linux. The problem is that I need a non-blocking read to read incoming data from the serial port. I am using the termios package to setup the serial port. Below works but is too slow. I want to get more than one character at a time, but not block on the read. while @flagRunning do if select( [@io], nil, nil, 0.2 ) then c = @io.getc if (c >= 32) && (c <= 126) then displayText( c.chr ) end end I have written a C program with the desired behavior, but to get it to work I have to do the open with O_RDWR | O_NONBLOCK | O_NOCTTY. How do I take an open port and add in the last two attributes? Steve Tuckner ------=_NextPart_000_0017_01C25996.BAD8EBE0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I am = having a=20 problem with writing a terminal program that runs under cygwin ruby. = The same=20 code works on Linux.  The problem is that I need a non-blocking = read to=20 read incoming data from the serial port. I am using the termios package = to setup=20 the serial port. Below works but is too slow. I want to get more than = one=20 character at a time, but not block on the read.
 
   =20 while @flagRunning do
        if = select(=20 [@io], nil, nil, 0.2 ) then
          &nb= sp; c =3D=20 @io.getc
          =  =20 if (c >=3D 32) && (c <=3D 126)=20 then 
         &nbs= p;     =20 displayText( c.chr=20 )
            = end
    end
I = have written a C=20 program with the desired behavior, but to get it to work I have to do = the=20 open
with = O_RDWR |=20 O_NONBLOCK | O_NOCTTY.  How do I take an open port and add in the = last two=20 attributes?
 
Steve = Tuckner
------=_NextPart_000_0017_01C25996.BAD8EBE0--