Esempio n. 1
0
bool UserScreen( void )
{
    switch( ConMode ) {
    case C_TTY:
        return( true );
    case C_QCON:
        console_active( ConCtrl, PrevConsole );
        break;
    }
    return( false );
}
Esempio n. 2
0
bool DebugScreen( void )
{
    switch( ConMode ) {
    case C_TTY:
        return( true );
    case C_QCON:
        PrevConsole = console_active( ConCtrl, DbgConsole );
        break;
    }
    return( false );
}
Esempio n. 3
0
static bool TryQConsole( void )
{
    struct _psinfo              psinfo;
    struct _sidinfo             info;
    struct _dev_info_entry      dev;
    char                        *ptr;
    const char                  *term;

    if( qnx_psinfo( PROC_PID, getpid(), &psinfo, 0, 0 ) != getpid() ) {
        StartupErr( "unable to obtain process information" );
    }
    if( qnx_sid_query( PROC_PID, psinfo.sid, &info ) != psinfo.sid ) {
        StartupErr( "unable to obtain console name" );
    }
    ptr = info.tty_name + strlen( info.tty_name );
    for( ;; ) {
        --ptr;
        if( *ptr < '0' || *ptr > '9' ) {
            break;
        }
    }
    if( DbgConsole != 0 ) {
        ptr[1] = '0' + DbgConsole / 10;
        ptr[2] = '0' + DbgConsole % 10;
        ptr += 2;
    }
    ptr[1] = NULLCHAR;
    DbgConHandle = open( info.tty_name, O_RDWR );
    if( DbgConHandle == -1 ) {
        StartupErr( "unable to open system console" );
    }
    term = getenv( "TERM" );
    if( term != NULL && strcmp( term, "qnxw" ) == 0 ) {
        /* in QNX windows */
#define PROP_STRING     "\033\"pwd\""
        write( DbgConHandle, PROP_STRING, sizeof( PROP_STRING ) - 1 );
    }

    ConCtrl = console_open( DbgConHandle, O_WRONLY );
    if( ConCtrl == NULL ) {
        close( DbgConHandle );
        return( false );
    }
    if( dev_info( DbgConHandle, &dev ) == -1 ) {
        StartupErr( "unable to obtain console information" );
    }
    DbgConsole = dev.unit;
    console_size( ConCtrl, DbgConsole, 0, 0, &PrevLines, &PrevColumns );
    console_size( ConCtrl, DbgConsole, DbgLines, DbgColumns, 0, 0 );
    InitConsole = console_active( ConCtrl, -1 );
    return( true );
}
Esempio n. 4
0
void FiniScreen( void )
{
    if( _IsOn( SW_USE_MOUSE ) ) GUIFiniMouse();
    uistop();
    switch( ConMode ) {
    case C_QCON:
        console_active( ConCtrl, InitConsole );
        console_size( ConCtrl, DbgConsole, PrevLines, PrevColumns, NULL, NULL );
        console_close( ConCtrl );
        break;
    case C_XWIN:
        signal( SIGHUP, SIG_IGN );
        kill( XQshPid, SIGTERM );
        break;
    }
}
Esempio n. 5
0
trap_retval ReqRead_user_keyboard( void )
{
    struct _console_ctrl    *con;
    unsigned                con_num;
    int                     con_hdl;
    int                     con_mode;
    char                    chr;
    //NYI: what about QNX windows?
    static char             con_name[] = "/dev/conXX";
    unsigned                timeout;
    read_user_keyboard_req      *acc;
    read_user_keyboard_ret      *ret;

#   define FIRST_DIGIT (sizeof( con_name ) - 3)

    acc = GetInPtr( 0 );
    ret = GetOutPtr( 0 );
    timeout = acc->wait * 10;
    if( timeout == 0 ) timeout = -1;
    ret->key = '\0';
    con = console_open( 2, O_WRONLY );
    if( con == NULL ) {
        return( sizeof( *ret ) );
    }
    con_num = console_active( con, -1 );
    console_close( con );
    con_name[ FIRST_DIGIT + 0 ] = (con_num / 10) + '0';
    con_name[ FIRST_DIGIT + 1 ] = (con_num % 10) + '0';

    con_hdl = open( con_name, O_RDONLY );
    if( con_hdl < 0 ) {
        if( timeout == -1 ) timeout = 50;
        sleep( timeout / 10 );
        return( sizeof( *ret ) );
    }
    con_mode = dev_mode( con_hdl, 0, _DEV_MODES );
    if( dev_read( con_hdl, &chr, 1, 1, 0, timeout, 0, 0 ) == 1 ) {
        if( chr == 0xff ) {
            read( con_hdl, &chr, 1 );
            chr = '\0';
        }
        ret->key = chr;
    }
    dev_mode( con_hdl, con_mode, _DEV_MODES );
    close( con_hdl );
    return( sizeof( *ret ) );
}
Esempio n. 6
0
/* This is called to do OS-specific stuff when we switch away from
 * our console.
 */
Bool xf86VTSwitchAway()
{
	int ret;
	unsigned event, bits;

	ErrorF("Called VT switch away!\n");

	/* First check wether we are trying to switch to our console... */
	if (xf86Info.vtRequestsPending == QNX_our_console) {
		xf86Info.vtRequestsPending = FALSE;
		return (FALSE);
		}

	/* Reenable console switching */
	QNX_con_bits &= ~QNX_con_mask;
        bits = console_ctrl(QNX_con_ctrl, -1, QNX_con_bits, QNX_con_mask);
        QNX_con_mask = 0;

	/* And activate the new console. Check if it is valid first... */
	ret = console_active(QNX_con_ctrl, xf86Info.vtRequestsPending);
	ErrorF("xf86VTSwitchAway: Made console %d active, ret %d\n", 
		xf86Info.vtRequestsPending, ret);
	xf86Info.vtRequestsPending = FALSE;

	if (ret == -1) {
	        QNX_con_mask = CONSOLE_INVISIBLE | CONSOLE_NOSWITCH;
	        QNX_con_bits = console_ctrl (QNX_con_ctrl, 
			QNX_our_console, QNX_con_mask, QNX_con_mask);
		return (FALSE);
		}
	/* Arm the console with the proxy so we know when we come back */
      	console_state(QNX_con_ctrl, QNX_our_console, 0L, _CON_EVENT_ACTIVE); 
	event = _CON_EVENT_ACTIVE;
        console_arm (QNX_con_ctrl, QNX_our_console, QNX_console_proxy, event);

        return(TRUE);
}