LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 06-24-2009, 04:18 AM   #1
Interloper
LQ Newbie
 
Registered: Jun 2009
Posts: 3

Rep: Reputation: 0
Post Porting Linux, the Serial Port, and TTY


Hello all,

I am porting the linux 2.6.30rc2 kernel from one ARM architecture, /arch/arm/mach-davinci, to a new device, called Jacinto2.

I am using the serial port ttyS0 as the default console. The bootloader is U-Boot and I am using busybox mounted as a ramdisk in internal SDRAM. I have got the kernel to the point where it will boot into the shell, however at this point I experience a weird error.

The kernel displays the '/# ' shell prompt, but the shell cannot take keyboard input. It will not react to any key presses, but can display text.

However, the serial interrupt functions properly, and if I use printk's to print the serial buffer (in function uart_insert_char in /include/linux/serial_core.h), it outputs the characters I type.

I'm pretty sure my busybox fs works fine, because when I pass init=/bin/ls (redirects to busybox.ls), I can see my fs properly, and passing a simple hello world program (init=/hello) outputs text like I expect.

I feel like somehow the tty_buffer is not passing the characters to the shell, but have no idea whether the architecture is set up incorrectly, or whether the tty_buffer / tty_driver is not initialized properly. Has anyone seen this before or have suggestions to try?

Thanks,
Joe


---------Log--------------------
...
RAMDISK: gzip image found at block 0
EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended
VFS: Mounted root (ext2 filesystem) on device 1:0.
Freeing init memory: 144K
uart_open(0) called
ttyS0 - using backup timer
*** trying init processes: </bin/sh>
*** run_init_process(/bin/sh)
/#
--------------------------------
at this point, my printk's/serial IRQ's will work, but the shell doesn't react to keyboard input
 
Old 06-24-2009, 09:25 AM   #2
Interloper
LQ Newbie
 
Registered: Jun 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Well, i've figured out that the characters are being stored in the "tty_buffer" struct. As I keep typing, the buffer fills up with these chars. (In the tty_insert_flip_char function in /include/linux/tty_flip.h)

Am I mistaken, or should this be cleared as the chars are flushed to the user space? Also, does anyone know how the tty passes its buffer to user space programs such as the shell?
 
Old 06-25-2009, 03:53 AM   #3
Interloper
LQ Newbie
 
Registered: Jun 2009
Posts: 3

Original Poster
Rep: Reputation: 0
So, as it turns out, the TTY and serial layers were fine.
The actual problem I'm having is with the schedule_delayed_work call.

The function tty_flip_buffer_push in drivers/char/tty_buffer.c calls flush_to_ldisc, which pushes the data to user space, if the tty->low_latency flag is set. Otherwise, it will push onto the scheduler with schedule_delayed_work. The problem here is that this delayed work is never revisited. Thus, my character input was never sent through to user space because the scheduler never called the process to do it again.

For the time being, I have hard coded it to always call flush_to_ldisc instead of the schedule_delayed_work, but this is not a fix, this is a workaround. Does anyone have any suggestions as to why this scheduling call wouldn't behave correctly?
 
  


Reply

Tags
boot, port, porting, process, serial, tty


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Well it worked in Windows..... Serial Port Communication Porting morty346 Programming 2 02-10-2009 04:14 PM
Porting Serial port program from windows to linux farofeiro Programming 4 01-09-2009 11:40 AM
TTy driver how to use underlying serial port vicky_driver Linux - Hardware 0 12-26-2008 05:48 AM
linux serial port to router console port connection? frankie_fix Linux - General 3 02-26-2007 09:32 PM
Using serial port card(PCMCIA) with IPAQ running Linux, can't find ttyS0 port d2army Linux - Laptop and Netbook 0 11-12-2005 08:07 PM


All times are GMT -5. The time now is 03:58 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration