LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 06-29-2016, 10:59 PM   #1
asajith
LQ Newbie
 
Registered: Jun 2016
Posts: 3

Rep: Reputation: Disabled
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

Last edited by asajith; 06-29-2016 at 11:38 PM.
 
Old 07-01-2016, 11:25 PM   #2
Rinndalir
Member
 
Registered: Sep 2015
Posts: 733

Rep: Reputation: Disabled
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.
 
Old 07-06-2016, 03:39 AM   #3
asajith
LQ Newbie
 
Registered: Jun 2016
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks for the response, I am using the login and getty commands which are coming as part of BusyBox v1.18.4
 
Old 07-06-2016, 08:54 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
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.
 
Old 07-28-2016, 12:50 AM   #5
asajith
LQ Newbie
 
Registered: Jun 2016
Posts: 3

Original Poster
Rep: Reputation: Disabled
Unhappy

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
 
Old 07-29-2016, 02:29 PM   #6
Rinndalir
Member
 
Registered: Sep 2015
Posts: 733

Rep: Reputation: Disabled
Which 2.6 kernel? Maybe you are using a broken kernel.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Reading from a serial port rpbulls Linux - Newbie 1 07-31-2015 09:43 AM
Replace login prompt with interactive bash script on serial port neo3matrix Linux - General 1 01-21-2015 12:07 PM
Serial port reading jayadhanesh Linux - Newbie 3 05-19-2009 06:54 PM
reading from serial port IC009562 Linux - Software 2 11-08-2007 11:25 PM
serial port not working properly billyseth Linux - Hardware 1 10-27-2006 09:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 02:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration