LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   login prompt not reading keyboard entries properly in serial port (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/login-prompt-not-reading-keyboard-entries-properly-in-serial-port-4175583401/)

asajith 06-29-2016 10:59 PM

login prompt not reading keyboard entries properly in serial port
 
In my embedded Linux (2.6) I am trying to enable login in serial port, so that after booting I should get the login prompt. I am using ttyS1 and in the /etc/inittab file I added this line to enable the login.

respawn:/bin/login < /dev/ttyS1 > /dev/ttyS1 2> /dev/ttyS1

Now I am gettig the login prompt but while typing the user name the login screen displays only alternate characters in the username (eg: if I type guest the screen displays ust), and unable to login also.

Instead of /bin/login tried using /sbin/getty, here also the scenario is same. With getty we can give the baud rate as a parameter, so I tried all standard baud rates but nothing worked.

minicom is my serial port interface. What will be the issue ? Need help

Rinndalir 07-01-2016 11:25 PM

I would read the docs under linux/Documentation for your 2.6 kernel regarding kernel parameters. Which login and which getty version? There are more than one in the world.

asajith 07-06-2016 03:39 AM

Thanks for the response, I am using the login and getty commands which are coming as part of BusyBox v1.18.4

michaelk 07-06-2016 08:54 AM

On a typical x86 using init, inittab would be

co:2345:respawn:/sbin/getty -L ttyS1 9600 vt100

You would need to configure minicom serial parameters for 9600, no parity, 8 bits, 1 stop bit and the port used on the computer connected to the SBC. Without knowing anything about your embedded device it is difficult to determine the problem.

asajith 07-28-2016 12:50 AM

Still trying to solve the issue. The minicom serial port parameters are, no parity, 8 bits, 1 stop bit and the my default baud rate is 57600.
The board is using the second UART so in the embedded Linux the serial port is /dev/ttyS1.
I cross compiled the latest version of busybox and tested, then also the issue is same. Doing further debugging I found that the login is using fgets for reading the username. So I created a small application and invoked it from the inittab (temporarily removed the login)

The application and its outputs

int main()
{
char str[25];
printf("Enter something:");
if(fgets (str, 25, stdin))
{
printf("String Read:");
puts(str);
}
return(0);
}

Now after booting, the above application start respawning
Enter something: guest
gString Read: uest

Enter something: guest
String Read: guest

Enter something: guest
gString Read: uest

Enter something: guest
String Read: guest

Enter something: (PRESSED ENTER KEY TWO TIMES)

/bin/sh: gg: not found
/ #

In the above example we can see that sometimes the first character is not going to the str[] buffer, it is read by the shell. After this if I give two enters continuously it shows
/bin/sh: gg: not found (gg is the two characters which are not read by the str[]).
This scenario is not only for the first characters, happening for intermediate characters also.
If I do ssh to this Linux and run this application, this reads full characters with out any drop.
Please help

Rinndalir 07-29-2016 02:29 PM

Which 2.6 kernel? Maybe you are using a broken kernel.


All times are GMT -5. The time now is 01:23 PM.