Skip to contentSkip to conversation

Duplicate console output to a RS232C and keep keyb where it is

DISCUSSION Frank Torres 4 participants 9 messages Aug 3, 2001 – Aug 6, 2001

lore
Share & tools
lore
#0 lore raw

How do I make Linux to use the serial port RS232C as console and get the keyb entry from the normal console?

The RS232C is a serial port with 12V and there I have a BA63 20x4 display connected. (info worldwide)
It is setted with the right speed, parity, etc. I use echo whatever

Quoted 1 line

/dev/ttyS2 and it works.

If I use the command line parameter everybody says: (odd and 8 data bits is what I use)

            serial=2,9600o8
            console=ttyS2,9600o8 console=tty0

it shows the kernel messages in tty0 and it also sends it to the serial port (of course, but without configuring it, though, almost illegible) at the point of starting init, it stops the output.

If I swap the consoles (console=tty0 console=ttyS2,9600o8) it sends the kernel messages to both, the tty0 and the ttySn, but when init starts, it begins to send the Welcome... adn the Press I to enter... messages repetedely each time further one from another. Seldom it continues executing rc.sysinit processes, but it never comes to the end. I check it by connecting the serial output to a serial input in a PC also running Linux and using cat /dev/ttyS0.

I also used the line s0:1234:respawn .... at inittab, but it creates a new
line for loggin where you say it to do it. If I dont change lilo.conf but only inittab, I can see the loggin message. I don't want that. I just want it to get se loggin from the console I'm working with.

What I expect it to obtain all the console output through the serial port and the input through my keyboard using any of the virual consoles (let's say tty1), not comming from serial. Is there any way to do that?

Thanx from advance. Frank.

#1 lore raw
Quoted 5 lines · Frank Torres

The RS232C is a serial port with 12V and there I have a BA63 20x4 display connected. (info worldwide)
It is setted with the right speed, parity, etc. I use echo whatever

Quoted 1 line

/dev/ttyS2 and it works.

It has probably been set okay after boot by setserial in some boot script.

Quoted 4 lines

If I use the command line parameter everybody says: (odd and 8 data bits is what I use)

            serial=2,9600o8
            console=ttyS2,9600o8 console=tty0

This is not valid. You cannot reasonably have parity and 8 bits. One of them has to go. Either use 8 bits and no parity or 7 bits with parity.

This is because there are 10 bits/baud. The "stop" bit is a timing interval equal to one of these bits, between characters. Therefore, you can have many stop bits, this just spaces the characters.

Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).

I was going to compile a list of innovations that could be attributed to Microsoft. Once I realized that Ctrl-Alt-Del was handled in the BIOS, I found that there aren't any.

#2 lore raw
Quoted 3 lines · Frank Torres
Quoted 2 lines

The RS232C is a serial port with 12V and there I have a BA63 20x4

display

Quoted 1 line
Quoted 1 line

connected. (info worldwide). It is setted with the right speed, parity,

etc. I use echo whatever

Quoted 6 lines
Quoted 1 line
Quoted 1 line

/dev/ttyS2 and it works.

It has probably been set okay after boot by setserial in some boot script.

Quoted 1 line

If I use the command line parameter everybody says: (odd and 8 data

bits is

Quoted 10 lines
Quoted 2 lines

what I use)

            serial=2,9600o8   and     console=ttyS2,9600o8 console=tty0

This is not valid. You cannot reasonably have parity and 8 bits. One of them has to go. Either use 8 bits and no parity or 7 bits with parity.

This is because there are 10 bits/baud. The "stop" bit is a timing interval equal to one of these bits, between characters. Therefore, you can have many stop bits, this just spaces the characters.

Richard:
I must tell you I am the one who sets the speed, IRQ and the rest of the parameters of the serial port in an /etc/rc.serial built by me only with the settings I need. The original rc.serial was producing some error when executed by rc.sysinit (kern. 2.4.2-2)
I have to configure ttyS2 with both, setserial and stty, 'cause of the parity and the stop bit, etc.
I tested the following configurations:
8, no parity, stop b.
8, no parity, no stop b.
7, parity on, parity odd, stop b.
7, no parity, no stop b.
All showed wrong or no characters in the display. It only worked with 8, parity on, parity odd, stop b. (also with no stop b.)
The Linux is installed in a Beetle/M POS.
Perhaps it can't be done? I mean to obtain the video through the serial port without modifying the normal keyb entry?
Thanx

#3 lore raw
Quoted 11 lines · Frank Torres

Richard:
I must tell you I am the one who sets the speed, IRQ and the rest of the parameters of the serial port in an /etc/rc.serial built by me only with the settings I need. The original rc.serial was producing some error when executed by rc.sysinit (kern. 2.4.2-2)
I have to configure ttyS2 with both, setserial and stty, 'cause of the parity and the stop bit, etc.
I tested the following configurations:
8, no parity, stop b.
8, no parity, no stop b.

Quoted 9 lines

7, parity on, parity odd, stop b.
7, no parity, no stop b.
All showed wrong or no characters in the display. It only worked with 8, parity on, parity odd, stop b. (also with no stop b.)
The Linux is installed in a Beetle/M POS.
Perhaps it can't be done? I mean to obtain the video through the serial port without modifying the normal keyb entry?
Thanx

This works fine here (in /etc/lilo.conf):

 append  = "console=ttyS1,9600"       # RS-232C output
 append  = "console=null"             # (no log output)

Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).

I was going to compile a list of innovations that could be attributed to Microsoft. Once I realized that Ctrl-Alt-Del was handled in the BIOS, I found that there aren't any.

#4 lore raw
In reply to Richard B. Johnson
Quoted 3 lines · Frank Torres
Quoted 3 lines

This is not valid. You cannot reasonably have parity and 8 bits. One of them has to go. Either use 8 bits and no parity or 7 bits with parity.

All standard 16550 family ports support 8 bits _and_ parity. Ancient serial ports did have a restriction, but that restriction is no more.

Quoted 2 lines

All showed wrong or no characters in the display. It only worked with 8, parity on, parity odd, stop b. (also with no stop b.)

You actually mean 2 stop bits. (There is _always_ one stop bit).

I read your first mail, but couldn't really grasp the details of your problem.

Are you trying to direct console _output_ to ttyS2 and the VGA card, yet still accept input from the PS/2 keyboard? And then when you try to set this up, you get garbled characters via ttyS2?

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

#5 lore raw
In reply to Richard B. Johnson

From: "Richard B. Johnson" <[email protected]>

Quoted 15 lines · Frank Torres
Quoted 5 lines

The RS232C is a serial port with 12V and there I have a BA63 20x4 display connected. (info worldwide)
It is setted with the right speed, parity, etc. I use echo whatever

Quoted 1 line

/dev/ttyS2 and it works.

It has probably been set okay after boot by setserial in some boot script.

Quoted 4 lines

If I use the command line parameter everybody says: (odd and 8 data bits is what I use)

            serial=2,9600o8
            console=ttyS2,9600o8 console=tty0
Quoted 7 lines

This is not valid. You cannot reasonably have parity and 8 bits. One of them has to go. Either use 8 bits and no parity or 7 bits with parity.

This is because there are 10 bits/baud. The "stop" bit is a timing interval equal to one of these bits, between characters. Therefore, you can have many stop bits, this just spaces the characters.

Dick Johnson, that is utter nonsense. I have applications that use 8 bits, even parity, and two stop bits. I have applications that use 7 bits no parity and to stop bits.

Nor are there 10 buts/baud on an RS-232 port. Barring using BAUDOT protocols the baud and bit rate of an RS-232 port are the same number. When you get into complex signaling protocols such as are used in MODEMs you can get multiple bits sent within a signal protocol interval. The latter is called the baud (not baud rate) of the link. It is not uncommon to have 2400 baud or signaling intervals per second and have each of these intervals encode say 16 bits worth of data. Then you have to consider the error correcting and other protocols that may be placed on the raw bits transmitted each baud. Nonetheless, none of this applies to RS-232.

{^_^} Joanne "Been doing this for nearly 40 years" Dow

#6 lore raw
In reply to Richard B. Johnson
Quoted 12 lines · Frank Torres
Quoted 3 lines
Quoted 3 lines

This is not valid. You cannot reasonably have parity and 8 bits. One of them has to go. Either use 8 bits and no parity or 7 bits with parity.

All standard 16550 family ports support 8 bits _and_ parity. Ancient serial ports did have a restriction, but that restriction is no more.

Quoted 2 lines

All showed wrong or no characters in the display. It only worked with 8, parity on, parity odd, stop b. (also with no stop b.)

Quoted 8 lines

You actually mean 2 stop bits. (There is _always_ one stop bit).

I read your first mail, but couldn't really grasp the details of your problem.

Are you trying to direct console _output_ to ttyS2 and the VGA card, yet still accept input from the PS/2 keyboard? And then when you try to set this up, you get garbled characters via ttyS2?

Smthng like that.
Yes, I'm trying to direct console output to ttyS2 and to the VGA card at the same time.
I don't care if I have to direct it only to ttyS2, but I need to have the input from
the PS/2 keyboard. When I use the line

                s2:2345:respawn ....

in inittab, it sends a login prompt to the display connected to ttyS2, different console than
that on tty0, therefore, obtaining the keyboard input from PS/2 only for tty0.
If I use the command append="console=ttyS2,9600 ...." in lilo.conf it happens what I explained
in the first mail. If U want to, I can send you a mail with the kernel and init messages I got
connecting another serial port to ttyS2 and saving the data. I've seen everywhere it should be as simple as redirecting the output with the "console" command.
But it doesn't continue working alright after the Welcome message. ¿?

Frank Torres (34) 94 439 6261
Ingecom, Máximo Aguirre 18 Bis
Bilbao, 48011, Spain.

#7 lore raw
Quoted 9 lines · Frank Torres
Quoted 9 lines · Frank Torres
Quoted 3 lines
Quoted 3 lines

This is not valid. You cannot reasonably have parity and 8 bits. One of them has to go. Either use 8 bits and no parity or 7 bits with parity.

All standard 16550 family ports support 8 bits _and_ parity. Ancient serial ports did have a restriction, but that restriction is no more.

He said that he was connecting to a RS232C __terminal__. The fact that a device (like the 8250x/16550) can be used for non-standard serial communications is moot if you are not connecting to another 8250x/16550. And, somebody who has "been doing it for 40 years", as was stated in one response, should know that.

The RS-232C standard does not provide 8 bits at the same time parity us enabled. The fact that you "can do it" with certain devices says nothing for the standard. In fact, to help "fix" communications problems caused by non-standard hookups, "ISTRIP" was provided in Unix (and Linux), to strip off the parity bit that shouldn't be there anyway. It occurs when there is a 7-bit with parity terminal talking to a 8-bit, no parity host. If you are connecting to a terminal, and have some communications problems, it's best to feed it standard stuff to start.

The current problem:
During the console initialization sequence, its speed gets set to 38400 baud. This means nothing to a virtual terminal. However, if the attached RS-232C termional is also being set to the same speed, this could explain the garbage characters.

So I suggest that Frank set his terminal to 38400 baud and see if the problems disappear.

Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).

I was going to compile a list of innovations that could be attributed to Microsoft. Once I realized that Ctrl-Alt-Del was handled in the BIOS, I found that there aren't any.

#8 lore raw
Quoted 5 lines · Frank Torres
Quoted 4 lines
Quoted 4 lines · Frank Torres
Quoted 1 line
Quoted 1 line

This is not valid. You cannot reasonably have parity and 8 bits.

One

Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

of them has to go. Either use 8 bits and no parity or 7 bits with parity.

All standard 16550 family ports support 8 bits _and_ parity. Ancient serial ports did have a restriction, but that restriction is no more.

Quoted 9 lines

The current problem:
During the console initialization sequence, its speed gets set to 38400 baud. This means nothing to a virtual terminal. However, if the attached RS-232C termional is also being set to the same speed, this could explain the garbage characters.

So I suggest that Frank set his terminal to 38400 baud and see if the problems disappear.

I tried it out since the beginning Dick, but the display is hardware-configured to its max. speed (9600) So if I'd like to change the speed to a lower one I'd have to take a soldering iron and change the hard way. I could, but I'm obtaining the right characters at the display after writing an rc.serial with

setserial /dev/ttyS2 UART 16550A IRQ 10 spd_cust divisor 12 stty -F /dev/ttyS2 speed 9600 parenb parodd cs8 cstopb -crtscts

I don't care if I don't see the kernel messages. When rc.sysinit starts through init it calls rc.serial and configure the port. The problem is that I can't come to that point.. The moment rc.sysinit shows the message, it falls into a loop showing the message again and again. I've saved that output. If you want to, I can send U the file.

I just want to change the output to the serial port, but not the input.

inittab creates another prompt for login, that's not useful for me unless I can tell it to get the input from keyboard.

I've been trying some other choices. I've read that when Linux starts it uses the first display available. If it doesn't find one, it uses the first serial port, thus, ttyS0. But ttyS0 is a RC-232 and I need RC-232Cs to feed the display. So I swapped the major of ttyS0 and ttyS2, removed the display card and restarted the system, but when the kernel starts, I can't see nothing there. So I restored everything.
I'm trying desperate ways. Have U noticed it? :)

Greatfully, frank.