Subject: Re: Serial port access (was: Can outsiders get simple questions
From: [email-masked] (Dan Hensley)

29 Dec 1998 19:45:32 -0800
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: "Christopher G. Faylor" <[email-masked]>
Cc: [email-masked]

Chris,

"Christopher G. Faylor" wrote:

> >    I did as you suggested (replacing COM2 with COM1, since that's the port I'm
> >trying to use).  This worked no problem, and entering a "mount" in cygwin showed
> >that indeed this mount point was set.  However, when I try to open the COM port
> >using open(), my session hangs, and the only way out of it is to kill the bash
> >window.  Any idea what's happening here?  Incidentally, I tried the sample program
> >you sent me with the same results...
> >    I'm running b20.1 on NT4sp4.
>
> By setting things up this way, you're working around Cygwin's own understanding
> of com ports so the com port is treated as a regular file.
>
> If you want to open a com port just use /dev/com1 or /dev/com2 .

I've tried that, and it appears that I cannot set most of the port attributes that I
need for successful operation.  As a result, nothing comes through my com port.  Here's
some sample output from my program.  It looks like it's opening some sort of device (I
tried getting attributes for an existing text file, and like it should, port attributes
were not available).

Trying to open barcode device /dev/com1
Opened barcode device /dev/com1
Got serial port attributes
===== Here's the original setup =====
  termios_iflag=4
  termios_oflag=0
  termios_cflag=4075
  termios_lflag=0
=====================================
===== Here's what I want to set =====
  termios_iflag=401
  termios_oflag=0
  termios_cflag=655
  termios_lflag=2
=====================================
Set serial port attributes
Got serial port attributes
==== Here's what actually got set ===
  termios_iflag=4
  termios_oflag=0
  termios_cflag=455
  termios_lflag=0
=====================================
Enter something:    abcd
Select finished, iRet=1
Data is available now from the keyboard

Getting the data from the buffer
iStat=5
Read: 'abcd
'
bash-2.02$

    Is there anything else I can try, or is the cygwin code to date not quite there for
serial port access?  (It seems from other posts that there are some known issues with
serial ports--I just want to confirm that that's what I'm running into.)
    Incidentally, I finally was able to download the source code.  I've started poking
around in it, but I don't know C++, so it's a little slow for me.  I've also started to
try (unsuccessfully) to recompile the code, but that's a different subject.

Thanks,
Dan

--
Dan Hensley
Engineer - SDRC Operations (ATA)
Denver, CO        W:303/464-7049
http://www.sdrc.com/

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".