login on serial port

Hi,
I’d like to be able to login from terminal connected to a serial port.
I type ‘on -t /dev/ser1 login’, but it seems that login doesn’t
understand anything. Why?

Thanks,
Alain.

Try the help for ‘tinit’. You can edit /etc/config/ttys and setup login to
respawn on a serial port.

cheers,

Kris

“Alain Bonnefoy” <alain.bonnefoy@icbt.com> wrote in message
news:3C7F57C9.90207@icbt.com

Hi,
I’d like to be able to login from terminal connected to a serial port.
I type ‘on -t /dev/ser1 login’, but it seems that login doesn’t
understand anything. Why?

Thanks,
Alain.

Hi Kris,
Same, In fact I don't know how login works on a UNIX box, but here, the problem is that login only accept LF and not CR nor CR+LF.
I found only one terminal emulator which allows to send LF only. I tried TeraTermPro, powerVT320, VT320W32, RAT, and the particularly stupid Crimo$oft one of course, only Tiger Term allows to send LF only.
But I find it strange! Sure that lot of peoples connect their PC to Unix box. If this login problem was common, all term emulators would permit to send LF!

Regards,
Alain.

Kris Warkentin wrote:
Try the help for 'tinit'.  You can edit /etc/config/ttys and setup login to
respawn on a serial port.

cheers,

Kris

"Alain Bonnefoy" <> wrote in message
news:<3C7F57C9.90207@icbt.com>...
Hi,
I'd like to be able to login from terminal connected to a serial port.
I type 'on -t /dev/ser1 login', but it seems that login doesn't
understand anything. Why?

Thanks,
Alain.




Hi Alain,

Did you assign right terminal type in ttys file? It’s odd, but docu on ‘ttys’ file format, I found
in BSD help, but it seems work in RTP too. I hope the next release of RTP will include this
documentation :wink: See below the clip on this subj from old newmessage.

Eduard.

You probably have /etc/config/ttys file, and it contains sth like this:

con1 “/bin/login” qansi-m on
con2 “/bin/login” qansi-m on

Just add one line:

ser2 “/bin/login” vt100 on

(I assume you have vt100 terminal, if not, put the name of yours there, you
can find supported ones in /usr/lib/terminfo)

Pavol Kycina

Hi Kris,
Same, In fact I don’t know how login works on a UNIX box, but here, the problem is that login only
accept LF and not CR nor CR+LF.
I found only one terminal emulator which allows to send LF only. I tried TeraTermPro, powerVT320,
VT320W32, RAT, and the particularly stupid Crimo$oft one of course, only Tiger Term allows to send
LF only.
But I find it strange! Sure that lot of peoples connect their PC to Unix box. If this login problem
was common, all term emulators would permit to send LF!

Regards,
Alain.

Kris Warkentin wrote:
Try the help for ‘tinit’. You can edit /etc/config/ttys and setup login to
respawn on a serial port.

cheers,

Kris

“Alain Bonnefoy” <alain.bonnefoy@icbt.com> <mailto:alain.bonnefoy@icbt.com> wrote in message
news:3C7F57C9.90207@icbt.com <news:3C7F57C9.90207@icbt.com>…
Hi,
I’d like to be able to login from terminal connected to a serial port.
I type ‘on -t /dev/ser1 login’, but it seems that login doesn’t
understand anything. Why?

Thanks,
Alain.

Oddly enough, I had a similar problem with delete/backspace but it only
seemed to apply during the initial login (username/password) and then once I
had logged in, the terminal settings were fine. Maybe you could try xterm
instead of qansi-m?

cheers,

Kris

Really, I don’t think there is something to see with the terminal
setting here. I choosed VT100, but unfortunately most of the terminal
emulators send CR or CR+LF, and the terminal setting on the QRTP side
won’t change anything against that.
To the emulator side, sending CR, CR+LF or just LF doesn’t depend on the
terminal setting as we can choose it independantly by checkboxes, it
depends in fact on the application capabilities.
My feeling is that login (it’s input function) should take care of CR in
the same way of LF and should manage correctly CR+LF.
After that, terminal setting have a signification ONCE we are in a terminal.

cheers,
Alain.

Kris Warkentin wrote:

Oddly enough, I had a similar problem with delete/backspace but it only
seemed to apply during the initial login (username/password) and then once I
had logged in, the terminal settings were fine. Maybe you could try xterm
instead of qansi-m?

cheers,

Kris

I just looked at the login code and here’s the loop that is taking your
username:

for (p = nbuf; (ch = getchar()) != ‘\n’; ) {
if (ch == EOF) {
badlogin(username);
exit(0);
}
if (p < nbuf + (NBUFSIZ - 1))
*p++ = ch;
}

It looks like I could alter the loop like so:

for (p = nbuf; (ch = getchar()) != ‘\n’ && ch != ‘\r’; )

and do the same thing with getpass() in libc. I’m still puzzled however
because I connected my RTP box to my Windows box and didn’t have a problem.
shrug

cheers,

Kris
“Alain Bonnefoy” <alain.bonnefoy@icbt.com> wrote in message
news:3C846F43.3020406@icbt.com

Really, I don’t think there is something to see with the terminal
setting here. I choosed VT100, but unfortunately most of the terminal
emulators send CR or CR+LF, and the terminal setting on the QRTP side
won’t change anything against that.
To the emulator side, sending CR, CR+LF or just LF doesn’t depend on the
terminal setting as we can choose it independantly by checkboxes, it
depends in fact on the application capabilities.
My feeling is that login (it’s input function) should take care of CR in
the same way of LF and should manage correctly CR+LF.
After that, terminal setting have a signification ONCE we are in a
terminal.

cheers,
Alain.

Kris Warkentin wrote:

Oddly enough, I had a similar problem with delete/backspace but it only
seemed to apply during the initial login (username/password) and then
once I
had logged in, the terminal settings were fine. Maybe you could try
xterm
instead of qansi-m?

cheers,

Kris

Aha…I just remembered something. I had set things up as follows:

  1. add entry for ser1 to /etc/config/ttys

  2. restart tinit

  3. connect through null modem cable from windows box using hyperterm.

I think I must have run into the same problem as you because I couldn’t log
in either until I figured out the trick of hitting -enter and
-backspace to make things work. Once I was logged in there was no
problem.

cheers,

Kris

“Kris Warkentin” <kewarken@qnx.com> wrote in message
news:a62e6b$69u$1@nntp.qnx.com

I just looked at the login code and here’s the loop that is taking your
username:

for (p = nbuf; (ch = getchar()) != ‘\n’; ) {
if (ch == EOF) {
badlogin(username);
exit(0);
}
if (p < nbuf + (NBUFSIZ - 1))
*p++ = ch;
}

It looks like I could alter the loop like so:

for (p = nbuf; (ch = getchar()) != ‘\n’ && ch != ‘\r’; )

and do the same thing with getpass() in libc. I’m still puzzled however
because I connected my RTP box to my Windows box and didn’t have a
problem.
shrug

cheers,

Kris
“Alain Bonnefoy” <> alain.bonnefoy@icbt.com> > wrote in message
news:> 3C846F43.3020406@icbt.com> …
Really, I don’t think there is something to see with the terminal
setting here. I choosed VT100, but unfortunately most of the terminal
emulators send CR or CR+LF, and the terminal setting on the QRTP side
won’t change anything against that.
To the emulator side, sending CR, CR+LF or just LF doesn’t depend on the
terminal setting as we can choose it independantly by checkboxes, it
depends in fact on the application capabilities.
My feeling is that login (it’s input function) should take care of CR in
the same way of LF and should manage correctly CR+LF.
After that, terminal setting have a signification ONCE we are in a
terminal.

cheers,
Alain.

Kris Warkentin wrote:

Oddly enough, I had a similar problem with delete/backspace but it only
seemed to apply during the initial login (username/password) and then
once I
had logged in, the terminal settings were fine. Maybe you could try
xterm
instead of qansi-m?

cheers,

Kris

\

Ok,
I tried with a true VT320 terminal and it is unable to send LF solely. So, it's not a missing feature in most PC terminal emulators.
So, it should be necessary for login to accept CR.
Agree?

cheers,
Alain.

Kris Warkentin wrote:
Aha...I just remembered something.  I had set things up as follows:

1) add entry for ser1 to /etc/config/ttys

2) restart tinit

3) connect through null modem cable from windows box using hyperterm.

I think I must have run into the same problem as you because I couldn't log
in either until I figured out the trick of hitting -enter and
-backspace to make things work. Once I was logged in there was no
problem.

cheers,

Kris

"Kris Warkentin" <> wrote in message
news:a62e6b$69u$<1@nntp.qnx.com>...
I just looked at the login code and here's the loop that is taking your
username:

for (p = nbuf; (ch = getchar()) != '\n'; ) {
if (ch == EOF) {
badlogin(username);
exit(0);
}
if (p < nbuf + (NBUFSIZ - 1))
*p++ = ch;
}

It looks like I could alter the loop like so:

for (p = nbuf; (ch = getchar()) != '\n' && ch != '\r'; )

and do the same thing with getpass() in libc. I'm still puzzled however
because I connected my RTP box to my Windows box and didn't have a
problem.
*shrug*

cheers,

Kris
"Alain Bonnefoy" <> wrote in message
news:<3C846F43.3020406@icbt.com>...
Really, I don't think there is something to see with the terminal
setting here. I choosed VT100, but unfortunately most of the terminal
emulators send CR or CR+LF, and the terminal setting on the QRTP side
won't change anything against that.
To the emulator side, sending CR, CR+LF or just LF doesn't depend on the
terminal setting as we can choose it independantly by checkboxes, it
depends in fact on the application capabilities.
My feeling is that login (it's input function) should take care of CR in
the same way of LF and should manage correctly CR+LF.
After that, terminal setting have a signification ONCE we are in a
terminal.
cheers,
Alain.

Kris Warkentin wrote:

Oddly enough, I had a similar problem with delete/backspace but it only
seemed to apply during the initial login (username/password) and then
once I
had logged in, the terminal settings were fine.  Maybe you could try
xterm
instead of qansi-m?

cheers,

Kris






foreseen correction seems to be good, just one detail, after CR it's necessary to eat a possible LF.

cheers,
Alain

Kris Warkentin wrote:
I just looked at the login code and here's the loop that is taking your
username:

for (p = nbuf; (ch = getchar()) != '\n'; ) {
if (ch == EOF) {
badlogin(username);
exit(0);
}
if (p < nbuf + (NBUFSIZ - 1))
*p++ = ch;
}

It looks like I could alter the loop like so:

for (p = nbuf; (ch = getchar()) != '\n' && ch != '\r'; )

and do the same thing with getpass() in libc. I'm still puzzled however
because I connected my RTP box to my Windows box and didn't have a problem.
*shrug*

cheers,

Kris
"Alain Bonnefoy" <> wrote in message
news:<3C846F43.3020406@icbt.com>...
Really, I don't think there is something to see with the terminal
setting here. I choosed VT100, but unfortunately most of the terminal
emulators send CR or CR+LF, and the terminal setting on the QRTP side
won't change anything against that.
To the emulator side, sending CR, CR+LF or just LF doesn't depend on the
terminal setting as we can choose it independantly by checkboxes, it
depends in fact on the application capabilities.
My feeling is that login (it's input function) should take care of CR in
the same way of LF and should manage correctly CR+LF.
After that, terminal setting have a signification ONCE we are in a
terminal.
cheers,
Alain.

Kris Warkentin wrote:

Oddly enough, I had a similar problem with delete/backspace but it only
seemed to apply during the initial login (username/password) and then
once I
had logged in, the terminal settings were fine.  Maybe you could try
xterm
instead of qansi-m?

cheers,

Kris





Did you check the stty settings, particularly for inclr and icrnl?
“Alain Bonnefoy” <alain.bonnefoy@icbt.com> wrote in message news:3C84CAA2.4050409@icbt.com
Ok,
I tried with a true VT320 terminal and it is unable to send LF solely. So, it’s not a missing feature in most PC terminal emulators.
So, it should be necessary for login to accept CR.
Agree?

cheers,
Alain.

Kris Warkentin wrote:

Aha…I just remembered something. I had set things up as follows:1) add entry for ser1 to /etc/config/ttys2) restart tinit3) connect through null modem cable from windows box using hyperterm.I think I must have run into the same problem as you because I couldn’t login either until I figured out the trick of hitting -enter and-backspace to make things work. Once I was logged in there was noproblem.cheers,Kris"Kris Warkentin" <kewarken@qnx.com> wrote in messagenews:a62e6b$69u$1@nntp.qnx.com
I just looked at the login code and here’s the loop that is taking yourusername:for (p = nbuf; (ch = getchar()) != ‘\n’; ) { if (ch == EOF) { badlogin(username); exit(0); } if (p < nbuf + (NBUFSIZ - 1)) *p++ = ch;}It looks like I could alter the loop like so:for (p = nbuf; (ch = getchar()) != ‘\n’ && ch != ‘\r’; )and do the same thing with getpass() in libc. I’m still puzzled howeverbecause I connected my RTP box to my Windows box and didn’t have a
problem.
shrugcheers,Kris"Alain Bonnefoy" <alain.bonnefoy@icbt.com> wrote in messagenews:3C846F43.3020406@icbt.com
Really, I don’t think there is something to see with the terminalsetting here. I choosed VT100, but unfortunately most of the terminalemulators send CR or CR+LF, and the terminal setting on the QRTP sidewon’t change anything against that.To the emulator side, sending CR, CR+LF or just LF doesn’t depend on theterminal setting as we can choose it independantly by checkboxes, itdepends in fact on the application capabilities.My feeling is that login (it’s input function) should take care of CR inthe same way of LF and should manage correctly CR+LF.After that, terminal setting have a signification ONCE we are in a
terminal.
cheers,Alain.Kris Warkentin wrote:
Oddly enough, I had a similar problem with delete/backspace but it onlyseemed to apply during the initial login (username/password) and then
once I
had logged in, the terminal settings were fine. Maybe you could try
xterm
instead of qansi-m?cheers,Kris

Sorry about the typo - I meant inlcr of course, not inclr.
“Eric Johnson” <eric@qnx.com> wrote in message news:a62khk$ant$1@nntp.qnx.com
Did you check the stty settings, particularly for inclr and icrnl?
“Alain Bonnefoy” <alain.bonnefoy@icbt.com> wrote in message news:3C84CAA2.4050409@icbt.com
Ok,
I tried with a true VT320 terminal and it is unable to send LF solely. So, it’s not a missing feature in most PC terminal emulators.
So, it should be necessary for login to accept CR.
Agree?

cheers,
Alain.

Kris Warkentin wrote:

Aha…I just remembered something. I had set things up as follows:1) add entry for ser1 to /etc/config/ttys2) restart tinit3) connect through null modem cable from windows box using hyperterm.I think I must have run into the same problem as you because I couldn’t login either until I figured out the trick of hitting -enter and-backspace to make things work. Once I was logged in there was noproblem.cheers,Kris"Kris Warkentin" <kewarken@qnx.com> wrote in messagenews:a62e6b$69u$1@nntp.qnx.com
I just looked at the login code and here’s the loop that is taking yourusername:for (p = nbuf; (ch = getchar()) != ‘\n’; ) { if (ch == EOF) { badlogin(username); exit(0); } if (p < nbuf + (NBUFSIZ - 1)) *p++ = ch;}It looks like I could alter the loop like so:for (p = nbuf; (ch = getchar()) != ‘\n’ && ch != ‘\r’; )and do the same thing with getpass() in libc. I’m still puzzled howeverbecause I connected my RTP box to my Windows box and didn’t have a
problem.
shrugcheers,Kris"Alain Bonnefoy" <alain.bonnefoy@icbt.com> wrote in messagenews:3C846F43.3020406@icbt.com
Really, I don’t think there is something to see with the terminalsetting here. I choosed VT100, but unfortunately most of the terminalemulators send CR or CR+LF, and the terminal setting on the QRTP sidewon’t change anything against that.To the emulator side, sending CR, CR+LF or just LF doesn’t depend on theterminal setting as we can choose it independantly by checkboxes, itdepends in fact on the application capabilities.My feeling is that login (it’s input function) should take care of CR inthe same way of LF and should manage correctly CR+LF.After that, terminal setting have a signification ONCE we are in a
terminal.
cheers,Alain.Kris Warkentin wrote:
Oddly enough, I had a similar problem with delete/backspace but it onlyseemed to apply during the initial login (username/password) and then
once I
had logged in, the terminal settings were fine. Maybe you could try
xterm
instead of qansi-m?cheers,Kris

Actually, we set the last character to ‘\0’ later. I decided a more elegant fix was

if(*(p-1) == ‘\r’)
*(p-1) = ‘\0’;
else
*p = ‘\0’;

cheers,

Kris
“Alain Bonnefoy” <alain.bonnefoy@icbt.com> wrote in message news:3C84CBC7.5020209@icbt.com
foreseen correction seems to be good, just one detail, after CR it’s necessary to eat a possible LF.

cheers,
Alain

Kris Warkentin wrote:

I just looked at the login code and here’s the loop that is taking yourusername:for (p = nbuf; (ch = getchar()) != ‘\n’; ) { if (ch == EOF) { badlogin(username); exit(0); } if (p < nbuf + (NBUFSIZ - 1)) *p++ = ch;}It looks like I could alter the loop like so:for (p = nbuf; (ch = getchar()) != ‘\n’ && ch != ‘\r’; )and do the same thing with getpass() in libc. I’m still puzzled howeverbecause I connected my RTP box to my Windows box and didn’t have a problem.shrugcheers,Kris"Alain Bonnefoy" <alain.bonnefoy@icbt.com> wrote in messagenews:3C846F43.3020406@icbt.com
Really, I don’t think there is something to see with the terminalsetting here. I choosed VT100, but unfortunately most of the terminalemulators send CR or CR+LF, and the terminal setting on the QRTP sidewon’t change anything against that.To the emulator side, sending CR, CR+LF or just LF doesn’t depend on theterminal setting as we can choose it independantly by checkboxes, itdepends in fact on the application capabilities.My feeling is that login (it’s input function) should take care of CR inthe same way of LF and should manage correctly CR+LF.After that, terminal setting have a signification ONCE we are in a
terminal.
cheers,Alain.Kris Warkentin wrote:
Oddly enough, I had a similar problem with delete/backspace but it onlyseemed to apply during the initial login (username/password) and then
once I
had logged in, the terminal settings were fine. Maybe you could try
xterm
instead of qansi-m?cheers,Kris

Hi,
I really don’t understand something, please help me. What is ‘tinit’ and esp. ‘init’ for? I have no
entry for init in my helpview database, but ‘use init’ says about ttys files. What is
/usr/lib/terminfo for? QNXRTP support ‘tic’ and ‘infocmp’, what it’s for? Also there is
termios.h… I guess all this stuff is for translation terminal’s “LF”“CR” to system’s ‘\n’ in
order to make ‘login’ and other system’s tools happy. Is it always “LF” “CR”? What if terminal
sends “CR” “LF”? Is it always ‘\0x0D’ ‘\0x0A’? What if some exotic terminal sends EXOTIC_BYTE as
“new line” char? Should I rewrite ‘login’ for EXOTIC_BYTE?
To be near of problem, could it be that ‘login’ read symbols from raw-mode stream? Or somehow it
by-passes the foreground process group associated with terminal… (
http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap11.html ) Who does assign /dev/ser1
as stdin&stdout for ‘login’?
BTW, I have no VT320 entry in my terminfo. I did not add any *.ti after installation.
Best regards,
Eduard.

Kris Warkentin <kewarken@qnx.com> wrote in article <a630ro$jia$1@nntp.qnx.com>…
Actually, we set the last character to ‘\0’ later. I decided a more elegant fix was

if(*(p-1) == ‘\r’)
*(p-1) = ‘\0’;
else
*p = ‘\0’;

cheers,

Kris

seems to be correct!
cheers,
Alain

Kris Warkentin wrote:
Actually, we set the last character to '\0' later.  I decided a more elegant fix was
 
if(*(p-1) == '\r')
    *(p-1) = '\0';
else
    *p = '\0';
 
cheers,
 
Kris
"Alain Bonnefoy" <

wrote in message news:> 3C84CBC7.5020209@icbt.com> </a
…</div

foreseen correction seems to be good, just one detail, after CR it’s necessary
to eat a possible LF.



cheers,

Alain



Kris Warkentin wrote:

I just looked at the login code and here's the loop that is taking your
username:

for (p = nbuf; (ch = getchar()) != '\n'; ) {
if (ch == EOF) {
badlogin(username);
exit(0);
}
if (p < nbuf + (NBUFSIZ - 1))
*p++ = ch;
}

It looks like I could alter the loop like so:

for (p = nbuf; (ch = getchar()) != '\n' && ch != '\r'; )

and do the same thing with getpass() in libc. I'm still puzzled however
because I connected my RTP box to my Windows box and didn't have a problem.
*shrug*

cheers,

Kris
"Alain Bonnefoy" <> wrote in message
news:<3C846F43.3020406@icbt.com>...
Really, I don't think there is something to see with the terminal
setting here. I choosed VT100, but unfortunately most of the terminal
emulators send CR or CR+LF, and the terminal setting on the QRTP side
won't change anything against that.
To the emulator side, sending CR, CR+LF or just LF doesn't depend on the
terminal setting as we can choose it independantly by checkboxes, it
depends in fact on the application capabilities.
My feeling is that login (it's input function) should take care of CR in
the same way of LF and should manage correctly CR+LF.
After that, terminal setting have a signification ONCE we are in a
terminal.
cheers,
Alain.

Kris Warkentin wrote:

Oddly enough, I had a similar problem with delete/backspace but it only
seemed to apply during the initial login (username/password) and then
once I
had logged in, the terminal settings were fine.  Maybe you could try
xterm
instead of qansi-m?

cheers,

Kris






The problem here is that we are talking about login on a remote machine,
we don’t know yet what we are going to do on this machine; starting a
terminal or anything else. So, your ttys setting are not yet effective.
Once your login is granted, a terminal with a shell is started, and it’s
only that program (the terminal) which is able to take care of a
particular emulation.

cheers
Alain.

ed1k wrote:

Hi,
I really don’t understand something, please help me. What is ‘tinit’ and esp. ‘init’ for? I have no
entry for init in my helpview database, but ‘use init’ says about ttys files. What is
/usr/lib/terminfo for? QNXRTP support ‘tic’ and ‘infocmp’, what it’s for? Also there is
termios.h… I guess all this stuff is for translation terminal’s “LF”“CR” to system’s ‘\n’ in
order to make ‘login’ and other system’s tools happy. Is it always “LF” “CR”? What if terminal
sends “CR” “LF”? Is it always ‘\0x0D’ ‘\0x0A’? What if some exotic terminal sends EXOTIC_BYTE as
“new line” char? Should I rewrite ‘login’ for EXOTIC_BYTE?
To be near of problem, could it be that ‘login’ read symbols from raw-mode stream? Or somehow it
by-passes the foreground process group associated with terminal… (
http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap11.html > ) Who does assign /dev/ser1
as stdin&stdout for ‘login’?
BTW, I have no VT320 entry in my terminfo. I did not add any *.ti after installation.
Best regards,
Eduard.

Kris Warkentin <> kewarken@qnx.com> > wrote in article <a630ro$jia$> 1@nntp.qnx.com> >…
Actually, we set the last character to ‘\0’ later. I decided a more elegant fix was

if(*(p-1) == ‘\r’)
*(p-1) = ‘\0’;
else
*p = ‘\0’;

cheers,

Kris

Alain Bonnefoy <alain.bonnefoy@icbt.com> wrote in article <3C861E6D.6080600@icbt.com>…

The problem here is that we are talking about login on a remote machine,

I understand it.

we don’t know yet what we are going to do on this machine; starting a
terminal or anything else. So, your ttys setting are not yet effective.

It’s applied when you start login by ‘on -t /dev/ser1 login’. I’m not sure it’s right way, esp. if
you are unable to setup remote terminal to unix rules. But Kris mentioned he was restarting tinit
and he had added record for terminal on /dev/ser1. Or, maybe, ‘on -t tty’ should see ttys setting
for device?

I think if you assign /dev/ser1 (or another device) to be for terminal connection and you have some
kind of terminal (hardware or just soft emulation on another PC) the right way is restart tinit. In
this case you should have correct login, regardless of terminal type. Am I wrong?

Once your login is granted, a terminal with a shell is started, and it’s
only that program (the terminal) which is able to take care of a
particular emulation.

Which terminal you are speaking about? QNX host or remote machine. Remote terminal is running,
otherwise you don’t see any login prompt. Once your login is granted, a shell is started and shell
use /dev/ser1 as standard input/output streams. Sorry if I’m wrong or write down the stupid things,
I’m quite new in unix and I want to know how does it work :wink:

Cheers
Eduard.

Alain Bonnefoy <alain.bonnefoy@icbt.com> wrote:

The problem here is that we are talking about login on a remote machine,
we don’t know yet what we are going to do on this machine; starting a
terminal or anything else. So, your ttys setting are not yet effective.

What do you mean “starting” a terminal? You need to have a working
terminal before you can run login on it, don’t you?

Once your login is granted, a terminal with a shell is started, and it’s
only that program (the terminal) which is able to take care of a
particular emulation.

No. After you have entered your password, login simply execs into a
shell. A terminal is not “started” at this point: the shell runs on the
same terminal that login was running on. Unless you have some magic in
/etc/profile or your .profile that detects the terminal type and sets
$TERM and the stty stuff for you, the only reason why anything might
work differently under the shell than it did in login is because the
shell has its own code to do line editing, while login uses the generic
“cooked mode” handled by the driver. But the differences are minor.

(The shell seems to treat CR as a newline character; the “cooked mode”
treats a CR that wasn’t thrown away or turned into a newline by your
stty +igncr +icrnl settings, as an input character, and displays it as
“^M”. But there’s no way for either the shell or the driver to
recognize the arrow keys, or the Insert and Delete keys, unless
something has told them what escape sequences those keys generate on the
particular terminal that is attached to the serial line at the moment.
The console driver is in a much better position: since it just knows
what escape sequences it generates, it can initialize its device
settings properly without any doubt.)

I don’t know exactly how these things are supposed to work under QNX6,
but under QNX4, there was a utility called termdef that you could tell
tinit to run on a serial port instead of login. Termdef would ask you
what type of terminal you were using, then set $TERM and do the
equivalent of “stty load”, and finally exec into login. This way, when
login is started, your terminal settings are already correct, and login
does not need to worry about them any more than the shell does.


Wojtek Lerch QNX Software Systems Ltd.

Actually, not quite because p might actually be pointing to the start of the buffer so I need to check ( p != buf && *(p-1) == ‘\r’).

Oddly enough, I had done this check in one place but not another. It must have been monday :stuck_out_tongue:

Kris
“Alain Bonnefoy” <alain.bonnefoy@icbt.com> wrote in message news:3C861C8A.9060000@icbt.com
seems to be correct!
cheers,
Alain

Kris Warkentin wrote:

Actually, we set the last character to ‘\0’ later. I decided a more elegant fix was

if(*(p-1) == ‘\r’)
*(p-1) = ‘\0’;
else
*p = ‘\0’;

cheers,

Kris
“Alain Bonnefoy” <alain.bonnefoy@icbt.com > wrote in message news:3C84CBC7.5020209@icbt.com
foreseen correction seems to be good, just one detail, after CR it’s necessary to eat a possible LF.

cheers,
Alain

Kris Warkentin wrote:

I just looked at the login code and here’s the loop that is taking yourusername:for (p = nbuf; (ch = getchar()) != ‘\n’; ) { if (ch == EOF) { badlogin(username); exit(0); } if (p < nbuf + (NBUFSIZ - 1)) *p++ = ch;}It looks like I could alter the loop like so:for (p = nbuf; (ch = getchar()) != ‘\n’ && ch != ‘\r’; )and do the same thing with getpass() in libc. I’m still puzzled howeverbecause I connected my RTP box to my Windows box and didn’t have a problem.shrugcheers,Kris"Alain Bonnefoy" <alain.bonnefoy@icbt.com> wrote in messagenews:3C846F43.3020406@icbt.com
Really, I don’t think there is something to see with the terminalsetting here. I choosed VT100, but unfortunately most of the terminalemulators send CR or CR+LF, and the terminal setting on the QRTP sidewon’t change anything against that.To the emulator side, sending CR, CR+LF or just LF doesn’t depend on theterminal setting as we can choose it independantly by checkboxes, itdepends in fact on the application capabilities.My feeling is that login (it’s input function) should take care of CR inthe same way of LF and should manage correctly CR+LF.After that, terminal setting have a signification ONCE we are in a
terminal.
cheers,Alain.Kris Warkentin wrote:
Oddly enough, I had a similar problem with delete/backspace but it onlyseemed to apply during the initial login (username/password) and then
once I
had logged in, the terminal settings were fine. Maybe you could try
xterm
instead of qansi-m?cheers,Kris

Maybe we are not exactly talking about the same thing. I use tinit to wait for a login on a serial port.
That's done by adding the entry 'ser1 "/bin/login" vt100 on' in /etc/config/ttys and tinit do the rest.
So at that point, I don't know how tinit really works, but quite sure that it doesn't start a shell BEFORE launching the login procedure because I have to send ^J for login and password. After that, and ONLY after, terminal settings are managed correctly, according to the VT100 type I specified.

It seems that Kris is on the same wave length as me.

regards,
Alain.


Wojtek Lerch wrote:
Alain Bonnefoy <> wrote:
The problem here is that we are talking about login on a remote machine, 
we don't know yet what we are going to do on this machine; starting a
terminal or anything else. So, your ttys setting are not yet effective.

What do you mean "starting" a terminal? You need to have a working
terminal *before* you can run login on it, don't you?

Once your login is granted, a terminal with a shell is started, and it's 
only that program (the terminal) which is able to take care of a
particular emulation.

No. After you have entered your password, login simply execs into a
shell. A terminal is not "started" at this point: the shell runs on the
same terminal that login was running on. Unless you have some magic in
/etc/profile or your .profile that detects the terminal type and sets
$TERM and the stty stuff for you, the only reason why anything might
work differently under the shell than it did in login is because the
shell has its own code to do line editing, while login uses the generic
"cooked mode" handled by the driver. But the differences are minor.

(The shell seems to treat CR as a newline character; the "cooked mode"
treats a CR that wasn't thrown away or turned into a newline by your
stty +igncr +icrnl settings, as an input character, and displays it as
"^M". But there's no way for either the shell or the driver to
recognize the arrow keys, or the Insert and Delete keys, unless
something has told them what escape sequences those keys generate on the
particular terminal that is attached to the serial line at the moment.
The console driver is in a much better position: since it just knows
what escape sequences it generates, it can initialize its device
settings properly without any doubt.)

I don't know exactly how these things are supposed to work under QNX6,
but under QNX4, there was a utility called termdef that you could tell
tinit to run on a serial port instead of login. Termdef would ask you
what type of terminal you were using, then set $TERM and do the
equivalent of "stty load", and finally exec into login. This way, when
login is started, your terminal settings are already correct, and login
does not need to worry about them any more than the shell does.