This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: agetty problem - inconsistent echo


I am using a modem.  Hyperterminal is an application supplied with Windows
XP.   I have a USR Sportster  modem on the Win95 machine.  It is set up to
use hardware flow control.  I set the modem to not send result codes so
agetty never has anything to read until the connection is made and I press
enter on the calling machine.

I use agetty with the '-h' option for hardware flow control and a specific
port speed of 38400.  agetty starts and eventually tries to read either a \r
or \n from the tty because I use the -a autobaud option.  This was the only
way I could get agetty to do a blocking read until the connection was made.

Once I dial in and connect, I press enter to send a \r. agetty receives it
and prompts me for a login.  I looked at the agetty code that reads the
login id.  It reads one character at a time and writes it back to the tty.
I see this behavior in hyperterminal.  For the login id I don't have the
problem where every second character causes the echo. As I type a character,
it is immediately echoed back.

Once I type the \r, agetty spawns login.exe and it takes over.  It prompts
me for a password.  This is where are start to see the behavior that causes
the problem.  My password happens to be an even number of characters.  The
final \r is the first character of a pair, so nothing happens.  If I then
press \r again, the password is accepted, but the second \r is also
processed.

On WinXP, this doesnt happen.  I plan to run the XP version to check if the
stty -a output is different.  I'm wondering if there is a setting in Win95
that is similar to the min setting in stty.  Maybe Win95 is holding back the
data until at least 2 characters are received.

Thanks for your quick reply.  Hopefully someone else has an idea.  I'm
trying to come up with a solution that will be used on many old machines
that cannot be easiliy upgraded to XP without a significant hardware
investment, so getting this to work would really help me.

Thanks,
BB

"Randall R Schulz" <rrschulz at cris dot com> wrote in message
news:5 dot 2 dot 0 dot 9 dot 2 dot 20030314161234 dot 02da66d8 at pop3 dot cris dot com dot  dot  dot 
> BB,
>
> The TERM variable is used to indicate to programs that do things like
> cursor addressing or color how to effect the display features they
> require. It is irrelevant otherwise.
>
> The "min" tty setting, though it appears correct as you point out,
> would produce the symptoms you describe if set to 2.
>
> However, just for kicks, I decided to try setting "min" to 2 on my
> system. It seems to have no effect! It does not matter whether I'm
> running with CYGWIN=tty or not.
>
> By the way, the command line syntax and output from the "stty" command
> is somewhat idiosyncratic. When a keyword is prefixed with a minus
> sign, that mode or option is (turned) off. When the minus sign is
> missing, the mode or option is (turned) on. The same keywords and on /
> off syntax is used on the command line to turn modes and options on and
> off and in the output to display the current tty settings.
>
> Unfortunately, I cannot suggest what might really be happening on your
system.
>
> What sort of terminal are you connecting to the serial port? What is
> Hyperterminal? A terminal emulator? Are you connecting from another
> computer? From a different serial port on the same computer?
>
> Which shell are you using when you connect via the serial port?
>
> Randall Schulz
>
>
> At 16:08 2003-03-14, BB wrote:
> >Running stty -a dialed in from Hyperterminal I get the results below.
min
> >is set to 1. The only differences from what you sent in your reply are
> >echoe, echoctl, and echoke without '-'.
> >
> >Does it matter what the TERM environment variable is set to?  I have
> >configured agetty to set it to vt100 and to nothing (defualt to cygwin).
I
> >get the same results.
> >
> >The problem is not just with the end of line \r.  As I type characters,
> >every second character causes the echo of the two characters.  If the end
of
> >line happens to be the second of a pair, the command works.
> >
> >$ stty -a
> >speed 38400 baud; rows 24; columns 80; line = 0;
> >intr = ^C; quit = ^\; erase = ^H; kill = ^U; eof = ^D; eol = <undef>;
> >eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase =
^W;
> >lnext = ^V; flush = ^O; min = 1; time = 0;
> >-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
> >-ignbrk brkint -ignpar -parmrk -inpck istrip -inlcr -igncr icrnl
ixon -ixoff
> >-iuclc ixany imaxbel
> >opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0
vt0
> >ff0
> >isig icanon iexten echo echoe -echok -echonl -noflsh -tostop echoctl
echoke
> >
> >"Randall R Schulz" <rrschulz at cris dot com> wrote in message
> >news:5 dot 2 dot 0 dot 9 dot 2 dot 20030314150750 dot 02e033b0 at pop3 dot cris dot com dot  dot  dot 
> > > BB,
> > >
> > > Well, it's a long shot, but System V Unix-style tty drivers, including
> > > the Cygwin emulation on Windows, have a parameter, "min," that tells
> > > the minimum number of characters that must be present in the input
> > > buffer before it will be activated. Programs that use the readline
> > > library (BASH, e.g.) or that operate in a character-by-character mode
> > > (Vim or Emacs, e.g.) will typically have this set to 1:
> > >
> > > (running BASH)
> > > % stty -a
> > > ...
> > > ... min = 1; time = 0;
> > > -parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
> > > ...
> > > isig icanon iexten
> >echo -echoe -echok -echonl -noflsh -tostop -echoctl -echoke
> > >
> > >
> > > Your symptoms are consistent with "stty min 2", though I can think of
> > > no reason this would occur (a bug in agetty?), but you can confirm it
> > > by running "stty -a" and looking at what min setting it reports.
> > >
> > > Randall Schulz
> > >
> > >
> > >
> > > At 14:56 2003-03-14, BB wrote:
> > > >I am using agetty with both Win95 and WinXP.  On WinXP everything
works
> > > >fine. On Win95, I have a problem.
> > > >
> > > >When the Win95 machines modem answers the call, agetty correctly
> > prompts for
> > > >the login: id.  I type it in and notice that every character I type
is
> > > >immediately echoed back to me (I'm using hyperterminal).  This is
> > as I would
> > > >expect based on the agetty code.  Each character is read and
> > written back to
> > > >the tty.
> > > >
> > > >Once I enter the login id, agetty spawns login.exe.  From this
> > point on, the
> > > >characters I type are echoed back to me on every second character.
The
> > > >problem is that if I type a command with an odd number of
> > characters such as
> > > >"ls\r", nothing happens.  Once I type one more '\r' or even a space,
the
> > > >command is executed.  The extra character I typed is also echoed
back,
> > > >usually after the next shell prompt.
> > > >
> > > >What could be causing my input to be processed two characters at a
time.
> > > >This does not occur on an XP machine running agetty.
> > > >
> > > >Thanks
>
>




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]