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.