Read failing with minicom

nidhi.puri@wipro.com nidhi.puri@wipro.com
Thu, 28 Apr 2005 14:28:17 +0530


Hi

No..i am not starting minicom with -o option. I am starting it with
minicom -s.
So that I can configure the port and the settings.
Then I write from ttyS0 , but it is not echoed on minicom (ttyUSB0).

I noticed something yesterday .....that if I open hyperterminal at the
other end (ttyS0) and minicom on ttyUSB0 . then when I press enter after
I have typed in some chars from hyperterminal....the data gets echoed on
to minicom. But it is not the same if I start minicom at ttyS0 also. I
read somewhere that:

You normally can't read input a character at a time from the terminal
because
that the terminal is configured to be in line-by-line mode by default,
so that
the editing characters (like the backspace key) can be used by the user
when
entering a line.

And :
Normally the terminal driver in linux operates in 2 modes. Canonical
Mode and Non-Canonical Mode.=0D

In canonical input processing mode, terminal input is processed in lines
terminated by newline ('\n'), EOF, or EOL characters
No input can be read until an entire line has been typed by the user,
and the read function returns at most a single line of input, no matter
how many bytes are requested. In canonical input mode, the operating
system provides input editing facilities: some characters are
interpreted specially to perform editing operations within the current
line of text, such as ERASE and ECHO.=0D
In non canonical input processing mode, characters are not grouped into
lines.

I tried out one thing more. I explicitly set the non-canonical mode by
passing the argument -icanon using stty....
	i.e stty -F /dev/ttyUSB0 -icanon
Then also the chars I typed till that time (which were not being echoed)
get echoed on to minicom.

But I also found out that the stty reports the same flag settings before
and after I give that stty command or when read starts working after I
send file. I mean that the -icanon is also there at the time read is not
working.

AT STARTUP : DEFAULT
ot@oxsemi1 ~]# stty -F /dev/ttyUSB0
speed 9600 baud; line =3D 0;
-brkint -imaxbel

WHEN MINICOM STARTED
[root@oxsemi1 ~]# stty -F /dev/ttyUSB0
speed 9600 baud; line =3D 0;
min =3D 1; time =3D 5;
ignbrk -brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke

WHEN READ WORKING(AFTER SEND FILE)
[root@oxsemi1 ~]# stty -F /dev/ttyUSB0
speed 9600 baud; line =3D 0;
intr =3D M-^?; quit =3D <undef>; min =3D 1; time =3D 5;
ignbrk -brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke

I am very much confused regarding what may be the problem. I am trying
to debug the tty layer to see if there is any problem there.....amy be
it is just buffering the data.=0D
Please let me know if u have any idea where the problem may be.

Thanks

Nidhi Puri=0D
A WINNER is not the one who never fails,
                he is the one who never gives up..................

-----Original Message-----
From: minicom-devel-admin@lists.alioth.debian.org
[mailto:minicom-devel-admin@lists.alioth.debian.org] On Behalf Of Oisin
Curtin
Sent: Thursday, April 28, 2005 12:22 AM
To: minicom-devel@lists.alioth.debian.org
Subject: Re: Read failing with minicom

nidhi.puri@wipro.com wrote:
> Hi
>=0D
> I am working on USB Serial converter driver.
> The minimal read/write tests are working fine. I am able to read/write
> using Kermit.
> But the read for Minicom fails the first time after reboot.

I'm guessing you are starting minicom with -o, "Do not initialize."
In that case, minicom assumes the port is already open.  That's not the
case after a reboot.


--=0D
Oisin  "Open mind after reboot"  Curtin






Confidentiality Notice=0D

The information contained in this electronic message and any attachments to=
 this message are intended
for the exclusive use of the addressee(s) and may contain confidential or=
 privileged information. If
you are not the intended recipient, please notify the sender at Wipro or=
 Mailadmin@wipro.com immediately
and destroy all copies of this message and any attachments.