Serial Port

I’m trying to read in from the Serial Port using dev_read () function, i
sent some string to the Serial Port through
HyperTerminal in my window NT machine. From the help, it says that three
argument min, time, timeout when they are
all 0s, this function returns immidiately… but i find it blocking unless i
make the proxy argument 1, what’s wrong??

Also, dev_read() only can get soemthing when I press ‘enter’ key on the
HyperTerminal, how can i
get the string without the carriage return?

ran zhang wrote:

I’m trying to read in from the Serial Port using dev_read () function, i
sent some string to the Serial Port through
HyperTerminal in my window NT machine. From the help, it says that three
argument min, time, timeout when they are
all 0s, this function returns immidiately… but i find it blocking unless i
make the proxy argument 1, what’s wrong??

Also, dev_read() only can get soemthing when I press ‘enter’ key on the
HyperTerminal, how can i
get the string without the carriage return?

The port is set in “canonical” mode, also known as “cooked” or “edit”.
In this state, nothing is returned to your program until a newline is
entered (so that line editing will work).
To disable this, you can do:
stty raw < /dev/ser1
which will also turn off some other flags, or look at the docs for
tcgetattr() and tcsetattr() if you want to control this in your program.

Richard