automatic start of interactive programs

View: New views
2 Messages — Rating Filter:   Alert me  

automatic start of interactive programs

by Mikael Ostensson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

A question some of you that have done embedded programs with T2 that have interfaces.

I have a minimal T2 build I use as OS plattform for plant floor systems. They interact with PLCs, and other devices, and often display a status screeen.

In a past project I only needed to have a display of the "payload" program of my system, so I changes the init script to not spawn a getty on tty1, and instead redirected the output from my program to that tty. (program _name > tty1)
 
This worked great, but in my next project i need to have input (regular keyboard ) as well as reading/writing i/o ports.

So I need a method of starting the program on startup that have full access to the tty as root.
Any simple way to auto login or by pass the getty all together that will work?

If anyone have any suggestions, it would be greatly appreciated

Mikael Ostensson

-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
lists@... with a subject of: unsubscribe t2

Re: automatic start of interactive programs

by Tobias Gruetzmacher :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

On Sun, Jan 13, 2008 at 09:25:33AM -0500, Mikael Ostensson wrote:
> So I need a method of starting the program on startup that have full access
> to the tty as root.
> Any simple way to auto login or by pass the getty all together that will
> work?

Most programs have no problems if they are started directly from inittab
instead of getty. You just have to make sure in your program that it is
really running on tty1.

If you don't want to modify your program, there is always the solution
to autologin a specific user. mingetty has an option for this. From a PC
where this solution is used (someone else set it up and it works ;)),
here is the inittab entry:

1:23:respawn:/sbin/mingetty --autologin gast tty1

this user has the following snippet in his .bashrc:

# autostart ncmpc on tty1
if [ $(tty) = /dev/tty1 ]
then
  exec ncmpc
fi

There once was another setup with rungetty and I don't know why it was
changed to this way. This was the inittab entry with rungetty:

1:23:respawn:/sbin/rungetty -u gast -g gast --autologin gast tty1 -- /usr/bin/ncmpc

There a probably a dozen more solutions to achieve the same things, but
this one works on a "production" system ;)

Greetings, Tobi

--
GPG-Key 0xE2BEA341 - signed/encrypted mail preferred
My, oh so small, homepage: http://portfolio16.de/
http://www.fli4l.de/ - ISDN- & DSL-Router on one disk!
Registered FLI4L-User #00000003


-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
lists@... with a subject of: unsubscribe t2

signature.asc (196 bytes) Download Attachment