void PMAPI PM_saveConsoleState(void *stateBuf,int console_id) { #ifdef __QNXNTO__ int fd; int flags; if ((fd = open("/dev/con1", O_RDWR)) == -1) return; flags = _CONCTL_INVISIBLE_CHG | _CONCTL_INVISIBLE; devctl(fd, DCMD_CHR_SERCTL, &flags, sizeof flags, 0); close(fd); #else uchar *buf = &((uchar*)stateBuf)[PM_getVGAStateSize()]; /* Save QNX 4 console state */ console_read(cc, -1, 0, NULL, 0, (int *)buf+1, (int *)buf+2, NULL); *(int *)buf = console_ctrl(cc, -1, CONSOLE_NORESIZE | CONSOLE_NOSWITCH | CONSOLE_INVISIBLE, CONSOLE_NORESIZE | CONSOLE_NOSWITCH | CONSOLE_INVISIBLE); /* Save state of VGA registers */ PM_saveVGAState(stateBuf); #endif }
/* And this is called when we are switching back to the server */ Bool xf86VTSwitchTo() { unsigned bits, mask; ErrorF("Called VT switch to the server!\n"); QNX_con_mask = CONSOLE_INVISIBLE | CONSOLE_NOSWITCH; QNX_con_bits = console_ctrl (QNX_con_ctrl, QNX_our_console, QNX_con_mask, QNX_con_mask); xf86Info.vtRequestsPending = FALSE; return(TRUE); }
/* 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); }
void PMAPI PM_restoreConsoleState(const void *stateBuf,PM_HWND hwndConsole) { #ifdef __QNXNTO__ int fd; int flags; if ((fd = open("/dev/con1", O_RDWR)) == -1) return; flags = _CONCTL_INVISIBLE_CHG; devctl(fd, DCMD_CHR_SERCTL, &flags, sizeof flags, 0); close(fd); #else uchar *buf = &((uchar*)stateBuf)[PM_getVGAStateSize()]; /* Restore the state of the VGA compatible registers */ PM_restoreVGAState(stateBuf); /* Restore QNX 4 console state */ console_ctrl(cc, -1, *(int *)buf, CONSOLE_NORESIZE | CONSOLE_NOSWITCH | CONSOLE_INVISIBLE); console_write(cc, -1, 0, NULL, 0, (int *)buf+1, (int *)buf+2, NULL); #endif }