Cancel respawn getty on serial tty

ralda at gmx.de ralda at gmx.de
Wed Dec 28 22:49:04 UTC 2011


Hallo Rod!

On Tue, 27 Dec 2011 15:40:34 -0800
Rod Nussbaumer <bomr at triumf.ca> wrote:

> I have a setup that uses busybox as the init process. It works fine, and
> is configured to spawn/respawn a getty on ttyS0. Sometimes, however, I
> would prefer to cancel the getty process on the serial port, in order to
> use the serial port for other purposes, such as setting up a C-kermit 
> connection on the port. Ideally, I'd like to then restart the getty 
> respawning when I'm done with the port.
> 
> How can I do this without modifying inittab and rebooting?
> Thanks.

Why fiddling with the inittab entries when you only temporarily need to
use your port for other purposes? There are several other ways to do
this.

You can just login normal on your ttyS0 and then do an "exec ckermit".
As long as ckermit runs it has the control of your port. When ckermit
exits getty is respawned and the port is reinitialized.

In case you need to reserve the port for a longer time, create a small
program that just does nothing until it is killed. Lets call it
tty_idle, then either login normal and do an "exec tty_idle" or create
a user account with tty_idle as user shell. Then you just need to login
with that users name and your port stays idle until you do "pkill
tty_idle". Meanwhile you can use it from other applications as you
like without getty interference.

--
Harald


Sample tty_idle.c source:

#include <unistd.h>

int main( int argc, char* argv )
{
  close(0);
  close(1);
  close(2);
  while (1) pause();
}


More information about the busybox mailing list