CONS(4)

NAME
cons - keyboard and console display interface

DESCRIPTION
The keyboard and various possible displays combine to provide a terminal-like interface to the system. Internally, these are separate devices which software combines to emulate a normal terminal. See the appropriate manual pages for information about each display and the keyboard.

The keyboard adapter also supports the speaker, which is activated when the ASCII character bel (^G) is sent to the display with software. For additional information on speaker control, see speaker(4).

Console Device Control

The display devices, /dev/ttyaed, /dev/ttyap16, /dev/ttyap8c, /dev/ttyapa8, /dev/ttyega, /dev/ttymono, /dev/ttympel, /dev/ttyvga, and /dev/tty8514 are all minor devices under /dev/console, and are all capable of displaying console output. Unique to this system is the fact that you may have one or more of these displays on your workstation at a time and any one can act as a console. With only one keyboard and system mouse, the console driver multiplexes these input devices to the many displays. All of the displays may have simultaneous logins and the user can ``hot key'' between each display. At first, this ``input focus'' is on the first device in the above sequence to be found at initialization time. The input focus can be manually switched to the next available display by pressing the default ``hot key'' <Alt><Scroll Lock>. When the input focus is on a display, all keyboard and mouse data are sent to the process(es) that read from that display.

If no other console tty device is open, and only the default input emulator is used (see kbdemul(4)), the input focus is set to /dev/console. In this case, <Alt><Scroll Lock> only switches which display gets console output. In the case where one or more tty devices are open, or the default input emulator changes, /dev/console gets no input. It tries to send output to the currently focused device. A user can redirect these console messages to any tty devices with the TIOCCONS ioctl.

To support the many displays and the multiplexing between them, an emulator package was developed to work with the console driver. This package allows different types of emulation on input and output to be written independently of device.

The display devices /dev/aed, /dev/apa16, /dev/apa8c, /dev/apa8, /dev/ega, /dev/mono, /dev/mpel, /dev/vga, and /dev/ibm8514 are also minor devices to /dev/console. They are typically used by window managers and other graphic applications. When the focus is pointed to one of these display devices, the console messages are put in a circular buffer (see bufemul(4)) unless redirected with the TIOCCONS ioctl. The buffer is flushed to the screen upon closing the display device.

The following are generic console ioctls defined in screen_cousf.u:

CON_SELECT_SCREEN
    Output focus is set to display number (arg > 0) or to next display in list (arg < 0). Previous display number is returned.

CON_GET_SCREEN
    Just returns the current output focus display number.

EIGETD
    Gets the number of the current input emulator for this display.

EOGETD
    Gets the number of the current output emulator for this display.

EISETD
    Sets the input emulator and returns the previous for this display.

EOSETD
    Sets the output emulator and returns the previous for this display.

CON_INIT_SCREEN
    Initializes the specified display (arg >=0) or this display (arg < 0).

CON_GET_FOCUS_CODE
    Gets the current keyboard code for setting the console focus (affects xemul only).

CON_SET_FOCUS_CODE
    Sets the current keyboard code for setting the console focus (affects xemul only), and return the previous code.

All of the above commands take integer arguments.

The following are generic console ioctls defined in consio.h:

SCRIOCGETF
    Gets the screen control flags for the given display number.

SCRIOCSETC
    Sets the screen control flags for the given display number.

SCRIOCGETF and SCRIOCSETC use the following structure:
struct screen_control {
			 int   device; /* which screen/display to control */
			 int   switches; /* Flags for this screen */
};

    CONSDEV_PRESENT
        Display is present on this system. This bit cannot be changed by SCRIOSETC.

    CONSDEV_KERNEL
        Display is available to the kernel.

    CONSDEV_USER
        Display is available to the user.

    CONSDEV_INIT
        Display has been initialized for output.

    CONSDEV_TTY
        Diplay has been initialuzed for output. This bit cannot be changed by SCRIOSETC.

    CONSDEV_GRA
        Graphics display has been opened directly by minor device number. This bit cannot be changed by SCRIOSETC.

    CONSDEV_NOINPUT
        Prevents the "round-robin" console focus-switching from finding this display. This flag is cleared when buf_emul is closed.

    SCRSETNIP
        Sets the no-input bit in the screen control flags for the display's current file description.

    SCRCLRNIP
        Clears the no-input bit in the screen control flags for the display's current file description.

The following ioctl is defined in bufemul.h:

BUFDISPINFO
    Arg returns the following information about the display:

    BUF_IS_ATR(arg)
        True when the CPU is an IBM 6152 Academic System.

    BUF_IS_RTPC(arg)
        True when the CPU is an IBM RT PC.

    BUF_GET_PCCODE(x)
        Get PC-Code version/type byte (IBM 6152 only).

    BUF_GET_VGA(arg)
        Get the type of display connected to the VGA. 0=none, 1=color, 2=gray. Valid only for the IBM 6152 Academic System.

    BUF_GET_8514(arg)
        Get the type of display connected to the IBM 8514/A. 0=none, 1=color, 2=gray. Valid only for the IBM 6152 Academic System.

    BUF_GET_EGA(arg)
        Returns the value of the switches on the EGA display. Valid only for the IBM RT PC with an EGA card installed.

All of the above ioctl system calls are device-independent controls for dealing with the emulators.

Each emulator has its own set of ioctls for its own emulation purposes. These other iotls are used in window-manager emulators for operations such as passing/positioning the mouse locator for/on the display. See the man page for any particular emulator for more information.

NOTE
On the IBM RT PC, the kernel flashes ``98'' on the LEDs if it cannot find any configured display during initialization, and then proceeds.

DIAGNOSTICS
None.

FILES

For the IBM RT PC:
/dev/console
/dev/aed
/dev/apa16
/dev/apa8c
/dev/apa8
/dev/ega
/dev/mono
/dev/mpel

For the IBM 6152 Academic System:
/dev/vga
/dev/ibm8514

SEE ALSO
bufemul(4), bus(4), ibm5081(4), ibm5151(4), ibm6153(4), ibm6154(4), ibm6155(4), ibm8514(4), ibmaed(4), ibmemul(4), kbdemul(4), speaker(4), stdemul(4), tty(4), vga(4), xemul(4), setscreen(8)
``IBM/4.3 Console Emulators'', in Volume II, Supplementary Documents