From: Andrew Cottrell Newsgroups: comp.os.msdos.djgpp Subject: Re: COM1: always non-blocking? Date: Wed, 19 Feb 2003 17:53:20 +1100 Organization: ECLiPSE Lines: 54 Message-ID: <5u965v4spp8r5k2ltng6pgscgv1cc9l9hm@4ax.com> References: <3593a281 DOT 0302181200 DOT 290dc98f AT posting DOT google DOT com> NNTP-Posting-Host: p416-tnt1.syd.ihug.com.au Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: lust.ihug.co.nz 1045637606 2984 203.173.129.162 (19 Feb 2003 06:53:26 GMT) X-Complaints-To: abuse AT ihug DOT co DOT nz NNTP-Posting-Date: Wed, 19 Feb 2003 06:53:26 +0000 (UTC) X-Newsreader: Forte Agent 1.92/32.572 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.. These work fine on MS-DOS, FREEDOS, IBM-DOS, Win 95, Win 98, ME, NT 4 SP 3-6 (havn't tries 1 or 2), W2K SP1-3, XP & XP SP1. The only problem is with Win 3.x otherwise accessing the hardware is fine on NT,2K & XP. >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:. If you do get this working then please rememeber that the BIOS only supports 9600 baud rate reliably and is from what I can remember uses a polled reads so you may miss RX chars if you don't have a very tight main loop in order to get the chars before the next one is received. Runing a dos app under windows like this will cause chars to be missed as Windows will timeslice out the dos app if you are not running in full screen and this is when you will miss RX chars. >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. Have a look at the BIOS com port support and see what ther is to say about this issue. >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...). I would advise using one of the standard com librairies and add in youself the com port detectino routines. I have advised in the l;ast month on this newsgroup what the relevant search on google was. The code is in the file and should work find with DJGPP from waht I could see. >Anyone know how to make this last minor adjustment to real "basic" >COM1: port I/O? I do not. See my suggestions above. Good luck. Andrew