From: Steve Tuckner Date: 2002-09-12T04:01:37+09:00 Subject: RE: Terminal program help on cygwin This is a multi-part message in MIME format. ------=_NextPart_000_0020_01C2599B.B494F8A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit I hate to respond to my own post, but I think fcntl will do the trick for me. Now if I can only get it to work...... Steve Tuckner -----Original Message----- From: Steve Tuckner [mailto:STUCKNER@MULTITECH.COM] Sent: Wednesday, September 11, 2002 1:26 PM To: ruby-talk ML Subject: Terminal program help on cygwin 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_0020_01C2599B.B494F8A0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I hate=20 to respond to my own post, but I think fcntl will do the trick for me. = Now if I=20 can only get it to work......
 
Steve=20 Tuckner
-----Original Message-----
From: Steve Tuckner=20 [mailto:STUCKNER@MULTITECH.COM]
Sent: Wednesday, September = 11, 2002=20 1:26 PM
To: ruby-talk ML
Subject: Terminal = program help on=20 cygwin

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=20 setup the serial port. Below works but is too slow. I want to get = more than=20 one 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=20 two attributes?
 
Steve=20 Tuckner
------=_NextPart_000_0020_01C2599B.B494F8A0--