[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: char-major-4 module



>Kevin wrote:
> [...log msgs about major char device 4 and getty in syslog...no keyboard...]
> [...]alias ... off[...]

You can do that, or you can comment out the lines that kick off (min)getty on
those tty's in /etc/inittab, which is what I used to do.

The reason you have all this trouble is that the sun keyboard device
actually knows if there is a keyboard plugged in, and returns an error
to open() if it is not. /dev/tty[0-6] all use the local keyboard, and
propagate that error when they are opened. So if you do not have a
keyboard plugged in, open("/dev/tty0") fails with error ENODEV.
A typical /etc/inittab tells init to keep respawning "/sbin/getty /dev/tty0" as
soon as it exits. But /sbin/getty exits as soon as it gets that ENODEV.
Hence the log messages.

The trouble with disabling getty on the local keyboard+video consoles is
that when you plug the keyboard back in, you cant use it until you login
over the serial port or ssh and reenable them, and use 'telinit' to have
/sbin/init reread /etc/inittab.

So what I did was better. I wrote a little wrapper for getty that just
hangs (well, until it gets an HUP signal, which makes it check for a
keyboard again) if there is no keyboard. Thus avoiding the infinite
respawn loop.

You can get it from http://nsd.dyndns.org/getty_if/

I use it on my ipx and on the sparc20. My /etc/inittab look like

[ipx (redhat)]:
[...]
# getty_if wrapper takes care of the case when there is no keyboard plugged in
# without it mingetty returns immediately and init spawns another...
1:2345:respawn:/sbin/getty_if /sbin/mingetty tty1
2:2345:respawn:/sbin/getty_if /sbin/mingetty tty2
[..]

[sparc20 (debian)]:
# Note (nsd): /sbin/getty_if wrapper takes care of the case when there
# is no keyboard plugged in
1:2345:respawn:/sbin/getty_if /sbin/mingetty 38400 tty1
2:23:respawn:/sbin/getty_if /sbin/mingetty 38400 tty2
[...]


-- 
-- Nicolas Dade    http://nsd.dyndns.org/    nic@jasiri.com



Reply to: