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

Re: How to tell Sun keyboard console from serial console?

Greg A. Woods woods@weird.com
Thu, 16 Jan 2003 11:16:51 -0800 (PST)


[ On Tuesday, January 14, 2003 at 14:18:17 (-0500), Ernie Oporto wrote: ]
> Subject: How to tell Sun keyboard console from serial console?
>
> I there a way to tell whether a console is at the keyboard or at the
> serial port on a Sun machine?  The "tty" command gives /dev/console for
> both.

It depends somewhat on the particular type of machine and on the OS that
you're running on it.

Normally I believe on all modern versions of Solaris (SunOS-5) the
/dev/console file is a symbolic link to the actual device file in the
/devices directory.

On most/many/all versions and variants of Unix since the very beginning
the console device is a pseudo device that's mapped inside the kernel to
whatever real device(s) are configured or probed to be the physical
console.

As you'll read in the console(7D) manual page:

DESCRIPTION
     The file /dev/console refers to the system console device.

  SPARC
     The identity of this device depends on the EEPROM  or  NVRAM
     settings  in  effect  at  the  most recent system reboot; by
     default, it is the ``workstation console'' device consisting
     of  the workstation keyboard and frame buffer acting in con-
     cert to emulate an ASCII terminal (see wscons(7D)).

With Solaris 9 on a SunFire V100 I could find no particular hint in the
'dmesg' output suggesting how the console is attached.

On NetBSD it's pretty easy to see (especially if you also know what the
zs1 and zs0 devices are):

	$ /sbin/dmesg | fgrep console
	kbd0 at zs1 channel 0 (console input)
	bwtwo0 at sbus0 slot 2 offset 0x0 level 9: SUNW,501-1419, 1600 x 1280 (console)

	$ /sbin/dmesg | fgrep console
	zstty0 at zs0 channel 0 (console i/o)

You can also query the EEPROM/NVRAM settings on NetBSD and on Solaris:

    On NetBSD:

	# eeprom 2>/dev/null | fgrep put-device= 
	output-device=ttya
	input-device=ttya

	# eeprom 2>/dev/null | fgrep put-device=
	output-device=screen
	input-device=keyboard

    On SunOS:

	$ /usr/platform/`uname -i`/sbin/eeprom | fgrep put-device=
	output-device=screen
	input-device=keyboard

I'm not sure which information source you should trust more on Solaris,
but on NetBSD it's definitely the 'dmesg' output that's authoritative.

-- 
								Greg A. Woods

+1 416 218-0098;            <g.a.woods@ieee.org>;           <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>