[Previous]
[Contents]
[Next]

console_ctrl()

set bits in the control word for a console

Synopsis:

#include <sys/console.h>
unsigned console_ctrl( struct _console_ctrl *cc,
                       int console,
                       unsigned bits,
                       unsigned mask );

Description:

The console_ctrl() function sets any bits in the console control word for this console that are indicated in mask to be the corresponding value given in bits.

The previous, unmodified control word is returned.

Console control bits are defined in <sys/console.h>, and include at least the following:

CONSOLE_NOBOOT
Disable reboot from keyboard.
CONSOLE_NOSWITCH
Disable console switching from keyboard.
CONSOLE_NODEBUG
Disable debug entry from keyboard.
CONSOLE_NORESIZE
Disable display re-sizing from keyboard.
CONSOLE_NOCOLOR
Disable colors on the display.
CONSOLE_MONOCURS
Force the display cursor to be the size of a cursor on a monochrome display.
CONSOLE_SCANMODE
Enable scanmode key codes (see the QNX User's Guide).
CONSOLE_EXTMODE
Enable extended key codes (see the QNX User's Guide).

Returns:

The previous, unmodified control word. If an error is encountered, -1 is returned and errno is set.

Errors:

EACCES
You don't have permission to affect the specified console.
EINVAL
The control structure is in the wrong format.
ENXIO
The console value is invalid.

Examples:

#include <sys/console.h>
#include <fcntl.h>
#include <unistd.h>

int main( void )
  {
    struct _console_ctrl *cc;
    int fd, old;

    /*
     * Open up a channel to the console driver
     */
    fd = open( "/dev/con1", O_RDWR );
    cc = console_open( fd, O_RDWR );
    close( fd );

    /*
     * Suppress console switching
     */
    old = console_ctrl( cc, 0,
        CONSOLE_NOSWITCH, CONSOLE_NOSWITCH );

    /*
     * Restore console switching to previous state
     */
    console_ctrl( cc, 0, old, CONSOLE_NOSWITCH );
    /*
     * Close the channel
     */
    console_close( cc );
    return (EXIT_SUCCESS);
  }

Classification:

QNX

Safety:
Interrupt handler No
Signal handler Yes, but modifies errno
Thread Yes

See also:

console_active(), console_arm(), console_close(), console_font(), console_info(), console_open(), console_protocol(), console_read(), console_size(), console_state(), console_write(), errno


[Previous]
[Contents]
[Next]