www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/02/18/15:59:49

From: kdd21 AT hotmail DOT com (Keith Doyle)
Newsgroups: comp.os.msdos.djgpp
Subject: COM1: always non-blocking?
Date: 18 Feb 2003 12:00:55 -0800
Organization: http://groups.google.com/
Lines: 33
Message-ID: <3593a281.0302181200.290dc98f@posting.google.com>
NNTP-Posting-Host: 66.120.46.138
X-Trace: posting.google.com 1045598455 21214 127.0.0.1 (18 Feb 2003 20:00:55 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: 18 Feb 2003 20:00:55 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Well, spent quite some time digging through the Usenet archives
regarding djgpp and serial I/O.  Most of it completely frustrating,
finding librarys that required me to specify stuff that it should
already know (the IRQ and hardware port addresses for COM1 for
instance) and seemed to want to talk directly to the hardware, an
undesirable characteristic when you may be running under Windows
2000/XP.

So, I gave up on dzcomm, bcserio,pmcom, etc..  I then thought for a
moment, that under a DOS window you can do something as simple as
"echo 'hello' >COM1" so why not just trying to do an open on COM1:.

Well, it worked pretty good.  The only gotcha seems to be that read
appears to always be NONBLOCKING-- which if I had to choose is at
least the workable choice, as I can loop until I get non-zero back
from the read, but this seems less than optimal.  Better than messing
with the overlycomplex libraries that don't really seem to buy me
anything, but if I could get it to do a blocking read that would be a
worthwhile improvement.

I tried using fcntl, ioctl, and tcgetattr, but none of these seemed to
do anything useful (though for fcntl and tcgetattr, I just tried to
GET the current info, rather than set anything, but because it always
seemed to return 0 for everything, I figured this stuff isn't
connected...).

Anyone know how to make this last minor adjustment to real "basic"
COM1: port I/O?


--

Keith Doyle

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019