LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-07-2008, 04:18 AM   #1
MacHamster
LQ Newbie
 
Registered: Sep 2006
Distribution: Kubuntu
Posts: 16

Rep: Reputation: 0
staircase effect when redirecting to /dev/tty*


Hi,

I have an Ubuntu linux box sitting on a factory floor monitoring some manufacturing equipment.

This machine contains a simple perl script that automatically starts on boot via a script in /etc/init.d/

All this script does is monitor information sent to it from manufacturing equipment over its serial port and dumps it straight to /dev/tty1.

The script in /etc/init.d is very simple - nothing more than
Code:
case %1 in
start) 
  /sbin/monitor_stepper > /dev/tty1
;;
esac
That monitor_stepper programme proccesses the input it receives on the serial port and prints out relevent info using simple print "foo\n"; statements.

The idea here is that the monitoring process should be as simple as possible - we do not want to provide the factory workers with logins and have them run commands etc etc. All they need to do is read the screen.

So far everything is working as described. However...

All the output being dumped to /dev/tty1 is exhibiting the "staircase effect". Instead of getting output like
Code:
TP 7 3.3V
TP 8 3.28V
TP 30 11.998V
TP 31 12.09V
I'm getting
Code:
TP 7 3.3V
              TP 8 3.28V
                       TP 30 11.998V
                                   TP 31 12.09V
I've spent today playing around with stty to try and get it doing CR as well as NL, but I have been completely unsuccessful.

Does anyone have any idea how I can get text redirected to /dev/tty* to stop displaying the staircase effect? What's the right stty command?? (Or if stty is the wrong solution, what is?)

I am aware that if I change all print statements in the monitor_stepper programme to read "print "foo\r\n";" the problem goes away. I would much prefer to fix the problem using stty (or equivalent) rather than modifying the perl script because the same perl script is used in other places where having the modified print statements is not a good thing. I would prefer not to have to maintain multiple copies of the same perl script just to get CR working :-)

Thanks in advance.
 
Old 07-07-2008, 10:08 PM   #2
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
Is there a getty running on the terminal ? If so, its probably in raw mode.

You can use a filter to output the desired <NL><CR> easily enough:
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
redirecting /dev/ttyS0 -> stdin goestin Linux - Software 2 10-26-2011 11:34 AM
chroot: effect of makedev on /dev kel_en Debian 2 06-12-2006 12:41 PM
cat /dev/tty? yoshiznit123 Linux - Security 3 12-14-2005 12:44 PM
open() failed on /dev/tty ekko37 Linux - Software 7 01-15-2005 02:47 AM
Redirecting console boot messages to different tty. cenkozkan Linux - Software 2 01-17-2004 04:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:23 AM.

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